commonMain.com.algolia.client.api.SearchClient.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
"Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search REST API from your JVM project, such as Android or backend implementations."
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
package com.algolia.client.api
import com.algolia.client.configuration.*
import com.algolia.client.exception.*
import com.algolia.client.extensions.internal.*
import com.algolia.client.model.search.*
import com.algolia.client.transport.*
import com.algolia.client.transport.internal.*
import kotlinx.serialization.json.*
public class SearchClient(
override val appId: String,
override var apiKey: String,
override val options: ClientOptions = ClientOptions(),
) : ApiClient {
init {
require(appId.isNotBlank()) { "`appId` is missing." }
require(apiKey.isNotBlank()) { "`apiKey` is missing." }
}
override val requester: Requester = requesterOf(clientName = "Search", appId = appId, apiKey = apiKey, options = options) {
listOf(
Host("$appId-dsn.algolia.net", CallType.Read),
Host("$appId.algolia.net", CallType.Write),
) + mutableListOf(
Host("$appId-1.algolianet.com"),
Host("$appId-2.algolianet.com"),
Host("$appId-3.algolianet.com"),
).apply { shuffle() }
}
/**
* Creates a new API key with specific permissions and restrictions.
*
* Required API Key ACLs:
* - admin
* @param apiKey
* @param requestOptions additional request configuration.
*/
public suspend fun addApiKey(apiKey: ApiKey, requestOptions: RequestOptions? = null): AddApiKeyResponse {
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "keys"),
body = apiKey,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update _some_ attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
*
* Required API Key ACLs:
* - addObject
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique record identifier.
* @param body The record. A schemaless object with attributes that are useful in the context of search and discovery.
* @param requestOptions additional request configuration.
*/
public suspend fun addOrUpdateObject(indexName: String, objectID: String, body: JsonObject, requestOptions: RequestOptions? = null): UpdatedAtWithObjectIdResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `addOrUpdateObject`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `addOrUpdateObject`." }
require(body.isNotEmpty()) { "Parameter `body` is required when calling `addOrUpdateObject`." }
val requestConfig = RequestConfig(
method = RequestMethod.PUT,
path = listOf("1", "indexes", "$indexName", "$objectID"),
body = body,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Adds a source to the list of allowed sources.
*
* Required API Key ACLs:
* - admin
* @param source Source to add.
* @param requestOptions additional request configuration.
*/
public suspend fun appendSource(source: Source, requestOptions: RequestOptions? = null): CreatedAtResponse {
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "security", "sources", "append"),
body = source,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Assigns or moves a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
*
* Required API Key ACLs:
* - admin
* @param xAlgoliaUserID Unique identifier of the user who makes the search request.
* @param assignUserIdParams
* @param requestOptions additional request configuration.
*/
public suspend fun assignUserId(xAlgoliaUserID: String, assignUserIdParams: AssignUserIdParams, requestOptions: RequestOptions? = null): CreatedAtResponse {
require(xAlgoliaUserID.isNotBlank()) { "Parameter `xAlgoliaUserID` is required when calling `assignUserId`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "clusters", "mapping"),
headers = buildMap {
put("X-Algolia-User-ID", xAlgoliaUserID)
},
body = assignUserIdParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they're specified. - Actions are equivalent to the individual API requests of the same name.
* @param indexName Name of the index on which to perform the operation.
* @param batchWriteParams
* @param requestOptions additional request configuration.
*/
public suspend fun batch(indexName: String, batchWriteParams: BatchWriteParams, requestOptions: RequestOptions? = null): BatchResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `batch`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "batch"),
body = batchWriteParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Assigns multiple user IDs to a cluster. **You can't move users with this operation**.
*
* Required API Key ACLs:
* - admin
* @param xAlgoliaUserID Unique identifier of the user who makes the search request.
* @param batchAssignUserIdsParams
* @param requestOptions additional request configuration.
*/
public suspend fun batchAssignUserIds(xAlgoliaUserID: String, batchAssignUserIdsParams: BatchAssignUserIdsParams, requestOptions: RequestOptions? = null): CreatedAtResponse {
require(xAlgoliaUserID.isNotBlank()) { "Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "clusters", "mapping", "batch"),
headers = buildMap {
put("X-Algolia-User-ID", xAlgoliaUserID)
},
body = batchAssignUserIdsParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
*
* Required API Key ACLs:
* - editSettings
* @param dictionaryName Dictionary type in which to search.
* @param batchDictionaryEntriesParams
* @param requestOptions additional request configuration.
*/
public suspend fun batchDictionaryEntries(dictionaryName: DictionaryType, batchDictionaryEntriesParams: BatchDictionaryEntriesParams, requestOptions: RequestOptions? = null): UpdatedAtResponse {
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "dictionaries", "$dictionaryName", "batch"),
body = batchDictionaryEntriesParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves records from an index, up to 1,000 per request. While searching retrieves _hits_ (records augmented with attributes for highlighting and ranking details), browsing _just_ returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn't collect data when using `browse`. - Records are ranked by attributes and custom ranking. - There's no ranking for: typo-tolerance, number of matched words, proximity, geo distance. Browse requests automatically apply these settings: - `advancedSyntax`: `false` - `attributesToHighlight`: `[]` - `attributesToSnippet`: `[]` - `distinct`: `false` - `enablePersonalization`: `false` - `enableRules`: `false` - `facets`: `[]` - `getRankingInfo`: `false` - `ignorePlurals`: `false` - `optionalFilters`: `[]` - `typoTolerance`: `true` or `false` (`min` and `strict` evaluate to `true`) If you send these parameters with your browse requests, they'll be ignored.
*
* Required API Key ACLs:
* - browse
* @param indexName Name of the index on which to perform the operation.
* @param browseParams
* @param requestOptions additional request configuration.
*/
public suspend fun browse(indexName: String, browseParams: BrowseParams? = null, requestOptions: RequestOptions? = null): BrowseResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `browse`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "browse"),
isRead = true,
body = browseParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes only the records from an index while keeping settings, synonyms, and rules.
*
* Required API Key ACLs:
* - deleteIndex
* @param indexName Name of the index on which to perform the operation.
* @param requestOptions additional request configuration.
*/
public suspend fun clearObjects(indexName: String, requestOptions: RequestOptions? = null): UpdatedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `clearObjects`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "clear"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes all rules from the index.
*
* Required API Key ACLs:
* - editSettings
* @param indexName Name of the index on which to perform the operation.
* @param forwardToReplicas Whether changes are applied to replica indices.
* @param requestOptions additional request configuration.
*/
public suspend fun clearRules(indexName: String, forwardToReplicas: Boolean? = null, requestOptions: RequestOptions? = null): UpdatedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `clearRules`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "rules", "clear"),
query = buildMap {
forwardToReplicas?.let { put("forwardToReplicas", it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes all synonyms from the index.
*
* Required API Key ACLs:
* - editSettings
* @param indexName Name of the index on which to perform the operation.
* @param forwardToReplicas Whether changes are applied to replica indices.
* @param requestOptions additional request configuration.
*/
public suspend fun clearSynonyms(indexName: String, forwardToReplicas: Boolean? = null, requestOptions: RequestOptions? = null): UpdatedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `clearSynonyms`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "synonyms", "clear"),
query = buildMap {
forwardToReplicas?.let { put("forwardToReplicas", it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* This method allow you to send requests to the Algolia REST API.
* @param path Path of the endpoint, anything after \"/1\" must be specified.
* @param parameters Query parameters to apply to the current query.
* @param requestOptions additional request configuration.
*/
public suspend fun customDelete(path: String, parameters: Map? = null, requestOptions: RequestOptions? = null): JsonObject {
require(path.isNotBlank()) { "Parameter `path` is required when calling `customDelete`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/{path}".replace("{path}", path),
query = buildMap {
parameters?.let { putAll(it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* This method allow you to send requests to the Algolia REST API.
* @param path Path of the endpoint, anything after \"/1\" must be specified.
* @param parameters Query parameters to apply to the current query.
* @param requestOptions additional request configuration.
*/
public suspend fun customGet(path: String, parameters: Map? = null, requestOptions: RequestOptions? = null): JsonObject {
require(path.isNotBlank()) { "Parameter `path` is required when calling `customGet`." }
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = "/{path}".replace("{path}", path),
query = buildMap {
parameters?.let { putAll(it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* This method allow you to send requests to the Algolia REST API.
* @param path Path of the endpoint, anything after \"/1\" must be specified.
* @param parameters Query parameters to apply to the current query.
* @param body Parameters to send with the custom request.
* @param requestOptions additional request configuration.
*/
public suspend fun customPost(path: String, parameters: Map? = null, body: JsonObject? = null, requestOptions: RequestOptions? = null): JsonObject {
require(path.isNotBlank()) { "Parameter `path` is required when calling `customPost`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = "/{path}".replace("{path}", path),
query = buildMap {
parameters?.let { putAll(it) }
},
body = body,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* This method allow you to send requests to the Algolia REST API.
* @param path Path of the endpoint, anything after \"/1\" must be specified.
* @param parameters Query parameters to apply to the current query.
* @param body Parameters to send with the custom request.
* @param requestOptions additional request configuration.
*/
public suspend fun customPut(path: String, parameters: Map? = null, body: JsonObject? = null, requestOptions: RequestOptions? = null): JsonObject {
require(path.isNotBlank()) { "Parameter `path` is required when calling `customPut`." }
val requestConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/{path}".replace("{path}", path),
query = buildMap {
parameters?.let { putAll(it) }
},
body = body,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes the API key.
*
* Required API Key ACLs:
* - admin
* @param key API key.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteApiKey(key: String, requestOptions: RequestOptions? = null): DeleteApiKeyResponse {
require(key.isNotBlank()) { "Parameter `key` is required when calling `deleteApiKey`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "keys", "$key"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* This operation doesn't accept empty queries or filters. It's more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](#tag/Records/operation/batch).
*
* Required API Key ACLs:
* - deleteIndex
* @param indexName Name of the index on which to perform the operation.
* @param deleteByParams
* @param requestOptions additional request configuration.
*/
public suspend fun deleteBy(indexName: String, deleteByParams: DeleteByParams, requestOptions: RequestOptions? = null): DeletedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `deleteBy`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "$indexName", "deleteByQuery"),
body = deleteByParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes an index and all its settings. - Deleting an index doesn't delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see [Delete replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/).
*
* Required API Key ACLs:
* - deleteIndex
* @param indexName Name of the index on which to perform the operation.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteIndex(indexName: String, requestOptions: RequestOptions? = null): DeletedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `deleteIndex`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "indexes", "$indexName"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes a record by its object ID. To delete more than one record, use the [`batch` operation](#tag/Records/operation/batch). To delete records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy).
*
* Required API Key ACLs:
* - deleteObject
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique record identifier.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteObject(indexName: String, objectID: String, requestOptions: RequestOptions? = null): DeletedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `deleteObject`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `deleteObject`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "indexes", "$indexName", "$objectID"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes a rule by its ID. To find the object ID for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
*
* Required API Key ACLs:
* - editSettings
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique identifier of a rule object.
* @param forwardToReplicas Whether changes are applied to replica indices.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteRule(indexName: String, objectID: String, forwardToReplicas: Boolean? = null, requestOptions: RequestOptions? = null): UpdatedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `deleteRule`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `deleteRule`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "indexes", "$indexName", "rules", "$objectID"),
query = buildMap {
forwardToReplicas?.let { put("forwardToReplicas", it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes a source from the list of allowed sources.
*
* Required API Key ACLs:
* - admin
* @param source IP address range of the source.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteSource(source: String, requestOptions: RequestOptions? = null): DeleteSourceResponse {
require(source.isNotBlank()) { "Parameter `source` is required when calling `deleteSource`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "security", "sources", "$source"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
*
* Required API Key ACLs:
* - editSettings
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique identifier of a synonym object.
* @param forwardToReplicas Whether changes are applied to replica indices.
* @param requestOptions additional request configuration.
*/
public suspend fun deleteSynonym(indexName: String, objectID: String, forwardToReplicas: Boolean? = null, requestOptions: RequestOptions? = null): DeletedAtResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `deleteSynonym`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `deleteSynonym`." }
val requestConfig = RequestConfig(
method = RequestMethod.DELETE,
path = listOf("1", "indexes", "$indexName", "synonyms", "$objectID"),
query = buildMap {
forwardToReplicas?.let { put("forwardToReplicas", it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Gets the permissions and restrictions of an API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key, with the description replaced by ``.
* @param key API key.
* @param requestOptions additional request configuration.
*/
public suspend fun getApiKey(key: String, requestOptions: RequestOptions? = null): GetApiKeyResponse {
require(key.isNotBlank()) { "Parameter `key` is required when calling `getApiKey`." }
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "keys", "$key"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Checks the status of a given application task.
*
* Required API Key ACLs:
* - editSettings
* @param taskID Unique task identifier.
* @param requestOptions additional request configuration.
*/
public suspend fun getAppTask(taskID: Long, requestOptions: RequestOptions? = null): GetTaskResponse {
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "task", "$taskID"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Lists supported languages with their supported dictionary types and number of custom entries.
*
* Required API Key ACLs:
* - settings
* @param requestOptions additional request configuration.
*/
public suspend fun getDictionaryLanguages(requestOptions: RequestOptions? = null): Map {
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "dictionaries", "*", "languages"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves the languages for which standard dictionary entries are turned off.
*
* Required API Key ACLs:
* - settings
* @param requestOptions additional request configuration.
*/
public suspend fun getDictionarySettings(requestOptions: RequestOptions? = null): GetDictionarySettingsResponse {
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "dictionaries", "*", "settings"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). - Logs are held for the last seven days. - Up to 1,000 API requests per server are logged. - This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself.
*
* Required API Key ACLs:
* - logs
* @param offset First log entry to retrieve. The most recent entries are listed first. (default to 0)
* @param length Maximum number of entries to retrieve. (default to 10)
* @param indexName Index for which to retrieve log entries. By default, log entries are retrieved for all indices.
* @param type Type of log entries to retrieve. By default, all log entries are retrieved. (default to all)
* @param requestOptions additional request configuration.
*/
public suspend fun getLogs(offset: Int? = null, length: Int? = null, indexName: String? = null, type: LogType? = null, requestOptions: RequestOptions? = null): GetLogsResponse {
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "logs"),
query = buildMap {
offset?.let { put("offset", it) }
length?.let { put("length", it) }
indexName?.let { put("indexName", it) }
type?.let { put("type", it) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
*
* Required API Key ACLs:
* - search
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique record identifier.
* @param attributesToRetrieve Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is authenticated with the admin API key.
* @param requestOptions additional request configuration.
*/
public suspend fun getObject(indexName: String, objectID: String, attributesToRetrieve: List? = null, requestOptions: RequestOptions? = null): JsonObject {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `getObject`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `getObject`." }
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "indexes", "$indexName", "$objectID"),
query = buildMap {
attributesToRetrieve?.let { put("attributesToRetrieve", it.joinToString(",")) }
},
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
*
* Required API Key ACLs:
* - search
* @param getObjectsParams Request object.
* @param requestOptions additional request configuration.
*/
public suspend fun getObjects(getObjectsParams: GetObjectsParams, requestOptions: RequestOptions? = null): GetObjectsResponse {
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("1", "indexes", "*", "objects"),
isRead = true,
body = getObjectsParams,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves a rule by its ID. To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
*
* Required API Key ACLs:
* - settings
* @param indexName Name of the index on which to perform the operation.
* @param objectID Unique identifier of a rule object.
* @param requestOptions additional request configuration.
*/
public suspend fun getRule(indexName: String, objectID: String, requestOptions: RequestOptions? = null): Rule {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `getRule`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `getRule`." }
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "indexes", "$indexName", "rules", "$objectID"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves an object with non-null index settings.
*
* Required API Key ACLs:
* - search
* @param indexName Name of the index on which to perform the operation.
* @param requestOptions additional request configuration.
*/
public suspend fun getSettings(indexName: String, requestOptions: RequestOptions? = null): SettingsResponse {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `getSettings`." }
val requestConfig = RequestConfig(
method = RequestMethod.GET,
path = listOf("1", "indexes", "$indexName", "settings"),
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}
/**
* Retrieves all allowed IP addresses with access to your application.
*
* Required API Key ACLs:
* - admin
* @param requestOptions additional request configuration.
*/
public suspend fun getSources(requestOptions: RequestOptions? = null): List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy