RestingPathVariableProvider

public class RestingPathVariableProvider : PathVariableProvider

A default implementation of HeaderProvider supporting dynamic variable provisioning.

  • The varaibles to provide to a request on a given time. Generated from providers, discarting nil values.

    Declaration

    Swift

    public var variables: [String : Any] { get }
  • Creates a new RestingPathVariableProvider with the given variable callbacks.

    Declaration

    Swift

    public init(providers: [String : () -> (Any?)] = [:])

    Parameters

    providers

    The callbacks to generate variable values for requests. Keys indicate the name and the return of the callback the value of the variable to add. nil values are discarted.

  • Adds a static variable value for the given key.

    Adding a variable to an existing overrides the previous one.

    Declaration

    Swift

    public func addVariable(key: String, value: Any)

    Parameters

    key

    The name of the variable.

    value

    The value of the variable.

  • Adds a dynamic variable value for the given key.

    Adding a variable to an existing overrides the previous one.

    Declaration

    Swift

    public func addVariable(key: String, provider: @escaping () -> Any?)

    Parameters

    key

    The name of the variable.

    provider

    The provider to call for the varible value. nil values are discarted.

  • Removes a variable added for the given key.

    Declaration

    Swift

    public func removeVariable(for key: String)

    Parameters

    key

    The name of the variable to remove.