Updated examples.
This commit is contained in:
parent
4ca3773fe9
commit
e3f3ae2b2d
3 changed files with 2 additions and 4 deletions
|
@ -64,7 +64,7 @@ bitly.bitlinks().shorten("https://www.erik.thauvin.net/blog", toJson = true)
|
||||||
Non-implemented methods can also be called directly:
|
Non-implemented methods can also be called directly:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
bitly.call("/user".toEndPoint(), method = Methods.GET)
|
bitly.call("/user".toEndPoint(), method = Methods.GET).toJson()
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||||
implementation("org.json:json:20190722")
|
|
||||||
|
|
||||||
implementation("net.thauvin.erik:bitly-shorten:0.9.0-beta")
|
implementation("net.thauvin.erik:bitly-shorten:0.9.0-beta")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,12 @@ package com.example
|
||||||
import net.thauvin.erik.bitly.Bitly
|
import net.thauvin.erik.bitly.Bitly
|
||||||
import net.thauvin.erik.bitly.Methods
|
import net.thauvin.erik.bitly.Methods
|
||||||
import net.thauvin.erik.bitly.Utils.Companion.toEndPoint
|
import net.thauvin.erik.bitly.Utils.Companion.toEndPoint
|
||||||
import org.json.JSONObject
|
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
val bitly = Bitly(/* "YOUR_API_ACCESS_TOKEN from https://bitly.is/accesstoken" */)
|
val bitly = Bitly(/* "YOUR_API_ACCESS_TOKEN from https://bitly.is/accesstoken" */)
|
||||||
|
|
||||||
val json = JSONObject(bitly.call("/bitlinks/bit.ly/380ojFd".toEndPoint(), method = Methods.GET))
|
val json = bitly.call("/bitlinks/bit.ly/380ojFd".toEndPoint(), method = Methods.GET).toJson()
|
||||||
|
|
||||||
println("Bitlink is titled : " + json.getString("title"))
|
println("Bitlink is titled : " + json.getString("title"))
|
||||||
println("Bitlink created by: " + json.getString("created_by"))
|
println("Bitlink created by: " + json.getString("created_by"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue