RequestBuilder

public class RequestBuilder

RequestBuilder is an IPFS command request builder

  • Adds an argument to the request

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func with(argument: String) -> RequestBuilder

    Parameters

    argument

    The argument to add

    Return Value

    This instance of RequestBuilder

  • Adds an option to the request

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func with(option: String, value: RequestOption) -> RequestBuilder

    Parameters

    option

    The name of the option to add

    value

    The value of the option to add

    Return Value

    This instance of RequestBuilder

  • Adds a body to the request

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func with(body: RequestBody) -> RequestBuilder

    Parameters

    body

    The value of body to add

    Return Value

    This instance of RequestBuilder

  • Adds a header to the request

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func with(header: String, value: String) -> RequestBuilder

    Parameters

    header

    The key of the header to add

    value

    The value of the header to add

    Return Value

    This instance of RequestBuilder

  • Sends the request to the underlying go-ipfs node and returns an InputStream

    Throws

    RequestBuilderError: If sending the request failed

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func send() throws -> InputStream

    Return Value

    An InputStream from which to read the response

  • Sends the request to the underlying go-ipfs node and returns a byte array

    Throws

    RequestBuilderError: If sending the request failed

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func sendToBytes() throws -> Data?

    Return Value

    A Data object containing the response

  • Sends the request to the underlying go-ipfs node and returns a dict

    Throws

    RequestBuilderError: If sending the request or converting the response failed

    Seealso

    IPFS API Doc

    Declaration

    Swift

    public func sendToDict() throws -> [String : Any]?

    Return Value

    A dict containing the response