diff --git a/README.md b/README.md index 3552ad0..93a8948 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,10 @@ bitly.bitlinks().expand("http://bit.ly/380ojFd") bitly.bitlinks().clicks("http://bit.ly/380ojFd") // Create a bitlink -bitly.bitlinks().create(title = "Erik's Weblog", long_url = "http://erik.thauvin.net/blog/") +bitly.bitlinks().create(title = "Erik's Weblog", long_url = "http://erik.thauvin.net/blog/") + +// Update a bitlink +bitly.bitlinks().update("http://bit.ly/380ojFd", title="Erik's Weblog", tags = arrayOf("blog", "weblog")) ``` - View [Kotlin](https://github.com/ethauvin/bitly-shorten/blob/master/examples/src/main/kotlin/com/example/BitlyExample.kt) or [Java](https://github.com/ethauvin/bitly-shorten/blob/master/examples/src/main/java/com/example/BitlySample.java) Examples. diff --git a/docs/alltypes/index.md b/docs/alltypes/index.md index 6abd5bc..76ea730 100644 --- a/docs/alltypes/index.md +++ b/docs/alltypes/index.md @@ -20,6 +20,13 @@ Provides functions to create and manage [Bitlinks](https://dev.bitly.com/v4/#tag Provides access to the [Bitly API v4](https://dev.bitly.com/v4). +| + +##### [net.thauvin.erik.bitly.CallResponse](../net.thauvin.erik.bitly/-call-response/index.md) + +Provides a data class to hold the JSON response. + + | ##### [net.thauvin.erik.bitly.Constants](../net.thauvin.erik.bitly/-constants/index.md) diff --git a/docs/net.thauvin.erik.bitly/-bitlinks/clicks.md b/docs/net.thauvin.erik.bitly/-bitlinks/clicks.md index d4fc518..515e559 100644 --- a/docs/net.thauvin.erik.bitly/-bitlinks/clicks.md +++ b/docs/net.thauvin.erik.bitly/-bitlinks/clicks.md @@ -10,11 +10,11 @@ See the [Bitly API](https://dev.bitly.com/v4/#operation/getClicksSummaryForBitli ### Parameters -`bitlink` - The bitlink. +`bitlink` - A Bitlink made of the domain and hash. -`unit` - A unit of time. +`unit` - A [unit of time](../-units/index.md). -`units` - An integer representing the time units to query data for. pass -1 to return all units available. +`units` - An integer representing the time units to query data for. Pass -1 to return all units available. `size` - The quantity of items to be be returned. diff --git a/docs/net.thauvin.erik.bitly/-bitlinks/index.md b/docs/net.thauvin.erik.bitly/-bitlinks/index.md index 4e394fe..30dcc5d 100644 --- a/docs/net.thauvin.erik.bitly/-bitlinks/index.md +++ b/docs/net.thauvin.erik.bitly/-bitlinks/index.md @@ -22,3 +22,4 @@ See the [Bitly API](https://dev.bitly.com/v4/#tag/Bitlinks) for more information | [create](create.md) | Converts a long url to a Bitlink and sets additional parameters.`fun create(domain: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, title: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, group_guid: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, tags: `[`Array`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`> = emptyArray(), deeplinks: `[`Array`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)`<`[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`>> = emptyArray(), long_url: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, toJson: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | | [expand](expand.md) | Expands a Bitlink.`fun expand(bitlink_id: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, toJson: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | | [shorten](shorten.md) | Shortens a long URL.`fun shorten(long_url: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, group_guid: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, domain: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, toJson: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [update](update.md) | Updates fields in the Bitlink.`fun update(bitlink: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, references: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`> = emptyMap(), archived: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, tags: `[`Array`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`> = emptyArray(), created_at: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, title: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, deeplinks: `[`Array`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)`<`[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`>> = emptyArray(), created_by: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, long_url: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, client_id: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, custom_bitlinks: `[`Array`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`> = emptyArray(), link: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, id: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.EMPTY, toJson: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/net.thauvin.erik.bitly/-bitly/call.md b/docs/net.thauvin.erik.bitly/-bitly/call.md index 5886568..ec60cbd 100644 --- a/docs/net.thauvin.erik.bitly/-bitly/call.md +++ b/docs/net.thauvin.erik.bitly/-bitly/call.md @@ -2,7 +2,7 @@ # call -`@JvmOverloads fun call(endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitly.kt#L117) +`@JvmOverloads fun call(endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`CallResponse`](../-call-response/index.md) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitly.kt#L117) Executes an API call. diff --git a/docs/net.thauvin.erik.bitly/-bitly/index.md b/docs/net.thauvin.erik.bitly/-bitly/index.md index 51f6d98..6f3d1fb 100644 --- a/docs/net.thauvin.erik.bitly/-bitly/index.md +++ b/docs/net.thauvin.erik.bitly/-bitly/index.md @@ -23,4 +23,4 @@ Provides access to the [Bitly API v4](https://dev.bitly.com/v4). | Name | Summary | |---|---| | [bitlinks](bitlinks.md) | Returns a new [Bitlinks](../-bitlinks/index.md) instance.`fun bitlinks(): `[`Bitlinks`](../-bitlinks/index.md) | -| [call](call.md) | Executes an API call.`fun call(endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [call](call.md) | Executes an API call.`fun call(endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`CallResponse`](../-call-response/index.md) | diff --git a/docs/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.md b/docs/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.md index beb111f..c24758f 100644 --- a/docs/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.md +++ b/docs/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.md @@ -2,7 +2,7 @@ # API_BASE_URL -`const val API_BASE_URL: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L42) +`const val API_BASE_URL: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L43) The Bitly API base URL. diff --git a/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.md b/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.md index d48cafe..8ffe3dd 100644 --- a/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.md +++ b/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.md @@ -2,7 +2,7 @@ # EMPTY -`const val EMPTY: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L51) +`const val EMPTY: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L53) Empty String. diff --git a/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.md b/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.md index 1a701aa..839f6dd 100644 --- a/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.md +++ b/docs/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.md @@ -2,7 +2,7 @@ # EMPTY_JSON -`const val EMPTY_JSON: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L54) +`const val EMPTY_JSON: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L56) Empty JSON Object. diff --git a/docs/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md b/docs/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md index c3ff8b3..8d2a60e 100644 --- a/docs/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md +++ b/docs/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md @@ -2,7 +2,7 @@ # ENV_ACCESS_TOKEN -`const val ENV_ACCESS_TOKEN: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L48) +`const val ENV_ACCESS_TOKEN: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L50) The API access token environment variable. diff --git a/docs/net.thauvin.erik.bitly/-constants/index.md b/docs/net.thauvin.erik.bitly/-constants/index.md index b7385f6..1380cdf 100644 --- a/docs/net.thauvin.erik.bitly/-constants/index.md +++ b/docs/net.thauvin.erik.bitly/-constants/index.md @@ -14,3 +14,5 @@ Provides the constants for this package. | [EMPTY](-e-m-p-t-y.md) | Empty String.`const val EMPTY: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | | [EMPTY_JSON](-e-m-p-t-y_-j-s-o-n.md) | Empty JSON Object.`const val EMPTY_JSON: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | | [ENV_ACCESS_TOKEN](-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md) | The API access token environment variable.`const val ENV_ACCESS_TOKEN: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [FALSE](-f-a-l-s-e.md) | False`const val FALSE: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [TRUE](-t-r-u-e.md) | True`const val TRUE: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/net.thauvin.erik.bitly/-utils/call.md b/docs/net.thauvin.erik.bitly/-utils/call.md index 11c1cb7..bc82ad2 100644 --- a/docs/net.thauvin.erik.bitly/-utils/call.md +++ b/docs/net.thauvin.erik.bitly/-utils/call.md @@ -2,7 +2,7 @@ # call -`@JvmOverloads fun call(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L65) +`@JvmOverloads fun call(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`CallResponse`](../-call-response/index.md) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L65) Executes an API call. diff --git a/docs/net.thauvin.erik.bitly/-utils/index.md b/docs/net.thauvin.erik.bitly/-utils/index.md index 635825d..8e4086f 100644 --- a/docs/net.thauvin.erik.bitly/-utils/index.md +++ b/docs/net.thauvin.erik.bitly/-utils/index.md @@ -16,7 +16,7 @@ Provides useful generic functions. | Name | Summary | |---|---| -| [call](call.md) | Executes an API call.`fun call(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [call](call.md) | Executes an API call.`fun call(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, endPoint: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, params: `[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`CallResponse`](../-call-response/index.md) | | [isValidUrl](is-valid-url.md) | Validates a URL.`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.isValidUrl(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | | [removeHttp](remove-http.md) | Removes http(s) scheme from string.`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.removeHttp(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | | [toEndPoint](to-end-point.md) | Builds the full API endpoint URL using the [Constants.API_BASE_URL](../-constants/-a-p-i_-b-a-s-e_-u-r-l.md).`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.toEndPoint(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/net.thauvin.erik.bitly/-utils/is-valid-url.md b/docs/net.thauvin.erik.bitly/-utils/is-valid-url.md index 8e7ba41..81a81ac 100644 --- a/docs/net.thauvin.erik.bitly/-utils/is-valid-url.md +++ b/docs/net.thauvin.erik.bitly/-utils/is-valid-url.md @@ -2,7 +2,7 @@ # isValidUrl -`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.isValidUrl(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L148) +`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.isValidUrl(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L149) Validates a URL. diff --git a/docs/net.thauvin.erik.bitly/-utils/remove-http.md b/docs/net.thauvin.erik.bitly/-utils/remove-http.md index 2b6a221..ff9aa3a 100644 --- a/docs/net.thauvin.erik.bitly/-utils/remove-http.md +++ b/docs/net.thauvin.erik.bitly/-utils/remove-http.md @@ -2,7 +2,7 @@ # removeHttp -`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.removeHttp(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L163) +`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.removeHttp(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L164) Removes http(s) scheme from string. diff --git a/docs/net.thauvin.erik.bitly/-utils/to-end-point.md b/docs/net.thauvin.erik.bitly/-utils/to-end-point.md index c601025..8ad55b5 100644 --- a/docs/net.thauvin.erik.bitly/-utils/to-end-point.md +++ b/docs/net.thauvin.erik.bitly/-utils/to-end-point.md @@ -2,7 +2,7 @@ # toEndPoint -`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.toEndPoint(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L170) +`fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.toEndPoint(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L171) Builds the full API endpoint URL using the [Constants.API_BASE_URL](../-constants/-a-p-i_-b-a-s-e_-u-r-l.md). diff --git a/docs/net.thauvin.erik.bitly/index.md b/docs/net.thauvin.erik.bitly/index.md index 0694f0e..a1d8eaf 100644 --- a/docs/net.thauvin.erik.bitly/index.md +++ b/docs/net.thauvin.erik.bitly/index.md @@ -10,6 +10,7 @@ Provides the classes necessary to access the [Bitly API v4](https://dev.bitly.co |---|---| | [Bitlinks](-bitlinks/index.md) | Provides functions to create and manage [Bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks).`open class Bitlinks` | | [Bitly](-bitly/index.md) | Provides access to the [Bitly API v4](https://dev.bitly.com/v4).`open class Bitly` | +| [CallResponse](-call-response/index.md) | Provides a data class to hold the JSON response.`data class CallResponse` | | [Constants](-constants/index.md) | Provides the constants for this package.`open class Constants` | | [Methods](-methods/index.md) | Provides HTTP methods definitions.`enum class Methods` | | [Units](-units/index.md) | Provides units of time definitions.`enum class Units` | diff --git a/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt b/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt index 1639512..c18097a 100644 --- a/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt +++ b/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt @@ -235,7 +235,7 @@ open class Bitlinks(private val accessToken: String) { id: String = Constants.EMPTY, toJson: Boolean = false ): String { - var result = if (toJson) Constants.EMPTY_JSON else "false" + var result = if (toJson) Constants.EMPTY_JSON else Constants.FALSE if (bitlink.isNotBlank()) { val response = Utils.call( accessToken, "/bitlinks/${bitlink.removeHttp()}".toEndPoint(), mutableMapOf().apply { @@ -259,7 +259,7 @@ open class Bitlinks(private val accessToken: String) { result = if (toJson) { response.body } else { - "true" + Constants.TRUE } } } diff --git a/src/test/kotlin/net/thauvin/erik/bitly/BitlyTest.kt b/src/test/kotlin/net/thauvin/erik/bitly/BitlyTest.kt index c6fd8bb..6e1e87a 100644 --- a/src/test/kotlin/net/thauvin/erik/bitly/BitlyTest.kt +++ b/src/test/kotlin/net/thauvin/erik/bitly/BitlyTest.kt @@ -141,7 +141,7 @@ class BitlyTest { @Test fun `update bitlink`() { assertEquals( - true.toString(), + Constants.TRUE, bitly.bitlinks().update(shortUrl, title = "Erik's Weblog", tags = arrayOf("blog", "weblog")) ) }