View Source ExPersona.Client.Streamable (ex_persona v1.0.2)
Handle streamable (i.e., paginated) responses from the API.
Link to this section Summary
Functions
Produce a Stream
for a given ExPersona.Client.Operation
.
Link to this section Types
@type t() :: %ExPersona.Client.Streamable{ closed: boolean(), cursor: String.t(), operation: ExPersona.Client.Operation.t() }
Link to this section Functions
@spec stream!(ExPersona.Client.Operation.t()) :: Enumerable.t()
Produce a Stream
for a given ExPersona.Client.Operation
.
For instance:
# get 400 accounts
ExPersona.Account.list()
|> ExPersona.stream!()
|> Stream.take(400)
|> Enum.to_list()
|> IO.inspect()