Endpoint

public struct Endpoint<ResponseType>

Undocumented

  • Initialises an endpoint with the given path component.

    NOTE: If you pass in several path components like endpont/additionalPathComponent it will be splitted by / as the url is constructed within the URLFactory which uses a URLComponent that adds all path components by using URL.appendPathComponent.

    Declaration

    Swift

    public init(pathComponent: String)

    Parameters

    pathComponent

    The path component to add to the base url.

  • Initialises an endpoint with the given path components.

    Declaration

    Swift

    public init(pathComponents: [String])

    Parameters

    pathComponents

    The path components to add to the base url.

  • # Summary Adding a dictionary of query parameters to the endpoint.

    Declaration

    Swift

    public func addQueryParameters(_ parameters: [String : String?]) -> Endpoint<ResponseType>

    Parameters

    parameters

    A dictionary containting the query parameters in form [Key: Value]. If the key already exists it will be overriden

    Return Value

    A new endpoint instance with the merged parameters.

  • # Summary Adding a query parameter to the endpoint.

    Declaration

    Swift

    public func addQueryParameter(key: String, value: String?) -> Endpoint<ResponseType>

    Parameters

    key

    The key of the query parameter to add. If the key is already present, its value will be overriden by the new one.

    value

    The value of the query parameter.

    Return Value

    A new endpoint instance with the added parameter.

  • # Summary Adding a dictionary of path components to the endpoint.

    Declaration

    Swift

    public func addPathComponents(_ pathComponents: [String]) -> Endpoint<ResponseType>

    Parameters

    pathComponents

    A dictionary containting the path components in form [Value].

    Return Value

    A new endpoint instance with the appended path components.

  • # Summary Adding a path component to the endpoint.

    Declaration

    Swift

    public func addPathComponent(_ pathComponent: String) -> Endpoint<ResponseType>

    Parameters

    pathComponent

    The path component to add.

    Return Value

    A new endpoint instance with the added path component.

  • Changes the standard encoder this endpoint. The Client will use this encoder instead ot the encoder in the Configuration

    Declaration

    Swift

    public func withCustomEncoder(_ encoder: Encoder) -> Endpoint

    Parameters

    encoder

    The encoder to use by the client for this endpoint.

    Return Value

    A new endpoint instance with the changed encoder.

  • Changes the standard decoder for this endpoint. The Client will use this decoder instead ot the decoder in the Configuration

    Declaration

    Swift

    public func withCustomDecoder(_ decoder: Decoder) -> Endpoint

    Parameters

    decoder

    The decoder to use by the client for this endpoint.

    Return Value

    A new endpoint instance with the changed decoder.