Added dokkaDocs
This commit is contained in:
parent
dcde83949b
commit
dd0079e7e8
46 changed files with 65 additions and 536 deletions
|
@ -1,4 +1,5 @@
|
|||
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
@ -119,6 +120,25 @@ val javadocJar by tasks.creating(Jar::class) {
|
|||
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
||||
}
|
||||
|
||||
val dokkaDocs by tasks.creating(DokkaTask::class) {
|
||||
outputFormat = "gfm"
|
||||
outputDirectory = "$projectDir"
|
||||
|
||||
configuration {
|
||||
moduleName = "docs"
|
||||
sourceLink {
|
||||
path = file("$projectDir/src/main/kotlin").toURI().toString().replace("file:", "")
|
||||
url = "https://github.com/ethauvin/${project.name}/tree/master/src/main/kotlin"
|
||||
lineSuffix = "#L"
|
||||
}
|
||||
|
||||
jdkVersion = 8
|
||||
|
||||
includes = listOf("config/dokka/packages.md")
|
||||
includeNonPublic = false
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<JacocoReport> {
|
||||
reports {
|
||||
|
@ -146,13 +166,12 @@ tasks {
|
|||
}
|
||||
|
||||
dokka {
|
||||
outputFormat = "gfm"
|
||||
outputDirectory = "$projectDir"
|
||||
outputFormat = "html"
|
||||
outputDirectory = "$buildDir/javadoc"
|
||||
|
||||
configuration {
|
||||
moduleName = "docs"
|
||||
sourceLink {
|
||||
path = "$projectDir/src/main/kotlin"
|
||||
path = file("$projectDir/src/main/kotlin").toURI().toString().replace("file:", "")
|
||||
url = "https://github.com/ethauvin/${project.name}/tree/master/src/main/kotlin"
|
||||
lineSuffix = "#L"
|
||||
}
|
||||
|
@ -162,6 +181,7 @@ tasks {
|
|||
includes = listOf("config/dokka/packages.md")
|
||||
includeNonPublic = false
|
||||
}
|
||||
dependsOn(dokkaDocs)
|
||||
}
|
||||
|
||||
val copyToDeploy by registering(Copy::class) {
|
||||
|
@ -226,7 +246,22 @@ bintray {
|
|||
githubRepo = gitHub
|
||||
githubReleaseNotesFile = "README.md"
|
||||
vcsUrl = "$mavenUrl.git"
|
||||
setLabels("bitlinks", "bitly", "bitly-api", "bitly-v4", "java", "kotlin", "shorten", "shorten-urls", "shortener", "shortener-rest", "shortener-service", "shortens-links", "shorturl", "url-shortener")
|
||||
setLabels(
|
||||
"bitlinks",
|
||||
"bitly",
|
||||
"bitly-api",
|
||||
"bitly-v4",
|
||||
"java",
|
||||
"kotlin",
|
||||
"shorten",
|
||||
"shorten-urls",
|
||||
"shortener",
|
||||
"shortener-rest",
|
||||
"shortener-service",
|
||||
"shortens-links",
|
||||
"shorturl",
|
||||
"url-shortener"
|
||||
)
|
||||
publicDownloadNumbers = true
|
||||
version.apply {
|
||||
name = project.version as String
|
||||
|
|
|
@ -2,4 +2,8 @@
|
|||
|
||||
[Bitly Shortener for Kotlin/Java](https://github.com/ethauvin/bitly-shorten)
|
||||
|
||||
A simple implementation of the link shortening ([bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks)) abilities of the [Bitly v4 API](https://dev.bitly.com/v4).
|
||||
A simple implementation of the link shortening ([bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks)) abilities of the [Bitly API v4](https://dev.bitly.com/v4).
|
||||
|
||||
# Package net.thauvin.erik.bitly
|
||||
|
||||
Provides the classes necessary to access the [Bitly API v4](https://dev.bitly.com/v4).
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
|
||||
|
||||
[Bitly Shortener for Kotlin/Java](https://github.com/ethauvin/bitly-shorten)
|
||||
|
||||
### All Types
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Bitlinks](../net.thauvin.erik.bitly/-bitlinks/index.md)
|
||||
|
||||
Bitlinks methods implementation.
|
||||
|
||||
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Bitly](../net.thauvin.erik.bitly/-bitly/index.md)
|
||||
|
||||
A simple implementation of the [Bitly Shortner API v4](https://dev.bitly.com/v4/).
|
||||
|
||||
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Constants](../net.thauvin.erik.bitly/-constants/index.md)
|
||||
|
||||
Constants for this package.
|
||||
|
||||
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Methods](../net.thauvin.erik.bitly/-methods/index.md)
|
||||
|
||||
HTTP methods.
|
||||
|
||||
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Units](../net.thauvin.erik.bitly/-units/index.md)
|
||||
|
||||
Units of time.
|
||||
|
||||
|
||||
|
|
||||
|
||||
##### [net.thauvin.erik.bitly.Utils](../net.thauvin.erik.bitly/-utils/index.md)
|
||||
|
||||
Useful functions.
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
[docs](./index.md)
|
||||
|
||||
[Bitly Shortener for Kotlin/Java](https://github.com/ethauvin/bitly-shorten)
|
||||
|
||||
A simple implementation of the link shortening ([bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks)) abilities of the [Bitly v4 API](https://dev.bitly.com/v4).
|
||||
|
||||
### Packages
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [net.thauvin.erik.bitly](net.thauvin.erik.bitly/index.md) | |
|
||||
|
||||
### Index
|
||||
|
||||
[All Types](alltypes/index.md)
|
|
@ -1,10 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](index.md) / [<init>](./-init-.md)
|
||||
|
||||
# <init>
|
||||
|
||||
`Bitlinks(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`
|
||||
|
||||
Bitlinks methods implementation.
|
||||
|
||||
See the [Bitly API](https://dev.bitly.com/v4/#tag/Bitlinks) for more information.
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](index.md) / [clicks](./clicks.md)
|
||||
|
||||
# clicks
|
||||
|
||||
`@JvmOverloads fun clicks(bitlink: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, unit: `[`Units`](../-units/index.md)` = Units.DAY, units: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = -1, size: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 50, unit_reference: `[`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) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt#L63)
|
||||
|
||||
Returns the click counts for a specified Bitlink.
|
||||
|
||||
See the [Bitly API](https://dev.bitly.com/v4/#operation/getClicksSummaryForBitlink) for more information.
|
||||
|
||||
### Parameters
|
||||
|
||||
`bitlink` - The bitlink.
|
||||
|
||||
`unit` - A unit of time.
|
||||
|
||||
`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.
|
||||
|
||||
`unit_reference` - An ISO-8601 timestamp, indicating the most recent time for which to pull metrics.
|
||||
Will default to current time.
|
||||
|
||||
`toJson` - Returns the full JSON response if `true`
|
||||
|
||||
**Return**
|
||||
The click counts or JSON response object.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](index.md) / [create](./create.md)
|
||||
|
||||
# create
|
||||
|
||||
`@JvmOverloads 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) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt#L99)
|
||||
|
||||
Converts a long url to a Bitlink and sets additional parameters.
|
||||
|
||||
See the [Bit.ly API](https://dev.bitly.com/v4/#operation/createFullBitlink) for more information.
|
||||
|
||||
### Parameters
|
||||
|
||||
`toJson` - Returns the full JSON response if `true`
|
||||
|
||||
**Oaran**
|
||||
long_url The long URL.
|
||||
|
||||
**Return**
|
||||
The shorten URL or JSON response, or on error, an empty string/JSON object.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](index.md) / [expand](./expand.md)
|
||||
|
||||
# expand
|
||||
|
||||
`@JvmOverloads 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) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt#L137)
|
||||
|
||||
Expands a Bitlink.
|
||||
|
||||
See the [Bit.ly API](https://dev.bitly.com/v4/#operation/expandBitlink) for more information.
|
||||
|
||||
### Parameters
|
||||
|
||||
`bitlink_id` - The bitlink ID.
|
||||
|
||||
`toJson` - Returns the full JSON response if `true`
|
||||
|
||||
**Return**
|
||||
The long URL or JSON response, or on error, an empty string/JSON object.
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](./index.md)
|
||||
|
||||
# Bitlinks
|
||||
|
||||
`open class Bitlinks` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt#L47)
|
||||
|
||||
Bitlinks methods implementation.
|
||||
|
||||
See the [Bitly API](https://dev.bitly.com/v4/#tag/Bitlinks) for more information.
|
||||
|
||||
### Constructors
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [<init>](-init-.md) | Bitlinks methods implementation.`Bitlinks(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` |
|
||||
|
||||
### Functions
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [clicks](clicks.md) | Returns the click counts for a specified Bitlink.`fun clicks(bitlink: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, unit: `[`Units`](../-units/index.md)` = Units.DAY, units: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = -1, size: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 50, unit_reference: `[`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) |
|
||||
| [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) |
|
|
@ -1,19 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitlinks](index.md) / [shorten](./shorten.md)
|
||||
|
||||
# shorten
|
||||
|
||||
`@JvmOverloads 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) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitlinks.kt#L185)
|
||||
|
||||
Shortens a long URL.
|
||||
|
||||
See the [Bit.ly API](https://dev.bitly.com/v4/#operation/createBitlink) for more information.
|
||||
|
||||
### Parameters
|
||||
|
||||
`long_url` - The long URL.
|
||||
|
||||
`toJson` - Returns the full JSON response if `true`
|
||||
|
||||
**Return**
|
||||
The short URL or JSON response, or on error, the [long_url](shorten.md#net.thauvin.erik.bitly.Bitlinks$shorten(kotlin.String, kotlin.String, kotlin.String, kotlin.Boolean)/long_url) or an empty JSON object.
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitly](index.md) / [<init>](./-init-.md)
|
||||
|
||||
# <init>
|
||||
|
||||
`Bitly(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`
|
||||
|
||||
Creates a new instance using an [API Access Token](access-token.md).
|
||||
|
||||
### Parameters
|
||||
|
||||
`accessToken` - The API access token.`Bitly(properties: `[`Properties`](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`
|
||||
|
||||
Creates a new instance using a [Properties](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.util.Properties, kotlin.String)/properties) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.util.Properties, kotlin.String)/key).
|
||||
|
||||
### Parameters
|
||||
|
||||
`properties` - The properties.
|
||||
|
||||
`key` - The property key containing the [API Access Token](access-token.md).`Bitly(propertiesFilePath: `[`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`
|
||||
|
||||
Creates a new instance using a [Properties File Path](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.nio.file.Path, kotlin.String)/propertiesFilePath) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.nio.file.Path, kotlin.String)/key).
|
||||
|
||||
### Parameters
|
||||
|
||||
`propertiesFilePath` - The properties file path.
|
||||
|
||||
`key` - The property key containing the [API Access Token](access-token.md).`Bitly(propertiesFile: `[`File`](https://docs.oracle.com/javase/8/docs/api/java/io/File.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`
|
||||
|
||||
Creates a new instance using a [Properties File](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.io.File, kotlin.String)/propertiesFile) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.io.File, kotlin.String)/key).
|
||||
|
||||
### Parameters
|
||||
|
||||
`propertiesFile` - The properties file.
|
||||
|
||||
`key` - The property key containing the [API Access Token](access-token.md).`Bitly()`
|
||||
|
||||
Creates new instance.
|
||||
|
||||
**Constructor**
|
||||
Creates new instance.
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitly](index.md) / [accessToken](./access-token.md)
|
||||
|
||||
# accessToken
|
||||
|
||||
`var accessToken: `[`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#L51)
|
||||
|
||||
The API access token.
|
||||
|
||||
See [Generic Access Token](https://bitly.is/accesstoken) or
|
||||
[Authentication](https://dev.bitly.com/v4/#section/Authentication).
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitly](index.md) / [bitlinks](./bitlinks.md)
|
||||
|
||||
# bitlinks
|
||||
|
||||
`fun bitlinks(): `[`Bitlinks`](../-bitlinks/index.md) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitly.kt#L106)
|
||||
|
||||
Bitlinks accessor.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitly](index.md) / [call](./call.md)
|
||||
|
||||
# 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)`, `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/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)
|
||||
|
||||
Executes an API call.
|
||||
|
||||
### Parameters
|
||||
|
||||
`endPoint` - The REST endpoint. (eg. `https://api-ssl.bitly.com/v4/shorten`)
|
||||
|
||||
`params` - The request parameters kev/value map.
|
||||
|
||||
`method` - The submission [Method](../-methods/index.md).
|
||||
|
||||
**Return**
|
||||
The response (JSON) from the API.
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Bitly](./index.md)
|
||||
|
||||
# Bitly
|
||||
|
||||
`open class Bitly` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Bitly.kt#L45)
|
||||
|
||||
A simple implementation of the [Bitly Shortner API v4](https://dev.bitly.com/v4/).
|
||||
|
||||
### Constructors
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [<init>](-init-.md) | Creates a new instance using an [API Access Token](access-token.md).`Bitly(accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`<br>Creates a new instance using a [Properties](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.util.Properties, kotlin.String)/properties) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.util.Properties, kotlin.String)/key).`Bitly(properties: `[`Properties`](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`<br>Creates a new instance using a [Properties File Path](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.nio.file.Path, kotlin.String)/propertiesFilePath) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.nio.file.Path, kotlin.String)/key).`Bitly(propertiesFilePath: `[`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`<br>Creates a new instance using a [Properties File](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.io.File, kotlin.String)/propertiesFile) and [Property Key](-init-.md#net.thauvin.erik.bitly.Bitly$<init>(java.io.File, kotlin.String)/key).`Bitly(propertiesFile: `[`File`](https://docs.oracle.com/javase/8/docs/api/java/io/File.html)`, key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` = Constants.ENV_ACCESS_TOKEN)`<br>Creates new instance.`Bitly()` |
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [accessToken](access-token.md) | The API access token.`var accessToken: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
|
||||
|
||||
### Functions
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [bitlinks](bitlinks.md) | Bitlinks accessor.`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)`, `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`> = emptyMap(), method: `[`Methods`](../-methods/index.md)` = Methods.POST): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
|
|
@ -1,11 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Constants](index.md) / [API_BASE_URL](./-a-p-i_-b-a-s-e_-u-r-l.md)
|
||||
|
||||
# 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)
|
||||
|
||||
The Bitly API base URL.
|
||||
|
||||
**Value**
|
||||
`https://api-ssl.bitly.com/v4`
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Constants](index.md) / [EMPTY](./-e-m-p-t-y.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Empty String.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Constants](index.md) / [EMPTY_JSON](./-e-m-p-t-y_-j-s-o-n.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Empty JSON Object.
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Constants](index.md) / [ENV_ACCESS_TOKEN](./-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.md)
|
||||
|
||||
# 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)
|
||||
|
||||
The API access token environment variable.
|
||||
|
||||
**Value**
|
||||
`BITLY_ACCESS_TOKEN`
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Constants](./index.md)
|
||||
|
||||
# Constants
|
||||
|
||||
`open class Constants` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Constants.kt#L36)
|
||||
|
||||
Constants for this package.
|
||||
|
||||
### Companion Object Properties
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [API_BASE_URL](-a-p-i_-b-a-s-e_-u-r-l.md) | The Bitly API base URL.`const val API_BASE_URL: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
|
||||
| [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) |
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Methods](index.md) / [DELETE](./-d-e-l-e-t-e.md)
|
||||
|
||||
# DELETE
|
||||
|
||||
`DELETE` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Methods.kt#L39)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Methods](index.md) / [GET](./-g-e-t.md)
|
||||
|
||||
# GET
|
||||
|
||||
`GET` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Methods.kt#L39)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Methods](index.md) / [PATCH](./-p-a-t-c-h.md)
|
||||
|
||||
# PATCH
|
||||
|
||||
`PATCH` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Methods.kt#L39)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Methods](index.md) / [POST](./-p-o-s-t.md)
|
||||
|
||||
# POST
|
||||
|
||||
`POST` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Methods.kt#L39)
|
|
@ -1,16 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Methods](./index.md)
|
||||
|
||||
# Methods
|
||||
|
||||
`enum class Methods` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Methods.kt#L38)
|
||||
|
||||
HTTP methods.
|
||||
|
||||
### Enum Values
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [DELETE](-d-e-l-e-t-e.md) | |
|
||||
| [GET](-g-e-t.md) | |
|
||||
| [PATCH](-p-a-t-c-h.md) | |
|
||||
| [POST](-p-o-s-t.md) | |
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](index.md) / [DAY](./-d-a-y.md)
|
||||
|
||||
# DAY
|
||||
|
||||
`DAY` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L42)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](index.md) / [HOUR](./-h-o-u-r.md)
|
||||
|
||||
# HOUR
|
||||
|
||||
`HOUR` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L41)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](index.md) / [MINUTE](./-m-i-n-u-t-e.md)
|
||||
|
||||
# MINUTE
|
||||
|
||||
`MINUTE` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L40)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](index.md) / [MONTH](./-m-o-n-t-h.md)
|
||||
|
||||
# MONTH
|
||||
|
||||
`MONTH` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L44)
|
|
@ -1,5 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](index.md) / [WEEK](./-w-e-e-k.md)
|
||||
|
||||
# WEEK
|
||||
|
||||
`WEEK` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L43)
|
|
@ -1,17 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Units](./index.md)
|
||||
|
||||
# Units
|
||||
|
||||
`enum class Units` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Units.kt#L39)
|
||||
|
||||
Units of time.
|
||||
|
||||
### Enum Values
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [MINUTE](-m-i-n-u-t-e.md) | |
|
||||
| [HOUR](-h-o-u-r.md) | |
|
||||
| [DAY](-d-a-y.md) | |
|
||||
| [WEEK](-w-e-e-k.md) | |
|
||||
| [MONTH](-m-o-n-t-h.md) | |
|
|
@ -1,21 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](index.md) / [call](./call.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Executes an API call.
|
||||
|
||||
### Parameters
|
||||
|
||||
`accessToken` - The API access token.
|
||||
|
||||
`endPoint` - The REST endpoint. (eg. `https://api-ssl.bitly.com/v4/shorten`)
|
||||
|
||||
`params` - The request parameters kev/value map.
|
||||
|
||||
`method` - The submission [Method](../-methods/index.md).
|
||||
|
||||
**Return**
|
||||
The response (JSON) from the API.
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](./index.md)
|
||||
|
||||
# Utils
|
||||
|
||||
`open class Utils` [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L50)
|
||||
|
||||
Useful functions.
|
||||
|
||||
### Companion Object Properties
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [logger](logger.md) | The logger instance.`val logger: `[`Logger`](https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html) |
|
||||
|
||||
### Companion Object 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) |
|
||||
| [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) |
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](index.md) / [isValidUrl](./is-valid-url.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Validates a URL.
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](index.md) / [logger](./logger.md)
|
||||
|
||||
# logger
|
||||
|
||||
`val logger: `[`Logger`](https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html) [(source)](https://github.com/ethauvin/bitly-shorten/tree/master/src/main/kotlin/net/thauvin/erik/bitly/Utils.kt#L53)
|
||||
|
||||
The logger instance.
|
||||
|
||||
**Getter**
|
||||
|
||||
The logger instance.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](index.md) / [removeHttp](./remove-http.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Removes http(s) scheme from string.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[docs](../../index.md) / [net.thauvin.erik.bitly](../index.md) / [Utils](index.md) / [toEndPoint](./to-end-point.md)
|
||||
|
||||
# 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)
|
||||
|
||||
Builds the full API endpoint URL using the [Constants.API_BASE_URL](../-constants/-a-p-i_-b-a-s-e_-u-r-l.md).
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
[docs](../index.md) / [net.thauvin.erik.bitly](./index.md)
|
||||
|
||||
## Package net.thauvin.erik.bitly
|
||||
|
||||
### Types
|
||||
|
||||
| Name | Summary |
|
||||
|---|---|
|
||||
| [Bitlinks](-bitlinks/index.md) | Bitlinks methods implementation.`open class Bitlinks` |
|
||||
| [Bitly](-bitly/index.md) | A simple implementation of the [Bitly Shortner API v4](https://dev.bitly.com/v4/).`open class Bitly` |
|
||||
| [Constants](-constants/index.md) | Constants for this package.`open class Constants` |
|
||||
| [Methods](-methods/index.md) | HTTP methods.`enum class Methods` |
|
||||
| [Units](-units/index.md) | Units of time.`enum class Units` |
|
||||
| [Utils](-utils/index.md) | Useful functions.`open class Utils` |
|
|
@ -1,4 +0,0 @@
|
|||
$dokka.format:gfm
|
||||
$dokka.linkExtension:md
|
||||
|
||||
net.thauvin.erik.bitly
|
|
@ -40,7 +40,7 @@ import org.json.JSONObject
|
|||
import java.util.logging.Level
|
||||
|
||||
/**
|
||||
* Bitlinks methods implementation.
|
||||
* Provides functions to create and manage [Bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks).
|
||||
*
|
||||
* See the [Bitly API](https://dev.bitly.com/v4/#tag/Bitlinks) for more information.
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.nio.file.Path
|
|||
import java.util.Properties
|
||||
|
||||
/**
|
||||
* A simple implementation of the [Bitly Shortner API v4](https://dev.bitly.com/v4/).
|
||||
* Provides access to the [Bitly API v4](https://dev.bitly.com/v4).
|
||||
*
|
||||
* @constructor Creates new instance.
|
||||
*/
|
||||
|
@ -101,7 +101,7 @@ open class Bitly() {
|
|||
constructor(propertiesFile: File, key: String = Constants.ENV_ACCESS_TOKEN) : this(propertiesFile.toPath(), key)
|
||||
|
||||
/**
|
||||
* Bitlinks accessor.
|
||||
* Returns a new [Bitlinks] instance.
|
||||
*/
|
||||
fun bitlinks(): Bitlinks = Bitlinks(accessToken)
|
||||
|
||||
|
@ -109,12 +109,12 @@ open class Bitly() {
|
|||
* Executes an API call.
|
||||
*
|
||||
* @param endPoint The REST endpoint. (eg. `https://api-ssl.bitly.com/v4/shorten`)
|
||||
* @param params The request parameters kev/value map.
|
||||
* @param params The request parameters key/value map.
|
||||
* @param method The submission [Method][Methods].
|
||||
* @return The response (JSON) from the API.
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun call(endPoint: String, params: Map<String, String> = emptyMap(), method: Methods = Methods.POST): String {
|
||||
fun call(endPoint: String, params: Map<String, Any> = emptyMap(), method: Methods = Methods.POST): String {
|
||||
return Utils.call(accessToken, endPoint, params, method)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
package net.thauvin.erik.bitly
|
||||
|
||||
/** Constants for this package. **/
|
||||
/** Provides the constants for this package. */
|
||||
open class Constants private constructor() {
|
||||
companion object Constants {
|
||||
/** The Bitly API base URL.
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
package net.thauvin.erik.bitly
|
||||
|
||||
/**
|
||||
* HTTP methods.
|
||||
* Provides HTTP methods definitions.
|
||||
*/
|
||||
enum class Methods {
|
||||
DELETE, GET, PATCH, POST
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
package net.thauvin.erik.bitly
|
||||
|
||||
/**
|
||||
* Units of time.
|
||||
* Provides units of time definitions.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
enum class Units {
|
||||
|
|
|
@ -46,7 +46,7 @@ import java.net.URL
|
|||
import java.util.logging.Level
|
||||
import java.util.logging.Logger
|
||||
|
||||
/** Useful functions. */
|
||||
/** Provides useful generic functions. */
|
||||
open class Utils private constructor() {
|
||||
companion object {
|
||||
/** The logger instance. */
|
||||
|
@ -57,7 +57,7 @@ open class Utils private constructor() {
|
|||
*
|
||||
* @param accessToken The API access token.
|
||||
* @param endPoint The REST endpoint. (eg. `https://api-ssl.bitly.com/v4/shorten`)
|
||||
* @param params The request parameters kev/value map.
|
||||
* @param params The request parameters key/value map.
|
||||
* @param method The submission [Method][Methods].
|
||||
* @return The response (JSON) from the API.
|
||||
*/
|
||||
|
|
|
@ -127,6 +127,15 @@ class BitlyTest {
|
|||
|
||||
@Test
|
||||
fun `create bitlink`() {
|
||||
assertEquals(shortUrl, bitly.bitlinks().create(domain = "bit.ly", title = "Erik's Weblog", tags = arrayOf("erik", "thauvin", "blog", "weblog"), long_url = longUrl))
|
||||
assertEquals(
|
||||
shortUrl,
|
||||
bitly.bitlinks()
|
||||
.create(
|
||||
domain = "bit.ly",
|
||||
title = "Erik's Weblog",
|
||||
tags = arrayOf("erik", "thauvin", "blog", "weblog"),
|
||||
long_url = longUrl
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue