kin-android

kin-android / org.kin.sdk.base.tools / NetworkOperation

NetworkOperation

data class NetworkOperation<ResponseType>

Parameters

onCompleted -

id -

timeout -

backoffStrategy -

callback -

Types

Name Summary
State sealed class State

Constructors

| Name | Summary | |—|—| | <init> | NetworkOperation(onSuccess: (ResponseType) -> Unit, onError: ((Throwable) -> Unit)? = null, id: String = generateRandomId(), timeout: Long = DEFAULT_TIMEOUT, backoffStrategy: BackoffStrategy = BackoffStrategy.Exponential( maximumWaitTime = timeout ), callback: (PromisedCallback<ResponseType>) -> Unit)
NetworkOperation(onCompleted: PromisedCallback<ResponseType>, id: String = generateRandomId(), timeout: Long = DEFAULT_TIMEOUT, backoffStrategy: BackoffStrategy = BackoffStrategy.Exponential( maximumWaitTime = timeout ), callback: (PromisedCallback<ResponseType>) -> Unit) |

Properties

Name Summary
backoffStrategy <ul><li>the strategy used to retry a task that fails</li></ul>val backoffStrategy: BackoffStrategy
callback <ul><li>the work performed by the operation</li></ul>val callback: (PromisedCallback<ResponseType>) -> Unit
expiryFuture var expiryFuture: ScheduledFuture<*>?
id <ul><li>a unique identifier for the operation</li></ul>val id: String
onCompleted <ul><li>will be called when the operation has completed, successfully or with an error (including if it timed out, or failed fatally)</li></ul>val onCompleted: PromisedCallback<ResponseType>
state var state: State
timeout <ul><li>task will timeout in milliseconds, if not completed within the timeout period, with NetworkOperationsHandlerException.OperationTimeoutException</li></ul>val timeout: Long

Companion Object Functions

Name Summary
generateRandomId fun generateRandomId(): String