Client
@objc(FSClient)
public class Client : NSObject
Represents a client that allows communicating with the Filestack REST API.
-
Uploads a single local URL directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Important
If your uploadable can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadable, otherwisetext/plain
will be assumed.Note
This function is made available especially for Objective-C SDK users. If you are using Swift, you might want to use
upload(using:options:queue:uploadProgress:completionHandler:)
instead.Declaration
Swift
@discardableResult @objc public func uploadURL(using localURL: NSURL, options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Parameters
localURL
The URL of the local file to be uploaded.
options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader
that allows starting, cancelling and monitoring the upload. -
Uploads an array of local URLs directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Important
If your uploadable can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadable, otherwisetext/plain
will be assumed.Note
This function is made available especially for Objective-C SDK users. If you are using Swift, you might want to use
upload(using:options:queue:uploadProgress:completionHandler:)
instead.Declaration
Swift
@discardableResult @objc public func uploadMultipleURLs(using localURLs: [NSURL], options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader
Parameters
localURLs
The URL of the local file to be uploaded.
options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader
that allows starting, cancelling and monitoring the upload. -
Uploads data directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Important
If your uploadable can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadable, otherwisetext/plain
will be assumed.Note
This function is made available especially for Objective-C SDK users. If you are using Swift, you might want to use
upload(using:options:queue:uploadProgress:completionHandler:)
instead.Declaration
Swift
@discardableResult @objc public func uploadData(using data: NSData, options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Parameters
data
The data to be uploaded.
options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader
that allows starting, cancelling and monitoring the upload. -
Uploads multiple data directly to a given storage location.
Currently the only storage location supported is Amazon S3.
Important
If your uploadable can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadable, otherwisetext/plain
will be assumed.Note
This function is made available especially for Objective-C SDK users. If you are using Swift, you might want to use
add(uploadables:)
instead.Declaration
Swift
@discardableResult @objc public func uploadMultipleData(using multipleData: [NSData], options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader
Parameters
multipleData
The array of data objects to be uploaded.
options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader
that allows starting, cancelling and monitoring the upload.
-
An API key obtained from the Developer Portal.
Declaration
Swift
@objc var apiKey: String { get }
-
Returns whether there’s at least a single
Uploader
instance currently running.Declaration
Swift
@objc var isUploading: Bool { get }
-
A
Transformable
object for a Filestack handle.See also
Declaration
Swift
@objc func transformable(handle: String) -> Transformable
Parameters
handle
A Filestack handle.
-
A
Transformable
object for an array of Filestack handles.See also
Declaration
Swift
@objc func transformable(handles: [String]) -> Transformable
Parameters
handles
An array of Filestack handles.
-
A
Transformable
object for an external URL.See also
Declaration
Swift
@objc func transformable(externalURL: URL) -> Transformable
Parameters
externalURL
An external URL.
-
A
Transformable
object for an array of external URLs.See also
Declaration
Swift
@objc func transformable(externalURLs: [URL]) -> Transformable
Parameters
externalURLs
An array of external URLs.
-
Uploads a single
Uploadable
to a given storage location.Currently the only storage location supported is Amazon S3.
Important
If your uploadable can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadable, otherwisetext/plain
will be assumed.Declaration
Swift
@discardableResult func upload(using uploadable: Uploadable, options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping (JSONResponse) -> Void) -> Uploader
Parameters
uploadable
An item to upload conforming to
Uploadable
.options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader
that allows starting, cancelling and monitoring the upload. -
Uploads an array of
Uploadable
items to a given storage location.Currently the only storage location supported is Amazon S3.
Important
If your uploadables can not return a MIME type (e.g. when passing
Data
as the uploadable), you must pass a customUploadOptions
with customstoreOptions
initialized with amimeType
that better represents your uploadables, otherwisetext/plain
will be assumed.Declaration
Swift
@discardableResult func upload(using uploadables: [Uploadable]? = nil, options: UploadOptions = .defaults, queue: DispatchQueue = .main, uploadProgress: ((Progress) -> Void)? = nil, completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader & DeferredAdd
Parameters
uploadables
An array of items to upload conforming to
Uploadable
. May benil
if you intend to add them later to the returnedMultifileUpload
object.options
A set of upload options (see
UploadOptions
for more information.)queue
The queue on which the upload progress and completion handlers are dispatched.
uploadProgress
Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server.
nil
by default.completionHandler
Adds a handler to be called once the upload has finished.
Return Value
An
Uploader & DeferredAdd
that allows starting, cancelling and monitoring the upload, plus addingUploadables
at a later time.