MutationQueue
constructor(apiClient: ApiClient, scope: CoroutineScope, store: MutationStore = InMemoryMutationStore(), defaultRetryPolicy: RetryPolicy = DefaultRetryPolicy(retryNonIdempotent = true), codecs: List<MutationCodec<*>> = emptyList())
Parameters
apiClient
executes the underlying HTTP calls.
scope
owns every mutation's execution + retry backoff; mutations outlive the caller's own scope (e.g. a ViewModel's) as long as this scope is alive.
store
where enqueued mutations (that were given a MutationCodec) are persisted.
defaultRetryPolicy
applied to mutations enqueued without an explicit retryPolicy. Defaults to retrying non-idempotent methods too — the whole point of this queue is to make POST/PATCH mutations retryable — unlike DefaultRetryPolicy's own conservative default.
codecs
MutationCodecs to register upfront, so restore can decode their records even before any matching enqueue call runs in this process. Enqueueing with a new codec also registers it.