Structure
Loop
public struct Loop<Next: Sendable, Content: SingleEndpoint>
A struct
defining a custom endpoint
implementation handling a paginated request.
Relationships
Conforms To
LoopEndpoint
Nested Type Aliases
Initializers
init(startingAt:content:next:)
public init(
startingAt first: Next,
@EndpointBuilder content: @escaping (_ offset: Int, _ input: Next) -> Content,
next: @escaping (_ offset: Int, _ output: Output) throws -> NextAction<Next>
)
Init.
Parameters
Name | Type | Description |
---|---|---|
first | Next |
The starter |
request | The actual endpoint request. |
|
next | @escaping (_ offset: Int, _ output: Output) throws -> NextAction<Next> |
The next page mapper. |
init(startingAt:content:next:)
public init(
startingAt first: Next,
@EndpointBuilder content: @escaping (Next) -> Content,
next: @escaping (Output) throws -> NextAction<Next>
)
Init.
Parameters
Name | Type | Description |
---|---|---|
first | Next |
The starter |
request | The actual endpoint request. |
|
next | @escaping (Output) throws -> NextAction<Next> |
The next page mapper. |
Methods
resolve(with:)
public func resolve<R: EndpointResolver>(with session: R) -> AsyncThrowingStream<Output, any Error>
Fetch responses, from a given
Input
and URLSession
.
Parameters
Name | Type | Description |
---|---|---|
session | R |
The |
Returns
Some AsyncStream
.
resolve(with:)
public func resolve<R: EndpointResolver>(with session: R) -> AnyPublisher<Output, any Error>
Fetch responses, from a given
Input
and URLSession
.
Parameters
Name | Type | Description |
---|---|---|
session | R |
The |
Returns
Some AsyncStream
.