https://github.com/pearxteam/kpastebin
Multiplatform Kotlin library to interact with the pastebin.com API.
https://github.com/pearxteam/kpastebin
gradle-kotlin-dsl kotlin kotlin-coroutines kotlin-multiplatform kotlin-multiplatform-library ktor ktor-client pastebin pastebin-api pastebin-client
Last synced: 7 days ago
JSON representation
Multiplatform Kotlin library to interact with the pastebin.com API.
- Host: GitHub
- URL: https://github.com/pearxteam/kpastebin
- Owner: pearxteam
- License: mpl-2.0
- Created: 2020-08-16T09:13:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-29T22:15:26.000Z (over 4 years ago)
- Last Synced: 2025-04-02T19:51:33.501Z (28 days ago)
- Topics: gradle-kotlin-dsl, kotlin, kotlin-coroutines, kotlin-multiplatform, kotlin-multiplatform-library, ktor, ktor-client, pastebin, pastebin-api, pastebin-client
- Language: Kotlin
- Homepage:
- Size: 152 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE.TXT
Awesome Lists containing this project
README
# KPastebin [](https://search.maven.org/search?q=g:%22net.pearx.kpastebin%22%20AND%20a:%22kpastebin%22) [](https://github.com/KotlinBy/awesome-kotlin)
[](https://raw.githubusercontent.com/pearxteam/kpastebin/master/LICENSE.TXT)
[](https://discord.gg/q9cX9QE)


[](https://sonarcloud.io/dashboard?id=pearxteam_kpastebin)Multiplatform Kotlin library to interact with the pastebin.com API.
# Setup
1. Add the lib to your project's dependencies:* Groovy (replace `$kpastebin_version` with the version you want):
```groovy
// universal dependency for Gradle 5.3 and above
// in case of multiplatform project, just specify the dependency for commonMain/commonTest source set
implementation "net.pearx.kpastebin:kpastebin:$kpastebin_version"
```
```kotlin
// for Gradle versions below 5.3:
implementation "net.pearx.kpastebin:kpastebin-metadata:$kpastebin_version" // for Common
// or
implementation "net.pearx.kpastebin:kpastebin-jvm:$kpastebin_version" // for JVM
// or
implementation "net.pearx.kpastebin:kpastebin-js:$kpastebin_version" // for JS
// or
implementation "net.pearx.kpastebin:kpastebin-android:$kpastebin_version" // for Android
// or
implementation "net.pearx.kpastebin:kpastebin-PLATFORM_YOU_WANT:$kpastebin_version" // for Native
```* Kotlin (replace `$kpastebinVersion` with the version you want):
```kotlin
// universal dependency for Gradle 5.3 and above
// in case of multiplatform project, just specify the dependency for commonMain/commonTest source set
implementation("net.pearx.kpastebin:kpastebin:$kpastebinVersion")
```
```kotlin
// for Gradle versions below 5.3:
implementation("net.pearx.kpastebin:kpastebin-metadata:$kpastebinVersion") // for Common
// or
implementation("net.pearx.kpastebin:kpastebin-jvm:$kpastebinVersion") // for JVM
// or
implementation("net.pearx.kpastebin:kpastebin-js:$kpastebinVersion") // for JS
// or
implementation("net.pearx.kpastebin:kpastebin-android:$kpastebinVersion") // for Android
// or
implementation("net.pearx.kpastebin:kpastebin-PLATFORM_YOU_WANT:$kpastebinVersion") // for Native
```2. Add [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) and any [Ktor client engine](https://ktor.io/clients/http-client/engines.html) to your project's dependencies.
3. Use the library and have fun! See [net.pearx.kpastebin.PastebinClient](src/commonMain/kotlin/net/pearx/kpastebin/PastebinClient.kt) class KDoc for more info.
# Examples
```kotlin
runBlocking {
// see KDoc for more info
val client = PastebinClient("your dev key") // create a PastebinClient instance. You can get your dev key here: https://pastebin.com/doc_api#1
client.getPaste("0b42rwhf") // getting a paste
client.login("username", "password") // logging in
client.getUserDetails().accountType // getting current user account type
}
```