Fixed kDoc.
This commit is contained in:
parent
d7f55283d3
commit
e30e4b7003
1 changed files with 12 additions and 11 deletions
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
package net.thauvin.erik.pinboard
|
package net.thauvin.erik.pinboard
|
||||||
|
|
||||||
import net.thauvin.erik.pinboard.Constants.ENV_API_TOKEN
|
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -57,11 +56,13 @@ object Constants {
|
||||||
/**
|
/**
|
||||||
* A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in/).
|
* A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in/).
|
||||||
*
|
*
|
||||||
|
* @constructor Creates a new instance.
|
||||||
|
*
|
||||||
* @author [Erik C. Thauvin](https://erik.thauvin.net/)
|
* @author [Erik C. Thauvin](https://erik.thauvin.net/)
|
||||||
*/
|
*/
|
||||||
open class PinboardPoster() {
|
open class PinboardPoster() {
|
||||||
/**
|
/**
|
||||||
* Initialize from an API token.
|
* Creates a new instance using an [API Token][apiToken].
|
||||||
*
|
*
|
||||||
* @param apiToken The API token.
|
* @param apiToken The API token.
|
||||||
*/
|
*/
|
||||||
|
@ -70,25 +71,25 @@ open class PinboardPoster() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize from a properties and key.
|
* Creates a new instance using a [Properties][properties] and [Property Key][key].
|
||||||
*
|
*
|
||||||
* @param properties The properties.
|
* @param properties The properties.
|
||||||
* @param key The property key.
|
* @param key The property key.
|
||||||
*/
|
*/
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
constructor(properties: Properties, key: String = ENV_API_TOKEN) : this() {
|
constructor(properties: Properties, key: String = Constants.ENV_API_TOKEN) : this() {
|
||||||
apiToken = properties.getProperty(key, apiToken)
|
apiToken = properties.getProperty(key, apiToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize fom a properties file path and key.
|
* Creates a new instance using a [Properties File Path][propertiesFilePath] and [Property Key][key].
|
||||||
*
|
*
|
||||||
* @param propertiesFilePath The properties file path.
|
* @param propertiesFilePath The properties file path.
|
||||||
* @param key The property key.
|
* @param key The property key.
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
constructor(propertiesFilePath: Path, key: String = ENV_API_TOKEN) : this() {
|
constructor(propertiesFilePath: Path, key: String = Constants.ENV_API_TOKEN) : this() {
|
||||||
if (Files.exists(propertiesFilePath)) {
|
if (Files.exists(propertiesFilePath)) {
|
||||||
apiToken = Properties().apply {
|
apiToken = Properties().apply {
|
||||||
Files.newInputStream(propertiesFilePath).use { nis ->
|
Files.newInputStream(propertiesFilePath).use { nis ->
|
||||||
|
@ -99,17 +100,17 @@ open class PinboardPoster() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize fom a properties file and key.
|
* Creates a new instance using a [Properties File][propertiesFile] and [Property Key][key].
|
||||||
*
|
*
|
||||||
* @param propertiesFile The properties file.
|
* @param propertiesFile The properties file.
|
||||||
* @param key The property key.
|
* @param key The property key.
|
||||||
*/
|
*/
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
constructor(propertiesFile: File, key: String = ENV_API_TOKEN) : this(propertiesFile.toPath(), key)
|
constructor(propertiesFile: File, key: String = Constants.ENV_API_TOKEN) : this(propertiesFile.toPath(), key)
|
||||||
|
|
||||||
/** The API token. **/
|
/** The API token. **/
|
||||||
var apiToken: String = if (System.getenv(ENV_API_TOKEN).isNullOrBlank()) "" else System.getenv(ENV_API_TOKEN)
|
var apiToken: String = if (System.getenv(Constants.ENV_API_TOKEN).isNullOrBlank()) "" else System.getenv(Constants.ENV_API_TOKEN)
|
||||||
|
|
||||||
/** The API end point. **/
|
/** The API end point. **/
|
||||||
var apiEndPoint: String = Constants.API_ENDPOINT
|
var apiEndPoint: String = Constants.API_ENDPOINT
|
||||||
|
@ -120,7 +121,7 @@ open class PinboardPoster() {
|
||||||
private val client by lazy { OkHttpClient() }
|
private val client by lazy { OkHttpClient() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a bookmark to Pinboard.
|
* Adds a bookmark to Pinboard.
|
||||||
*
|
*
|
||||||
* This method supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add).
|
* This method supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add).
|
||||||
*
|
*
|
||||||
|
@ -168,7 +169,7 @@ open class PinboardPoster() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a bookmark on Pinboard.
|
* Deletes a bookmark on Pinboard.
|
||||||
*
|
*
|
||||||
* This method supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_delete).
|
* This method supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_delete).
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue