Represents a chain of operations executed sequentially against the DSpace API.
This module is usually not used directly. Operation data structures are constructed by API
operation modules. Building your own operations is useful in cases where dspace_ex doesn't
support a specific API functionality yet.
A chain is useful when one API interaction depends on another, e.g. when the result of a first request parameterizes a second one, or when a request needs a value to be fetched before it can be made. Each step is a link function that receives the result of the previous step and a context struct, and decides which operation to perform next. Execution short-circuits at the first error.
Summary
Functions
Creates a new chain operation from a list of link functions.
Types
@type link() :: (prev_result :: term(), ctx :: DSpace.API.Operation.Chain.Context.t() -> {operation :: DSpace.API.Operation.t(), ctx :: DSpace.API.Operation.Chain.Context.t()} | {:skip, ctx :: DSpace.API.Operation.Chain.Context.t()})
A link function for a chain step.
prev_result- result of the previous step. The first step receivesnil.ctx- threaded context carrying the client and the request options. A link may return an updated context.
Returning {operation, ctx} runs operation and passes its result to the next step. Returning
{:skip, ctx} runs nothing for this step and passes prev_result through unchanged.
@type t() :: %DSpace.API.Operation.Chain{steps: [link()]}