mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-12-23 13:17:11 +00:00
optional token
This commit is contained in:
parent
8c49e60dec
commit
3ecfb4298b
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
* Uploading of file
|
* Uploading of file
|
||||||
* Updates of versions
|
* Updates of versions
|
||||||
|
* Now `SauceNaoAPI` do not require api key
|
||||||
|
|
||||||
### 0.4.3
|
### 0.4.3
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ private const val MINIMAL_SIMILARITY_FIELD = "minsim"
|
|||||||
private const val SEARCH_URL = "https://saucenao.com/search.php"
|
private const val SEARCH_URL = "https://saucenao.com/search.php"
|
||||||
|
|
||||||
data class SauceNaoAPI(
|
data class SauceNaoAPI(
|
||||||
private val apiToken: String,
|
private val apiToken: String? = null,
|
||||||
private val outputType: OutputType = JsonOutputType,
|
private val outputType: OutputType = JsonOutputType,
|
||||||
private val client: HttpClient = HttpClient(OkHttp),
|
private val client: HttpClient = HttpClient(OkHttp),
|
||||||
private val searchUrl: String = SEARCH_URL,
|
private val searchUrl: String = SEARCH_URL,
|
||||||
@ -158,7 +158,7 @@ data class SauceNaoAPI(
|
|||||||
it to HttpRequestBuilder().apply {
|
it to HttpRequestBuilder().apply {
|
||||||
url(searchUrl)
|
url(searchUrl)
|
||||||
|
|
||||||
parameter(API_TOKEN_FIELD, apiToken)
|
apiToken ?.also { parameter(API_TOKEN_FIELD, it) }
|
||||||
parameter(OUTPUT_TYPE_FIELD, outputType.typeCode)
|
parameter(OUTPUT_TYPE_FIELD, outputType.typeCode)
|
||||||
db ?.also { parameter(DB_FIELD, it) }
|
db ?.also { parameter(DB_FIELD, it) }
|
||||||
dbmask ?.also { parameter(DBMASK_FIELD, it) }
|
dbmask ?.also { parameter(DBMASK_FIELD, it) }
|
||||||
|
Loading…
Reference in New Issue
Block a user