AppSearchBatchResult.Builder


class AppSearchBatchResult.Builder

Builder for AppSearchBatchResult objects.

Parameters

The type of the keys for which the results will be reported.

The type of the result objects for successful results.

Summary

Public constructors

Creates a new Builder.

Creates a new Builder from the given AppSearchBatchResult.

Public functions

AppSearchBatchResult

Builds an AppSearchBatchResult object from the contents of this Builder.

AppSearchBatchResult.Builder
setFailure(key: KeyType, resultCode: Int, errorMessage: String?)

Associates the key with the provided failure code and error message.

AppSearchBatchResult.Builder
setResult(key: KeyType, result: AppSearchResult)

Associates the key with the provided result.

AppSearchBatchResult.Builder
setSuccess(key: KeyType, value: ValueType?)

Associates the key with the provided successful return value.

Public constructors

Builder

Added in 1.1.0-rc01
Builder()

Creates a new Builder.

Builder

Added in 1.1.0-rc01
@ExperimentalAppSearchApi
Builder(appSearchBatchResult: AppSearchBatchResult)

Creates a new Builder from the given AppSearchBatchResult.

Public functions

build

Added in 1.1.0-rc01
fun build(): AppSearchBatchResult

Builds an AppSearchBatchResult object from the contents of this Builder.

setFailure

Added in 1.1.0-rc01
fun setFailure(key: KeyType, resultCode: Int, errorMessage: String?): AppSearchBatchResult.Builder

Associates the key with the provided failure code and error message.

Any previous mapping for a key, whether success or failure, is deleted.

This is a convenience function which is equivalent to setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage)).

Parameters
key: KeyType

The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.

resultCode: Int

One of the constants documented in getResultCode.

errorMessage: String?

An optional string describing the reason or nature of the failure.

setResult

Added in 1.1.0-rc01
fun setResult(key: KeyType, result: AppSearchResult): AppSearchBatchResult.Builder

Associates the key with the provided result.

Any previous mapping for a key, whether success or failure, is deleted.

Parameters
key: KeyType

The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.

result: AppSearchResult

The result to associate with the key.

setSuccess

Added in 1.1.0-rc01
fun setSuccess(key: KeyType, value: ValueType?): AppSearchBatchResult.Builder

Associates the key with the provided successful return value.

Any previous mapping for a key, whether success or failure, is deleted.

This is a convenience function which is equivalent to setResult(key, AppSearchResult.newSuccessfulResult(value)).

Parameters
key: KeyType

The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.

value: ValueType?

An optional value to associate with the successful result of the operation being performed.