Class
Client
@objc(FSClient)
public class Client: NSObject
Represents a client that allows communicating with the Filestack REST API.
Relationships
Conforms To
NSObject
Initializers
init(apiKey:security:)
@objc public init(apiKey: String, security: Security? = nil)
Default initializer.
Parameters
Name | Type | Description |
---|---|---|
apiKey | String |
An API key obtained from the Developer Portal. |
security | Security? |
A |
init(apiKey:security:storage:)
@available(*, deprecated, message: "Marked for removal in version 3.0. Please use `init(apiKey:security:)` instead.")
@objc public init(apiKey: String, security: Security? = nil, storage _: StorageLocation)
:nodoc:
Properties
currentUploaders
@objc var currentUploaders: [Uploader]
Returns an array containing the Uploader
instances currently running.
isUploading
@objc var isUploading: Bool
Returns whether there's at least a single Uploader
instance currently running.
Methods
multiPartUpload(from:storeOptions:useIntelligentIngestionIfAvailable:queue:startUploadImmediately:uploadProgress:completionHandler:)
@discardableResult
@objc
@available(*, deprecated, message: "Marked for removal in version 3.0. Please use upload(using:options:queue:uploadProgress:completionHandler:) instead")
public func multiPartUpload(from localURL: URL,
storeOptions: StorageOptions = StorageOptions(location: .s3, access: .private),
useIntelligentIngestionIfAvailable: Bool = true,
queue: DispatchQueue = .main,
startUploadImmediately: Bool = true,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
:nodoc:
multiFileUpload(from:storeOptions:useIntelligentIngestionIfAvailable:queue:startUploadImmediately:uploadProgress:completionHandler:)
@discardableResult
@objc
@available(*, deprecated, message: "Marked for removal in version 3.0. Please use upload(using:options:queue:uploadProgress:completionHandler:) instead")
public func multiFileUpload(from localURLs: [URL],
storeOptions: StorageOptions = StorageOptions(location: .s3, access: .private),
useIntelligentIngestionIfAvailable: Bool = true,
queue: DispatchQueue = .main,
startUploadImmediately: Bool = true,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader
:nodoc:
uploadURL(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
@objc public func uploadURL(using localURL: NSURL,
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Uploads a single local URL directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
localURL | NSURL |
The URL of the local file to be uploaded. |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping (JSONResponse) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader
that allows starting, cancelling and monitoring the upload.
uploadMultipleURLs(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
@objc public func uploadMultipleURLs(using localURLs: [NSURL],
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader
Uploads an array of local URLs directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
localURLs | [NSURL] |
The URL of the local file to be uploaded. |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping ([JSONResponse]) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader
that allows starting, cancelling and monitoring the upload.
uploadData(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
@objc public func uploadData(using data: NSData,
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Uploads data directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
data | NSData |
The data to be uploaded. |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping (JSONResponse) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader
that allows starting, cancelling and monitoring the upload.
uploadMultipleData(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
@objc public func uploadMultipleData(using multipleData: [NSData],
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader
Uploads multiple data directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
multipleData | [NSData] |
The array of data objects to be uploaded. |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping ([JSONResponse]) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader
that allows starting, cancelling and monitoring the upload.
fileLink(for:)
@objc func fileLink(for handle: String) -> FileLink
A FileLink
object for a given Filestack handle.
Parameters
Name | Type | Description |
---|---|---|
handle | String |
A Filestack handle. |
transformable(handle:)
@objc func transformable(handle: String) -> Transformable
A Transformable
object for a Filestack handle.
Parameters
Name | Type | Description |
---|---|---|
handle | String |
A Filestack handle. |
transformable(handles:)
@objc func transformable(handles: [String]) -> Transformable
A Transformable
object for an array of Filestack handles.
Parameters
Name | Type | Description |
---|---|---|
handles | [String] |
An array of Filestack handles. |
transformable(externalURL:)
@objc func transformable(externalURL: URL) -> Transformable
A Transformable
object for an external URL.
Parameters
Name | Type | Description |
---|---|---|
externalURL | URL |
An external URL. |
transformable(externalURLs:)
@objc func transformable(externalURLs: [URL]) -> Transformable
A Transformable
object for an array of external URLs.
Parameters
Name | Type | Description |
---|---|---|
externalURLs | [URL] |
An array of external URLs. |
upload(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
func upload(using uploadable: Uploadable,
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Uploads a single Uploadable
to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
uploadable | Uploadable |
An item to upload conforming to |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping (JSONResponse) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader
that allows starting, cancelling and monitoring the upload.
upload(using:options:queue:uploadProgress:completionHandler:)
@discardableResult
func upload(using uploadables: [Uploadable]? = nil,
options: UploadOptions = .defaults,
queue: DispatchQueue = .main,
uploadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader & DeferredAdd
Uploads an array of Uploadable
items to a given storage location.
Currently the only storage location supported is Amazon S3.
Parameters
Name | Type | Description |
---|---|---|
uploadables | [Uploadable]? |
An array of items to upload conforming to |
options | UploadOptions |
A set of upload options (see |
queue | DispatchQueue |
The queue on which the upload progress and completion handlers are dispatched. |
uploadProgress | ((Progress) -> Void)? |
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. |
completionHandler | @escaping ([JSONResponse]) -> Void |
Adds a handler to be called once the upload has finished. |
Returns
An Uploader & DeferredAdd
that allows starting, cancelling and monitoring the upload, plus adding Uploadables
at a later time.