BoxClientProtocol

public protocol BoxClientProtocol : AnyObject

Defines methods for communication with Box APIs

  • Performs an HTTP GET method call on an API endpoint and returns a response.

    Declaration

    Swift

    func get(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP POST method call on an API endpoint and returns a response.

    Declaration

    Swift

    func post(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    json

    The JSON body of the request

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP POST method call on an API endpoint and returns a response.

    Declaration

    Swift

    func post(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, multipartBody: MultipartForm, progress: @escaping (Progress) -> Void, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    multipartBody

    The multipart form body of the request

    progress

    Closure where upload progress will be reported

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP PUT method call on an API endpoint and returns a response.

    Declaration

    Swift

    func put(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    json

    The JSON body of the request

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP PUT method call on an API endpoint and returns a response.

    Declaration

    Swift

    func put(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, multipartBody: MultipartForm, progress: @escaping (Progress) -> Void, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    multipartBody

    The multipart form body of the request

    progress

    Closure where upload progress will be reported

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP OPTIONS method call on an API endpoint and returns a response.

    Declaration

    Swift

    func options(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    json

    The JSON body of the request

    completion

    Returns a BoxResponse object or an error if request fails

  • Performs an HTTP DELETE method call on an API endpoint and returns a response.

    Declaration

    Swift

    func delete(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, completion: @escaping (Result<BoxResponse, BoxError>) -> Void)

    Parameters

    url

    The URL of the API endpoint to call.

    httpHeaders

    Additional information to be passed in the HTTP headers of the request.

    queryParameters

    Additional parameters to be passed in the URL that is called.

    completion

    Returns a BoxResponse object or an error if request fails