Filestack Documentation

Class Client

@objc(FSClient)
public class Client: NSObject  

Represents a client that allows communicating with the Filestack REST API.

Client Client NSObject NSObject Client->NSObject

Conforms To

NSObject

Initializers

init(api​Key:​security:​)

@objc public init(apiKey: String, security: Security? = nil)  

Default initializer.

Parameters

api​Key String

An API key obtained from the Developer Portal.

security Security?

A Security object. nil by default.

init(api​Key:​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

api​Key

@objc var apiKey: String  

An API key obtained from the Developer Portal.

security

@objc var security: Security?  

A Security object. nil by default.

current​Uploaders

@objc var currentUploaders: [Uploader]  

Returns an array containing the Uploader instances currently running.

is​Uploading

@objc var isUploading: Bool  

Returns whether there's at least a single Uploader instance currently running.

description

override public var description: String  

:nodoc:

Methods

multi​Part​Upload(from:​store​Options:​use​Intelligent​Ingestion​IfAvailable:​queue:​start​Upload​Immediately:​upload​Progress:​completion​Handler:​)

@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:

multi​File​Upload(from:​store​Options:​use​Intelligent​Ingestion​IfAvailable:​queue:​start​Upload​Immediately:​upload​Progress:​completion​Handler:​)

@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:

upload​URL(using:​options:​queue:​upload​Progress:​completion​Handler:​)

@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

local​URL NSURL

The URL of the local file to be uploaded.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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​Multiple​URLs(using:​options:​queue:​upload​Progress:​completion​Handler:​)

@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

local​URLs [NSURL]

The URL of the local file to be uploaded.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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​Data(using:​options:​queue:​upload​Progress:​completion​Handler:​)

@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

data NSData

The data to be uploaded.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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​Multiple​Data(using:​options:​queue:​upload​Progress:​completion​Handler:​)

@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

multiple​Data [NSData]

The array of data objects to be uploaded.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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.

file​Link(for:​)

@objc func fileLink(for handle: String) -> FileLink  

A FileLink object for a given Filestack handle.

Parameters

handle String

A Filestack handle.

transformable(handle:​)

@objc func transformable(handle: String) -> Transformable  

A Transformable object for a Filestack handle.

Parameters

handle String

A Filestack handle.

transformable(handles:​)

@objc func transformable(handles: [String]) -> Transformable  

A Transformable object for an array of Filestack handles.

Parameters

handles [String]

An array of Filestack handles.

transformable(external​URL:​)

@objc func transformable(externalURL: URL) -> Transformable  

A Transformable object for an external URL.

Parameters

external​URL URL

An external URL.

transformable(external​URLs:​)

@objc func transformable(externalURLs: [URL]) -> Transformable  

A Transformable object for an array of external URLs.

Parameters

external​URLs [URL]

An array of external URLs.

upload(using:​options:​queue:​upload​Progress:​completion​Handler:​)

@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

uploadable Uploadable

An item to upload conforming to Uploadable.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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:​upload​Progress:​completion​Handler:​)

@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

uploadables [Uploadable]?

An array of items to upload conforming to Uploadable. May be nil if you intend to add them later to the returned MultifileUpload object.

options Upload​Options

A set of upload options (see UploadOptions for more information.)

queue Dispatch​Queue

The queue on which the upload progress and completion handlers are dispatched.

upload​Progress ((Progress) -> Void)?

Sets a closure to be called periodically during the lifecycle of the upload process as data is uploaded to the server. nil by default.

completion​Handler @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.