Added docs.

This commit is contained in:
Erik C. Thauvin 2020-03-05 22:46:41 -08:00
parent de1b5caef4
commit fc4b25bda4
60 changed files with 829 additions and 0 deletions

View file

@ -0,0 +1,15 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [<init>](./-init-.md)
# <init>
`Akismet(apiKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, blog: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`
Create a new instance using an [Akismet](https://www.askimet.com/) API key and URL registered with Akismet.
`Akismet(apiKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`
Creates new instance using the provided [Akismet](https://www.askimet.com/) API key.
**Constructor**
Creates new instance using the provided [Akismet](https://www.askimet.com/) API key.

View file

@ -0,0 +1,18 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [appUserAgent](./app-user-agent.md)
# appUserAgent
`var appUserAgent: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L126)
The application user agent to be sent to Akismet.
If possible, the application user agent string should always use the following format:
```
Application Name/Version
```
The library's own user agent string will automatically be appended.
See the [Akismet API](https://akismet.com/development/api/#detailed-docs) for more details.

View file

@ -0,0 +1,8 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [blog](./blog.md)
# blog
`var blog: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L107)
The URL registered with Akismet.

View file

@ -0,0 +1,25 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [checkComment](./check-comment.md)
# checkComment
`@JvmOverloads fun checkComment(comment: `[`AkismetComment`](../-akismet-comment/index.md)`, trueOnError: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L275)
Comment Check.
This is the call you will make the most. It takes a number of arguments and characteristics about the submitted
content and then returns a thumbs up or thumbs down. Performance can drop dramatically if you choose to exclude
data points. The more data you send Akismet about each comment, the greater the accuracy. They recommend erring
on the side of including too much data
By default, if an error (IO, empty response from Akismet, etc.) occurs the function will return `false` and
log the error, use the `trueOnError` parameter to change this behavior.
See the [Akismet API](https://akismet.com/development/api/#comment-check) for more details.
### Parameters
`trueOnError` - Set to return `true` on error.
**Return**
`true` if the comment is spam, `false` if the comment is not.

View file

@ -0,0 +1,24 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [dateToGmt](./date-to-gmt.md)
# dateToGmt
`@JvmStatic fun dateToGmt(date: `[`Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L78)
Convert a date to a UTC timestamp. (ISO 8601)
**See Also**
[AkismetComment.dateGmt](../-akismet-comment/date-gmt.md)
[AkismetComment.postModifiedGmt](../-akismet-comment/post-modified-gmt.md)
`@JvmStatic fun dateToGmt(date: `[`LocalDateTime`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L91)
Convert a locale date/time to a UTC timestamp. (ISO 8601)
**See Also**
[AkismetComment.dateGmt](../-akismet-comment/date-gmt.md)
[AkismetComment.postModifiedGmt](../-akismet-comment/post-modified-gmt.md)

View file

@ -0,0 +1,16 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [debugHelp](./debug-help.md)
# debugHelp
`var debugHelp: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L199)
The `x-akismet-debug-help` header from the last operation, if any.
If the call returns neither `true` nor `false`, the `x-akismet-debug-help` header will provide context for any
error that has occurred.
Note that the `x-akismet-debug-help` header will not always be sent if a response does not return `false`
or `true`.
See the [Akismet API](https://akismet.com/development/api/#comment-check) for more details.

View file

@ -0,0 +1,14 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [errorMessage](./error-message.md)
# errorMessage
`var errorMessage: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L159)
The error message.
The error (IO, empty response from Akismet, etc.) message is also logged as a warning.
**See Also**
[Akismet.checkComment](check-comment.md)

View file

@ -0,0 +1,15 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [executeMethod](./execute-method.md)
# executeMethod
`@JvmOverloads fun executeMethod(apiUrl: HttpUrl?, formBody: FormBody, trueOnError: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L329)
Execute a call to an Akismet REST API method.
### Parameters
`apiUrl` - The Akismet API URL endpoint. (e.g. https://rest.akismet.com/1.1/verify-key)
`formBody` - The HTTP POST form body containing the request parameters to be submitted.
`trueOnError` - Set to return `true` on error (IO, empty response, etc.)

View file

@ -0,0 +1,8 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [httpStatusCode](./http-status-code.md)
# httpStatusCode
`var httpStatusCode: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L140)
The [HTTP status code](https://www.restapitutorial.com/httpstatuscodes.html) of the last operation.

View file

@ -0,0 +1,46 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](./index.md)
# Akismet
`open class Akismet` [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L59)
Provides access to the [Akismet API](https://akismet.com/development/api/).
### Constructors
| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | Create a new instance using an [Akismet](https://www.askimet.com/) API key and URL registered with Akismet.`Akismet(apiKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, blog: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)`<br>Creates new instance using the provided [Akismet](https://www.askimet.com/) API key.`Akismet(apiKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` |
### Properties
| Name | Summary |
|---|---|
| [appUserAgent](app-user-agent.md) | The application user agent to be sent to Akismet.`var appUserAgent: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [blog](blog.md) | The URL registered with Akismet.`var blog: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [debugHelp](debug-help.md) | The `x-akismet-debug-help` header from the last operation, if any.`var debugHelp: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [errorMessage](error-message.md) | The error message.`var errorMessage: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [httpStatusCode](http-status-code.md) | The [HTTP status code](https://www.restapitutorial.com/httpstatuscodes.html) of the last operation.`var httpStatusCode: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) |
| [isDiscard](is-discard.md) | Set to true if Akismet has determined that the last [checked comment](check-comment.md) is blatant spam, and you can safely discard it without saving it in any spam queue.`var isDiscard: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [isVerifiedKey](is-verified-key.md) | Check if the API Key has been verified`var isVerifiedKey: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [logger](logger.md) | The logger instance.`val logger: `[`Logger`](https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html) |
| [proTip](pro-tip.md) | The `x-akismet-pro-tip` header from the last operation, if any.`var proTip: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [response](response.md) | The actual response sent by Akismet from the last operation.`var response: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
### Functions
| Name | Summary |
|---|---|
| [checkComment](check-comment.md) | Comment Check.`fun checkComment(comment: `[`AkismetComment`](../-akismet-comment/index.md)`, trueOnError: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [executeMethod](execute-method.md) | Execute a call to an Akismet REST API method.`fun executeMethod(apiUrl: HttpUrl?, formBody: FormBody, trueOnError: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [reset](reset.md) | Reset the [debugHelp](debug-help.md), [errorMessage](error-message.md), [httpStatusCode](http-status-code.md), [isDiscard](is-discard.md), [isVerifiedKey](is-verified-key.md), [proTip](pro-tip.md), and [response](response.md) properties.`fun reset(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |
| [submitHam](submit-ham.md) | Submit Ham. (False Positives)`fun submitHam(comment: `[`AkismetComment`](../-akismet-comment/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [submitSpam](submit-spam.md) | Submit Spam. (Missed Spam)`fun submitSpam(comment: `[`AkismetComment`](../-akismet-comment/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [verifyKey](verify-key.md) | Key Verification.`fun verifyKey(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
### Companion Object Functions
| Name | Summary |
|---|---|
| [dateToGmt](date-to-gmt.md) | Convert a date to a UTC timestamp. (ISO 8601)`fun dateToGmt(date: `[`Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Convert a locale date/time to a UTC timestamp. (ISO 8601)`fun dateToGmt(date: `[`LocalDateTime`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [jsonComment](json-comment.md) | (Re)Create a [comment](../-akismet-comment/index.md) from a JSON string.`fun jsonComment(json: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`AkismetComment`](../-akismet-comment/index.md) |

View file

@ -0,0 +1,15 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [isDiscard](./is-discard.md)
# isDiscard
`var isDiscard: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L185)
Set to true if Akismet has determined that the last [checked comment](check-comment.md) is blatant spam, and you
can safely discard it without saving it in any spam queue.
See the [Akismet API](https://akismet.com/development/api/#comment-check) for more details.
**See Also**
[Akismet.proTip](pro-tip.md)

View file

@ -0,0 +1,12 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [isVerifiedKey](./is-verified-key.md)
# isVerifiedKey
`var isVerifiedKey: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L133)
Check if the API Key has been verified
**See Also**
[Akismet.verifyKey](verify-key.md)

View file

@ -0,0 +1,12 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [jsonComment](./json-comment.md)
# jsonComment
`@JvmStatic fun jsonComment(json: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`AkismetComment`](../-akismet-comment/index.md) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L67)
(Re)Create a [comment](../-akismet-comment/index.md) from a JSON string.
**See Also**
[AkismetComment.toString](../-akismet-comment/to-string.md)

View file

@ -0,0 +1,12 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](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/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L205)
The logger instance.
**Getter**
The logger instance.

View file

@ -0,0 +1,17 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [proTip](./pro-tip.md)
# proTip
`var proTip: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L173)
The `x-akismet-pro-tip` header from the last operation, if any.
If the `x-akismet-pro-tip` header is set to discard, then Akismet has determined that the comment is blatant
spam, and you can safely discard it without saving it in any spam queue.
See the [Akismet API](https://akismet.com/development/api/#comment-check) for more details.
**See Also**
[Akismet.isDiscard](is-discard.md)

View file

@ -0,0 +1,9 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [reset](./reset.md)
# reset
`fun reset(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L378)
Reset the [debugHelp](debug-help.md), [errorMessage](error-message.md), [httpStatusCode](http-status-code.md), [isDiscard](is-discard.md), [isVerifiedKey](is-verified-key.md), [proTip](pro-tip.md), and
[response](response.md) properties.

View file

@ -0,0 +1,10 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [response](./response.md)
# response
`var response: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L149)
The actual response sent by Akismet from the last operation.
For example: `true`, `false`, `valid`, `invalid`, etc.

View file

@ -0,0 +1,24 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [submitHam](./submit-ham.md)
# submitHam
`fun submitHam(comment: `[`AkismetComment`](../-akismet-comment/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L317)
Submit Ham. (False Positives)
This call is intended for the submission of false positives - items that were incorrectly classified as spam by
Akismet. It takes identical arguments as [comment check](check-comment.md) and
[submit spam](submit-spam.md).
It is very important that the values you submit with this call match those of your
[comment check](check-comment.md) calls as closely as possible. In order to learn from its mistakes,
Akismet needs to match your missed spam and false positive reports to the original comment-check API calls made
when the content was first posted. While it is normal for less information to be available for submit-spam and
submit-ham calls (most comment systems and forums will not store all metadata), you should ensure that the
values that you do send match those of the original content.
See the [Akismet API](https://akismet.com/development/api/#submit-ham) for more details.
**Return**
`true` if the comment was submitted, `false` otherwise.

View file

@ -0,0 +1,22 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [submitSpam](./submit-spam.md)
# submitSpam
`fun submitSpam(comment: `[`AkismetComment`](../-akismet-comment/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L295)
Submit Spam. (Missed Spam)
This call is for submitting comments that weren't marked as spam but should have been.
It is very important that the values you submit with this call match those of your
[comment check](check-comment.md) calls as closely as possible. In order to learn from its mistakes,
Akismet needs to match your missed spam and false positive reports to the original comment-check API calls made
when the content was first posted. While it is normal for less information to be available for submit-spam and
submit-ham calls (most comment systems and forums will not store all metadata), you should ensure that the
values that you do send match those of the original content.
See the [Akismet API](https://akismet.com/development/api/#submit-spam) for more details.
**Return**
`true` if the comment was submitted, `false` otherwise.

View file

@ -0,0 +1,22 @@
[docs](../../index.md) / [net.thauvin.erik.akismet](../index.md) / [Akismet](index.md) / [verifyKey](./verify-key.md)
# verifyKey
`fun verifyKey(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) [(source)](https://github.com/ethauvin/akismet-kotlin/tree/master/src/main/kotlin/net/thauvin/erik/akismet/Akismet.kt#L249)
Key Verification.
Key verification authenticates your key before calling the [comment check](check-comment.md),
[submit spam](submit-spam.md), or [submit ham](submit-ham.md) methods. This is the first call that you
should make to Akismet and is especially useful if you will have multiple users with their own Akismet
subscriptions using your application.
See the [Akismet API](https://akismet.com/development/api/#verify-key) for more details.
**Return**
`true` if the key is valid, `false` otherwise.
**See Also**
[Akismet.isVerifiedKey](is-verified-key.md)