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 Callback<BoxResponse>
    )

    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 Callback<BoxResponse>
    )

    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 Callback<BoxResponse>
    ) -> BoxUploadTask

    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 Callback<BoxResponse>
    )

    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 Callback<BoxResponse>
    ) -> BoxUploadTask

    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

    Return Value

    BoxUploadTask

  • Performs an HTTP PUT method call on an API endpoint and returns a response - variant for chunked upload.

    Declaration

    Swift

    func put(
        url: URL,
        httpHeaders: BoxHTTPHeaders,
        queryParameters: QueryParameters,
        data: Data,
        progress: @escaping (Progress) -> Void,
        completion: @escaping Callback<BoxResponse>
    ) -> BoxUploadTask

    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.

    data

    Binary body of the request

    progress

    Closure where upload progress will be reported

    completion

    Returns a BoxResponse object or an error if request fails

    Return Value

    BoxUploadTask

  • 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 Callback<BoxResponse>
    ) -> BoxNetworkTask

    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

    Return Value

    BoxNetworkTask

  • 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 Callback<BoxResponse>
    )

    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