From e3f3ae2b2dc7abc6c6d162b91fefb683d6a6957b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 3 Mar 2020 15:51:00 -0800 Subject: [PATCH] Updated examples. --- README.md | 2 +- examples/build.gradle.kts | 1 - examples/src/main/kotlin/com/example/BitlyRetrieve.kt | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 93a8948..0379088 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ bitly.bitlinks().shorten("https://www.erik.thauvin.net/blog", toJson = true) Non-implemented methods can also be called directly: ```kotlin -bitly.call("/user".toEndPoint(), method = Methods.GET) +bitly.call("/user".toEndPoint(), method = Methods.GET).toJson() ``` ```json { diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index abb667d..d5a39db 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -17,7 +17,6 @@ repositories { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - implementation("org.json:json:20190722") implementation("net.thauvin.erik:bitly-shorten:0.9.0-beta") } diff --git a/examples/src/main/kotlin/com/example/BitlyRetrieve.kt b/examples/src/main/kotlin/com/example/BitlyRetrieve.kt index ced18d8..daa1dae 100644 --- a/examples/src/main/kotlin/com/example/BitlyRetrieve.kt +++ b/examples/src/main/kotlin/com/example/BitlyRetrieve.kt @@ -3,13 +3,12 @@ package com.example import net.thauvin.erik.bitly.Bitly import net.thauvin.erik.bitly.Methods import net.thauvin.erik.bitly.Utils.Companion.toEndPoint -import org.json.JSONObject import kotlin.system.exitProcess fun main() { 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 created by: " + json.getString("created_by"))