BoxSDK
public class BoxSDK
Provides methods for creating BoxSDKClient
-
SDK configuration
Declaration
Swift
public private(set) var configuration: BoxSDKConfiguration
-
Default configuration
Declaration
Swift
public static let defaultConfiguration: BoxSDKConfiguration
-
Auth module providing authorization and token related requests. Is set upon BoxSDK initialisation
Declaration
Swift
public private(set) var auth: AuthModule
-
Initializer
Declaration
Swift
public init(clientId: String, clientSecret: String)
Parameters
clientId
The client ID of the application requesting authentication. To get the client ID for your application, log in to your Box developer console click the Edit Application link for the application you’re working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled
client_id
. The text of that item is your application’s client ID.clientSecret
The client secret of the application requesting authentication. To get the client secret for your application, log in to your Box developer console and click the Edit Application link for the application you’re working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled
client_secret
. The text of that item is your application’s client secret. -
Creates BoxClient object based on developer token
Declaration
Swift
public static func getClient(token: String) -> BoxClient
Parameters
token
Developer token
Return Value
New BoxClient object
-
Creates BoxClient with developer token
Declaration
Swift
public func getClient(token: String) -> BoxClient
Parameters
token
Developer token
Return Value
New BoxClient object
-
Creates BoxClient using JWT token.
Declaration
Swift
public func getDelegatedAuthClient( tokenInfo: TokenInfo? = nil, tokenStore: TokenStore? = nil, authClosure: @escaping DelegatedAuthClosure, uniqueID: String, completion: @escaping (Result<BoxClient, BoxError>) -> Void )
Parameters
tokenInfo
Information about token
tokenStore
Custom token store. To use custom store, implement TokenStore protocol.
authClosure
Requests new JWT token value when needed. Provide the token value from your token provider.
uniqueID
Unique identifier provided for jwt token.
completion
Returns standard BoxClient object or error.
-
Creates BoxClient in a completion with OAuth 2.0 type of authentication
Declaration
Swift
public func getOAuth2Client( tokenInfo: TokenInfo? = nil, tokenStore: TokenStore? = nil, completion: @escaping (Result<BoxClient, BoxError>) -> Void )
Parameters
tokenInfo
Information about token
tokenStore
Custom token store. To use custom store, implement TokenStore protocol.
completion
Returns created standard BoxClient object or error
-
updateConfiguration(apiBaseURL:uploadApiBaseURL:maxRetryAttempts:tokenRefreshThreshold:logDestination:clientAnalyticsInfo:)
Updates current SDK configuration
Declaration
Swift
func updateConfiguration( apiBaseURL: URL? = nil, uploadApiBaseURL: URL? = nil, maxRetryAttempts: Int? = nil, tokenRefreshThreshold: TimeInterval? = nil, logDestination: LogDestination? = nil, clientAnalyticsInfo: ClientAnalyticsInfo? = nil )
Parameters
apiBaseURL
Base URL for majority of the requests.
uploadApiBaseURL
Base URL for upload requests. If not specified, default URL is used.
maxRetryAttempts
Maximum number of request retries in case of error result. If not specified, default value 5 is used.
tokenRefreshThreshold
Specifies how many seconds before token expires it shuld be refreshed. If not specified, default value 60 seconds is used.
logDestination
Custom destination of console log.
clientAnalyticsInfo
Custom analytics info that will be set to request header.