Storage Documentation

Structure Endpoint​Builder

@resultBuilder
public struct EndpointBuilder  

A struct defining a result builder capable of generating a single endpoint from a collection of components.

This resultBuilder enforces the following rules:

  • you MUST have at least 1 Path

  • successive Components of the same type, Paths and Responses will inherit their previous values, if supported, otherwise they will override it

  • no explicit Response means Single will output DefaultResponse

  • Endpoints only return themselves

Methods

build​Expression(_:​)

public static func buildExpression<C: Component>(_ expression: C) -> Components  

Turn a single component into a collection.

Parameters

expression C

Some Component.

Returns

Some Components.

build​Expression(_:​)

public static func buildExpression(_ expression: Path) -> Path  

Turn a valid path into itself.

Parameters

expression Path

A valid Path.

Returns

A valid Path.

build​Expression(_:​)

public static func buildExpression<I, O>(_ expression: Response<I, O>) -> Response<I, O>  

Turn a valid response into itself.

Parameters

expression Response<I, O>

A valid Response.

Returns

A valid Response.

build​Expression(_:​)

public static func buildExpression<E: Endpoint>(_ expression: E) -> E  

Turn a valid endpoint into itself.

Parameters

expression E

Some Endpoint.

Returns

Some Endpoint.

build​Either(first:​)

public static func buildEither(first component: Path) -> Path  

Turn a single path into itself.

Parameters

component Path

A valid Path.

Returns

A valid Path.

build​Either(second:​)

public static func buildEither(second component: Path) -> Path  

Turn a single path into itself.

Parameters

component Path

A valid Path.

Returns

A valid Path.

build​Optional(_:​)

public static func buildOptional(_ component: Components?) -> Components  

Turn a single component into a collection.

Parameters

component Components?

A valid Path.

Returns

A valid Path.

build​Either(first:​)

public static func buildEither(first component: Components) -> Components  

Turn a collction of components into itself.

Parameters

component Components

Some Components.

Returns

Some Components.

build​Either(second:​)

public static func buildEither(second component: Components) -> Components  

Turn a collction of components into itself.

Parameters

component Components

Some Components.

Returns

Some Components.

build​Limited​Availability(_:​)

public static func buildLimitedAvailability<T>(_ component: T) -> T  

Turn an item into itself.

Parameters

component T

Some item.

Returns

Some item.

build​Partial​Block(first:​)

public static func buildPartialBlock(first content: Components) -> Components  

Build an endpoint request, starting from some components.

Parameters

content Components

Some Components.

Returns

Some Components.

build​Partial​Block(first:​)

public static func buildPartialBlock(first content: Path) -> TupleEndpoint<DefaultResponse>  

Build an endpoint request, starting from a path.

Parameters

response

A valid Path.

Returns

A valid TupleItem.

build​Partial​Block(first:​)

public static func buildPartialBlock<O>(first content: Response<DefaultResponse, O>) -> Response<DefaultResponse, O>  

Build an endpoint request, starting from the response.

  • paramter content: A valid Response.

Returns

Some Response.

build​Partial​Block(first:​)

public static func buildPartialBlock<E: Endpoint>(first content: E) -> E  

Build an endpoint request, starting from some endpoint.

Parameters

content E

Some Endpoint.

Returns

Some Endpoint.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock(accumulated: Components, next: Components) -> Components  

Accumulate an endpoint request, adding to some components.

Parameters

accumulated Components

Some Components.

next Components

Some Components.

Returns

Some Components.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock(accumulated: Components, next: Path) -> TupleEndpoint<DefaultResponse>  

Accumulate an endpoint request, adding to some components.

Parameters

accumulated Components

Some Components.

next Path

A valid Path.

Returns

A valid TupleItem.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: Components, next: Response<DefaultResponse, O>) -> TupleItem<Components, Response<DefaultResponse, O>>  

Accumulate an endpoint request, adding to some components.

Parameters

accumulated Components

Some Components.

next Response<Default​Response, O>

A valid Response.

Returns

A valid TupleItem.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<I, O>(accumulated: Response<DefaultResponse, I>, next: Response<I, O>) -> Response<DefaultResponse, O>  

Accumulate a response, adding to some response.

Parameters

accumulated Response<Default​Response, I>

A valid Response.

next Response<I, O>

A valid Response.

Returns

A valid Response.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: Response<DefaultResponse, O>, next: Components) -> TupleItem<Components, Response<DefaultResponse, O>>  

Accumulate an endpoint request, adding to some response.

Parameters

accumulated Response<Default​Response, O>

A valid Response.

next Components

Some Components.

Returns

A valid TupleItem.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: Response<DefaultResponse, O>, next: Path) -> TupleEndpoint<O>  

Accumulate an endpoint request, adding to some response.

Parameters

accumulated Response<Default​Response, O>

A valid Response.

next Path

A valid Path.

Returns

Some Single.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: TupleItem<Components, Response<DefaultResponse, O>>, next: Components) -> TupleItem<Components, Response<DefaultResponse, O>>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Item<Components, Response<Default​Response, O>>

A valid TupleItem.

next Components

Some Components.

Returns

A valid TupleItem.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<I, O>(accumulated: TupleItem<Components, Response<DefaultResponse, I>>, next: Response<I, O>) -> TupleItem<Components, Response<DefaultResponse, O>>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Item<Components, Response<Default​Response, I>>

A valid TupleItem.

next Response<I, O>

A valid Response.

Returns

A valid TupleItem.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: TupleItem<Components, Response<DefaultResponse, O>>, next: Path) -> TupleEndpoint<O>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Item<Components, Response<Default​Response, O>>

A valid TupleItem.

next Path

A valid Path.

Returns

Some Single.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: TupleEndpoint<O>, next: Components) -> TupleEndpoint<O>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Endpoint<O>

A valid TupleItem.

next Components

Some Components.

Returns

A valid TupleEndpoint.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<I, O>(accumulated: TupleEndpoint<I>, next: Response<I, O>) -> TupleEndpoint<O>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Endpoint<I>

A valid TupleEndpoint.

next Response<I, O>

A valid Response.

Returns

A valid TupleEndpoint.

build​Partial​Block(accumulated:​next:​)

public static func buildPartialBlock<O>(accumulated: TupleEndpoint<O>, next: Path) -> TupleEndpoint<O>  

Accumulate an endpoint request, adding to a tuple item.

Parameters

accumulated Tuple​Endpoint<O>

A valid TupleEndpoint.

next Path

A valid Path.

Returns

A valid TupleEndpoint.

build​Final​Result(_:​)

public static func buildFinalResult<O>(_ component: TupleEndpoint<O>) -> Single<O>  

Resolve a valid tuple endpoint.

Parameters

content

A valid TupleEndpoint.

Returns

A valid Single.

build​Final​Result(_:​)

public static func buildFinalResult<E: Endpoint>(_ component: E) -> E  

Resolve some endpoint.

Parameters

content

Some Endpoint.

Returns

Some Endpoint.