diff --git a/README.md b/README.md index 90ebaa7..b02dbaf 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,6 @@ bitly.call("/user".toEndPoint(), method = Methods.GET) } ``` - View [Example](https://github.com/ethauvin/bitly-shorten/blob/master/examples/src/main/kotlin/com/example/BitlyRetrieve.kt) + +### More +If all else fails, there's always more [Documentation](https://github.com/ethauvin/bitly-shorten/blob/master/docs/bitly-shorten/index.html). diff --git a/build.gradle.kts b/build.gradle.kts index 306c265..e79d69b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -147,11 +147,11 @@ tasks { dokka { outputFormat = "html" - outputDirectory = "$buildDir/javadoc" + outputDirectory = "$projectDir/docs" configuration { sourceLink { - path = "src/main/kotlin" + path = "$projectDir/src/main/kotlin" url = "https://github.com/ethauvin/${project.name}/tree/master/src/main/kotlin" lineSuffix = "#L" } diff --git a/docs/bitly-shorten/alltypes/index.html b/docs/bitly-shorten/alltypes/index.html new file mode 100644 index 0000000..0f4c545 --- /dev/null +++ b/docs/bitly-shorten/alltypes/index.html @@ -0,0 +1,39 @@ + +
+ +Bitly Shortener for Kotlin/Java
+Bitly Shortener for Kotlin/Java
+A simple implementation of the link shortening (bitlinks) abilities of the Bitly v4 API.
+
+net.thauvin.erik.bitly+ |
++ | +
Bitlinks(accessToken: String)
+Bitlinks methods implementation.
+See the Bitly API for more information.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-bitlinks/clicks.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitlinks/clicks.html new file mode 100644 index 0000000..548380e --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitlinks/clicks.html @@ -0,0 +1,32 @@ + + + +@JvmOverloads fun clicks(bitlink: String, unit: Units = Units.DAY, units: Int = -1, size: Int = 50, unit_reference: String = Constants.EMPTY, toJson: Boolean = false): String
(source)
+Returns the click counts for a specified Bitlink.
+See the Bitly API for more information.
+
+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.
@JvmOverloads fun create(domain: String = Constants.EMPTY, title: String = Constants.EMPTY, group_guid: String = Constants.EMPTY, tags: Array<String> = emptyArray(), deeplinks: Array<Map<String, String>> = emptyArray(), long_url: String, toJson: Boolean = false): String
(source)
+Converts a long url to a Bitlink and sets additional parameters.
+See the Bit.ly API for more information.
+
+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.
@JvmOverloads fun expand(bitlink_id: String, toJson: Boolean = false): String
(source)
+Expands a Bitlink.
+See the Bit.ly API for more information.
+
+toJson
- Returns the full JSON response if true
Return
+The long URL or JSON response, or on error, an empty string/JSON object.
open class Bitlinks
(source)
+Bitlinks methods implementation.
+See the Bitly API for more information.
+
+<init>+ |
+
+ Bitlinks methods implementation. +Bitlinks(accessToken: String) |
+
+clicks+ |
+
+ Returns the click counts for a specified Bitlink. +fun clicks(bitlink: String, unit: Units = Units.DAY, units: Int = -1, size: Int = 50, unit_reference: String = Constants.EMPTY, toJson: Boolean = false): String |
+
+create+ |
+
+ Converts a long url to a Bitlink and sets additional parameters. +fun create(domain: String = Constants.EMPTY, title: String = Constants.EMPTY, group_guid: String = Constants.EMPTY, tags: Array<String> = emptyArray(), deeplinks: Array<Map<String, String>> = emptyArray(), long_url: String, toJson: Boolean = false): String |
+
+expand+ |
+
+ Expands a Bitlink. +fun expand(bitlink_id: String, toJson: Boolean = false): String |
+
+shorten+ |
+
+ Shortens a long URL. +fun shorten(long_url: String, group_guid: String = Constants.EMPTY, domain: String = Constants.EMPTY, toJson: Boolean = false): String |
+
@JvmOverloads fun shorten(long_url: String, group_guid: String = Constants.EMPTY, domain: String = Constants.EMPTY, toJson: Boolean = false): String
(source)
+Shortens a long URL.
+See the Bit.ly API for more information.
+
+toJson
- Returns the full JSON response if true
Return
+The short URL or JSON response, or on error, the long_url or an empty JSON object.
Bitly(accessToken: String)
+Creates a new instance using an API Access Token.
+
+accessToken
- The API access token.
Bitly(properties: Properties, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates a new instance using a Properties and Property Key.
+
+key
- The property key containing the API Access Token.
Bitly(propertiesFilePath: Path, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates a new instance using a Properties File Path and Property Key.
+
+propertiesFilePath
- The properties file path.
+key
- The property key containing the API Access Token.
Bitly(propertiesFile: File, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates a new instance using a Properties File and Property Key.
+
+propertiesFile
- The properties file.
+key
- The property key containing the API Access Token.
Bitly()
+Creates new instance.
+Constructor
+Creates new instance.
var accessToken: String
(source)
+The API access token.
+See Generic Access Token or +Authentication.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/bitlinks.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/bitlinks.html new file mode 100644 index 0000000..f241281 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/bitlinks.html @@ -0,0 +1,15 @@ + + + +fun bitlinks(): Bitlinks
(source)
+Bitlinks accessor.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/call.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/call.html new file mode 100644 index 0000000..a60c55f --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/call.html @@ -0,0 +1,24 @@ + + + +@JvmOverloads fun call(endPoint: String, params: Map<String, String> = emptyMap(), method: Methods = Methods.POST): String
(source)
+Executes an API call.
+
+endPoint
- The REST endpoint. (eg. https://api-ssl.bitly.com/v4/shorten
)
+params
- The request parameters kev/value map.
+method
- The submission Method.
Return
+The response (JSON) from the API.
@NotNull fun getAccessToken(): java.lang.String
+The API access token.
+See Generic Access Token or +Authentication.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/index.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/index.html new file mode 100644 index 0000000..628311b --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-bitly/index.html @@ -0,0 +1,69 @@ + + + +open class Bitly
(source)
+A simple implementation of the Bitly Shortner API v4.
+
+<init>+ |
+
+ Creates a new instance using an API Access Token. +Bitly(accessToken: String)
+Creates a new instance using a Properties and Property Key. +Bitly(properties: Properties, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates a new instance using a Properties File Path and Property Key. +Bitly(propertiesFilePath: Path, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates a new instance using a Properties File and Property Key. +Bitly(propertiesFile: File, key: String = Constants.ENV_ACCESS_TOKEN)
+Creates new instance. +Bitly() |
+
+accessToken+ |
+
+ The API access token. +var accessToken: String |
+
+bitlinks+ |
+
+ Bitlinks accessor. +fun bitlinks(): Bitlinks |
+
+call+ |
+
+ Executes an API call. +fun call(endPoint: String, params: Map<String, String> = emptyMap(), method: Methods = Methods.POST): String |
+
@<?> fun setAccessToken(@NotNull p: java.lang.String): void
+The API access token.
+See Generic Access Token or +Authentication.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.html new file mode 100644 index 0000000..67dc738 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-a-p-i_-b-a-s-e_-u-r-l.html @@ -0,0 +1,17 @@ + + + +const val API_BASE_URL: String
(source)
+The Bitly API base URL.
+Value
+https://api-ssl.bitly.com/v4
Constants
static class Constants
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.html
new file mode 100644
index 0000000..cfbba2a
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y.html
@@ -0,0 +1,15 @@
+
+
+
+const val EMPTY: String
(source)
+Empty String.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.html new file mode 100644 index 0000000..348a296 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-m-p-t-y_-j-s-o-n.html @@ -0,0 +1,15 @@ + + + +const val EMPTY_JSON: String
(source)
+Empty JSON Object.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.html new file mode 100644 index 0000000..f138b4e --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-constants/-e-n-v_-a-c-c-e-s-s_-t-o-k-e-n.html @@ -0,0 +1,17 @@ + + + +const val ENV_ACCESS_TOKEN: String
(source)
+The API access token environment variable.
+Value
+BITLY_ACCESS_TOKEN
open class Constants
(source)
+Constants for this package.
+
+API_BASE_URL+ |
+
+ The Bitly API base URL. +const val API_BASE_URL: String |
+
+EMPTY+ |
+
+ Empty String. +const val EMPTY: String |
+
+EMPTY_JSON+ |
+
+ Empty JSON Object. +const val EMPTY_JSON: String |
+
+ENV_ACCESS_TOKEN+ |
+
+ The API access token environment variable. +const val ENV_ACCESS_TOKEN: String |
+
DELETE
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-g-e-t.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-g-e-t.html
new file mode 100644
index 0000000..1f8b253
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-g-e-t.html
@@ -0,0 +1,14 @@
+
+
+
+GET
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-a-t-c-h.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-a-t-c-h.html
new file mode 100644
index 0000000..c5385f5
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-a-t-c-h.html
@@ -0,0 +1,14 @@
+
+
+
+PATCH
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-o-s-t.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-o-s-t.html
new file mode 100644
index 0000000..6a29437
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/-p-o-s-t.html
@@ -0,0 +1,14 @@
+
+
+
+POST
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/index.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/index.html
new file mode 100644
index 0000000..cc99cdf
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-methods/index.html
@@ -0,0 +1,47 @@
+
+
+
+enum class Methods
(source)
+HTTP methods.
+
+DELETE+ |
++ | +
+GET+ |
++ | +
+PATCH+ |
++ | +
+POST+ |
++ | +
DAY
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-h-o-u-r.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-h-o-u-r.html
new file mode 100644
index 0000000..963a6bc
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-h-o-u-r.html
@@ -0,0 +1,14 @@
+
+
+
+HOUR
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-i-n-u-t-e.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-i-n-u-t-e.html
new file mode 100644
index 0000000..e488638
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-i-n-u-t-e.html
@@ -0,0 +1,14 @@
+
+
+
+MINUTE
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-o-n-t-h.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-o-n-t-h.html
new file mode 100644
index 0000000..bcdb288
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-m-o-n-t-h.html
@@ -0,0 +1,14 @@
+
+
+
+MONTH
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-w-e-e-k.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-w-e-e-k.html
new file mode 100644
index 0000000..3b82a76
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/-w-e-e-k.html
@@ -0,0 +1,14 @@
+
+
+
+WEEK
(source)
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-units/index.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/index.html
new file mode 100644
index 0000000..1781d14
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-units/index.html
@@ -0,0 +1,54 @@
+
+
+
+enum class Units
(source)
+Units of time.
+
+MINUTE+ |
++ | +
+HOUR+ |
++ | +
+DAY+ |
++ | +
+WEEK+ |
++ | +
+MONTH+ |
++ | +
Companion
+
+
diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/call.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/call.html
new file mode 100644
index 0000000..69df60b
--- /dev/null
+++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/call.html
@@ -0,0 +1,27 @@
+
+
+
+@JvmOverloads @NotNull fun call(@NotNull accessToken: java.lang.String, @NotNull endPoint: java.lang.String, @NotNull params: java.util.Map<java.lang.String, ? extends java.lang.Object>, @NotNull method: Methods): java.lang.String
@JvmOverloads @NotNull fun call(@NotNull accessToken: java.lang.String, @NotNull endPoint: java.lang.String, @NotNull params: java.util.Map<java.lang.String, ? extends java.lang.Object>): java.lang.String
@JvmOverloads @NotNull fun call(@NotNull accessToken: java.lang.String, @NotNull endPoint: java.lang.String): java.lang.String
+Executes an API call.
+
+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.
Return
+The response (JSON) from the API.
@NotNull fun getLogger(): java.util.logging.Logger
+The logger instance.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/index.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/index.html new file mode 100644 index 0000000..53b30a3 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/index.html @@ -0,0 +1,60 @@ + + + +static class Companion
+
+call+ |
+
+ Executes an API call. +fun call(accessToken: java.lang.String, endPoint: java.lang.String, params: java.util.Map<java.lang.String, ? extends java.lang.Object>, method: Methods): java.lang.String + fun call(accessToken: java.lang.String, endPoint: java.lang.String, params: java.util.Map<java.lang.String, ? extends java.lang.Object>): java.lang.String + fun call(accessToken: java.lang.String, endPoint: java.lang.String): java.lang.String |
+
+getLogger+ |
+
+ The logger instance. +fun getLogger(): java.util.logging.Logger |
+
+isValidUrl+ |
+
+ Validates a URL. +fun isValidUrl($this$isValidUrl: java.lang.String): boolean |
+
+removeHttp+ |
+
+ Removes http(s) scheme from string. +fun removeHttp($this$removeHttp: java.lang.String): java.lang.String |
+
+toEndPoint+ |
+
+ Builds the full API endpoint URL using the Constants.API_BASE_URL. +fun toEndPoint($this$toEndPoint: java.lang.String): java.lang.String |
+
@<?> fun isValidUrl(@NotNull $this$isValidUrl: java.lang.String): boolean
+Validates a URL.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/remove-http.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/remove-http.html new file mode 100644 index 0000000..381ac5e --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/remove-http.html @@ -0,0 +1,14 @@ + + + +@NotNull fun removeHttp(@NotNull $this$removeHttp: java.lang.String): java.lang.String
+Removes http(s) scheme from string.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/to-end-point.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/to-end-point.html new file mode 100644 index 0000000..716cde2 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/-companion/to-end-point.html @@ -0,0 +1,14 @@ + + + +@NotNull fun toEndPoint(@NotNull $this$toEndPoint: java.lang.String): java.lang.String
+Builds the full API endpoint URL using the Constants.API_BASE_URL.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/call.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/call.html new file mode 100644 index 0000000..dc00163 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/call.html @@ -0,0 +1,26 @@ + + + +@JvmOverloads fun call(accessToken: String, endPoint: String, params: Map<String, Any> = emptyMap(), method: Methods = Methods.POST): String
(source)
+Executes an API call.
+
+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.
Return
+The response (JSON) from the API.
open class Utils
(source)
+Useful functions.
+
+logger+ |
+
+ The logger instance. +val logger: Logger |
+
+call+ |
+
+ Executes an API call. +fun call(accessToken: String, endPoint: String, params: Map<String, Any> = emptyMap(), method: Methods = Methods.POST): String |
+
+isValidUrl+ |
+
+ Validates a URL. +fun String.isValidUrl(): Boolean |
+
+removeHttp+ |
+
+ Removes http(s) scheme from string. +fun String.removeHttp(): String |
+
+toEndPoint+ |
+
+ Builds the full API endpoint URL using the Constants.API_BASE_URL. +fun String.toEndPoint(): String |
+
fun String.isValidUrl(): Boolean
(source)
+Validates a URL.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/logger.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/logger.html new file mode 100644 index 0000000..55c5713 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/logger.html @@ -0,0 +1,18 @@ + + + +val logger: Logger
(source)
+The logger instance.
+Getter
+
The logger instance.
+ + + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/remove-http.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/remove-http.html new file mode 100644 index 0000000..ae13bb2 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/remove-http.html @@ -0,0 +1,15 @@ + + + +fun String.removeHttp(): String
(source)
+Removes http(s) scheme from string.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/to-end-point.html b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/to-end-point.html new file mode 100644 index 0000000..f867652 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/-utils/to-end-point.html @@ -0,0 +1,15 @@ + + + +fun String.toEndPoint(): String
(source)
+Builds the full API endpoint URL using the Constants.API_BASE_URL.
+ + diff --git a/docs/bitly-shorten/net.thauvin.erik.bitly/index.html b/docs/bitly-shorten/net.thauvin.erik.bitly/index.html new file mode 100644 index 0000000..1234ab7 --- /dev/null +++ b/docs/bitly-shorten/net.thauvin.erik.bitly/index.html @@ -0,0 +1,65 @@ + + + +
+Bitlinks+ |
+
+ Bitlinks methods implementation. +open class Bitlinks |
+
+Bitly+ |
+
+ A simple implementation of the Bitly Shortner API v4. +open class Bitly |
+
+Constants+ |
+
+ Constants for this package. +open class Constants |
+
+Methods+ |
+
+ HTTP methods. +enum class Methods |
+
+Units+ |
+
+ Units of time. +enum class Units |
+
+Utils+ |
+
+ Useful functions. +open class Utils |
+