Added dokkaDocs
This commit is contained in:
parent
dcde83949b
commit
dd0079e7e8
46 changed files with 65 additions and 536 deletions
|
@ -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