Filestack Documentation

Class File​Link

@objc(FSFileLink)
public class FileLink: NSObject  

Represents a FileLink object.

See Filestack Architecture Overview for more information about files.

FileLink FileLink NSObject NSObject FileLink->NSObject

Conforms To

NSObject

Properties

api​Key

public let apiKey: String

An API key obtained from the Developer Portal.

security

public let security: Security? 

A Security object. nil by default.

handle

@objc public let handle: String

A Filestack Handle. nil by default.

url

@objc public lazy var url: URL  

A Filestack CDN URL corresponding to this FileLink.

description

override public var description: String  

:nodoc:

Methods

get​Content(parameters:​queue:​download​Progress:​completion​Handler:​)

@objc func getContent(parameters: [String: Any]? = nil,
                          queue: DispatchQueue? = .main,
                          downloadProgress: ((Progress) -> Void)? = nil,
                          completionHandler: @escaping (DataResponse) -> Void)  

Gets the content associated to this FileLink as a Data object.

Parameters

parameters [String:​ Any]?

Any query string parameters that should be added to the request. nil by default.

queue Dispatch​Queue?

The queue on which the downloadProgress and completion handlers are dispatched.

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

Sets a closure to be called periodically during the lifecycle of the Request as data is read from the server. nil by default.

completion​Handler @escaping (Data​Response) -> Void

Adds a handler to be called once the request has finished.

get​Tags(queue:​completion​Handler:​)

@objc func getTags(queue: DispatchQueue? = .main,
                       completionHandler: @escaping (JSONResponse) -> Void)  

Gets the image tags associated to this FileLink as a JSON payload.

Parameters

queue Dispatch​Queue?

The queue on which the completion handler is dispatched.

completion​Handler @escaping (JSONResponse) -> Void

Adds a handler to be called once the request has finished.

get​Safe​For​Work(queue:​completion​Handler:​)

@objc func getSafeForWork(queue: DispatchQueue? = .main,
                              completionHandler: @escaping (JSONResponse) -> Void)  

Gets the safe for work status associated to this FileLink as a JSON payload.

Parameters

queue Dispatch​Queue?

The queue on which the completion handler is dispatched.

completion​Handler @escaping (JSONResponse) -> Void

Adds a handler to be called once the request has finished.

get​Metadata(options:​queue:​completion​Handler:​)

func getMetadata(options: MetadataOptions,
                           queue: DispatchQueue? = .main,
                           completionHandler: @escaping (JSONResponse) -> Void)  

Gets metadata associated to this Filelink as a JSON payload.

Parameters

options Metadata​Options

The options that should be included as part of the response.

queue Dispatch​Queue?

The queue on which the completion handler is dispatched.

completion​Handler @escaping (JSONResponse) -> Void

Adds a handler to be called once the request has finished.

download(destination​URL:​parameters:​queue:​download​Progress:​completion​Handler:​)

@objc func download(destinationURL: URL,
                        parameters: [String: Any]? = nil,
                        queue: DispatchQueue? = .main,
                        downloadProgress: ((Progress) -> Void)? = nil,
                        completionHandler: @escaping (DownloadResponse) -> Void)  

Downloads the content associated to this FileLink to a destination URL.

Parameters

destination​URL URL

The local URL where content should be saved.

parameters [String:​ Any]?

Any query string parameters that should be added to the request. nil by default.

queue Dispatch​Queue?

The queue on which the downloadProgress and completion handlers are dispatched.

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

Sets a closure to be called periodically during the lifecycle of the Request as data is read from the server. nil by default.

completion​Handler @escaping (Download​Response) -> Void

Adds a handler to be called once the request has finished.

delete(parameters:​queue:​completion​Handler:​)

@objc func delete(parameters: [String: Any]? = nil,
                      queue: DispatchQueue? = .main,
                      completionHandler: @escaping (DataResponse) -> Void)  

Removes this FileLink from Filestack.

Parameters

parameters [String:​ Any]?

Any query string parameters that should be added to the request. nil by default.

queue Dispatch​Queue?

The queue on which the completion handler is dispatched.

completion​Handler @escaping (Data​Response) -> Void

Adds a handler to be called once the request has finished.

overwrite(parameters:​file​URL:​queue:​upload​Progress:​completion​Handler:​)

@objc func overwrite(parameters: [String: Any]? = nil,
                         fileURL: URL,
                         queue: DispatchQueue? = .main,
                         uploadProgress: ((Progress) -> Void)? = nil,
                         completionHandler: @escaping (DataResponse) -> Void)  

Overwrites this FileLink with a provided local file.

Parameters

parameters [String:​ Any]?

Any query string parameters that should be added to the request. nil by default.

file​URL URL

A local file that will replace the existing remote content.

queue Dispatch​Queue?

The queue on which the uploadProgress and completion handlers are dispatched.

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

Sets a closure to be called periodically during the lifecycle of the Request as data is written on the server. nil by default.

completion​Handler @escaping (Data​Response) -> Void

Adds a handler to be called once the request has finished.

overwrite(parameters:​remote​URL:​queue:​completion​Handler:​)

@objc func overwrite(parameters: [String: Any]? = nil,
                         remoteURL: URL,
                         queue: DispatchQueue? = .main,
                         completionHandler: @escaping (DataResponse) -> Void)  

Overwrites this FileLink with a provided remote URL.

Parameters

parameters [String:​ Any]?

Any query string parameters that should be added to the request. nil by default.

queue Dispatch​Queue?

The queue on which the completion handler is dispatched.

remote​URL URL

A remote URL whose content will replace the existing remote content.

completion​Handler @escaping (Data​Response) -> Void

Adds a handler to be called once the request has finished.

transformable()

@objc func transformable() -> Transformable  

Returns an Transformable corresponding to this FileLink.