BoxClient
public class BoxClient
extension BoxClient: BoxClientProtocol
Provides communication with Box APIs. Defines methods for communication with Box APIs
-
Provides File management.
Declaration
Swift
public private(set) lazy var files: FilesModule { get set }
-
Provides Folder management.
Declaration
Swift
public private(set) lazy var folders: FoldersModule { get set }
-
Provides User management.
Declaration
Swift
public private(set) lazy var users: UsersModule { get set }
-
Provides Group management.
Declaration
Swift
public private(set) lazy var groups: GroupsModule { get set }
-
Provides Comment management.
Declaration
Swift
public private(set) lazy var comments: CommentsModule { get set }
-
Provides SharedItem management.
Declaration
Swift
public private(set) lazy var sharedItems: SharedItemsModule { get set }
-
Web Links management.
Declaration
Swift
public private(set) lazy var webLinks: WebLinksModule { get set }
-
Provides search functionality.
Declaration
Swift
public private(set) lazy var search: SearchModule { get set }
-
Provides collections functionality.
Declaration
Swift
public private(set) lazy var collections: CollectionsModule { get set }
-
Provides collaborations functionality.
Declaration
Swift
public private(set) lazy var collaborations: CollaborationsModule { get set }
-
Provides collaborations whitelist functionality
Declaration
Swift
public private(set) lazy var collaborationAllowList: CollaborationAllowlistModule { get set }
-
Metadata management.
Declaration
Swift
public private(set) lazy var metadata: MetadataModule { get set }
-
Provides Events management.
Declaration
Swift
public private(set) lazy var events: EventsModule { get set }
-
Metadata cascade policy.
Declaration
Swift
public private(set) lazy var metadataCascadePolicy: MetadataCascadePolicyModule { get set }
-
Trash management.
Declaration
Swift
public private(set) lazy var trash: TrashModule { get set }
-
Device Pin management.
Declaration
Swift
public private(set) lazy var devicePins: DevicePinsModule { get set }
-
Recent Items management
Declaration
Swift
public private(set) lazy var recentItems: RecentItemsModule { get set }
-
Webhooks management
Declaration
Swift
public private(set) lazy var webhooks: WebhooksModule { get set }
-
Tasks management.
Declaration
Swift
public private(set) lazy var tasks: TasksModule { get set }
-
Retention policy management.
Declaration
Swift
public private(set) lazy var retentionPolicy: RetentionPoliciesModule { get set }
-
Provides TermsOfService
Declaration
Swift
public private(set) lazy var termsOfService: TermsOfServicesModule { get set }
-
Legal Hold Policies management
Declaration
Swift
public private(set) lazy var legalHolds: LegalHoldsModule { get set }
-
Storage Policies management
Declaration
Swift
public private(set) lazy var storagePolicies: StoragePoliciesModule { get set }
-
Provides sign requests functionality.
Declaration
Swift
public private(set) lazy var signRequests: SignRequestsModule { get set }
-
Provides file requests functionality.
Declaration
Swift
public private(set) lazy var fileRequests: FileRequestsModule { get set }
-
Provides authentication session management.
Declaration
Swift
public private(set) var session: SessionProtocol { get }
-
Requests header.
Declaration
Swift
public private(set) var headers: BoxHTTPHeaders? { get }
-
SDK request configuration.
Declaration
Swift
public private(set) var configuration: BoxSDKConfiguration { get }
-
Indicates whether this BoxClient instance has been destroyed
Declaration
Swift
public private(set) var isDestroyed: Bool { get }
-
ID of user’s favorites collection.
Declaration
Swift
public internal(set) var favoritesCollectionId: String? { get }
-
Initializer
Declaration
Swift
public init(networkAgent: NetworkAgentProtocol, session: SessionProtocol, configuration: BoxSDKConfiguration)
Parameters
networkAgent
Provides network communication with the Box APIs.
session
Provides authentication session management.
configuration
Provides parameters to makes API calls in order to tailor it to their application’s specific needs
-
Creates BoxClient instance based on shared link URL and password.
Declaration
Swift
public func withSharedLink(url: URL, password: String?) -> BoxClient
Parameters
url
Shared link URL.
password
Shared link password.
Return Value
Returns new standard BoxClient object.
-
Creates BoxClient instance based on user identifier.
Declaration
Swift
public func asUser(withId userId: String) -> BoxClient
Parameters
userId
User identifier.
Return Value
Returns new standard BoxCliennt object.
-
Destroys the client, revoking its access tokens and rendering it inoperable.
Declaration
Swift
public func destroy(completion: @escaping Callback<Void>)
Parameters
completion
Called when the operation is complete.
-
Exchange the token.
Declaration
Swift
public func exchangeToken( scope: Set<TokenScope>, resource: String? = nil, sharedLink: String? = nil, completion: @escaping TokenInfoClosure )
Parameters
scope
Scope or scopes that you want to apply to the resulting token.
resource
Full url path to the file that the token should be generated for, eg: https://api.box.com/2.0/files/{file_id}
sharedLink
Shared link to get a token for.
completion
Returns the success or an error.
-
Makes a Box SDK request
Declaration
Swift
public func send( request: BoxRequest, completion: @escaping Callback<BoxResponse> )
Parameters
request
Box SDK request
completion
Returns standard BoxResponse object or error.
-
Performs an HTTP GET method call on an API endpoint and returns a response.
Declaration
Swift
public 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
public func post( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], json: Any? = nil, 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
@discardableResult public func post( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], multipartBody: MultipartForm, progress: @escaping (Progress) -> Void = { _ in }, 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 body of the request
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.
Declaration
Swift
public func put( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], json: Any? = nil, 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
@discardableResult public func put( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], multipartBody: MultipartForm, progress: @escaping (Progress) -> Void = { _ in }, 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 body of the request
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
@discardableResult public func put( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], data: Data, progress: @escaping (Progress) -> Void = { _ in }, 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
@discardableResult public func options( url: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], json: Any? = nil, 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
public 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
-
Performs an HTTP GET method call for downloading on an API endpoint and returns a response.
Declaration
Swift
@discardableResult public func download( url: URL, downloadDestinationURL: URL, httpHeaders: BoxHTTPHeaders = [:], queryParameters: QueryParameters = [:], progress: @escaping (Progress) -> Void = { _ in }, completion: @escaping Callback<BoxResponse> ) -> BoxDownloadTask
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.
downloadDestinationURL
The URL on disk where the data will be saved
progress
Completion block to track the progress of the request
completion
Returns a BoxResponse object or an error if request fails
Return Value
BoxDownloadTask