FileLink

@objc(FSFileLink)
public class FileLink : NSObject

Represents a FileLink object.

See Filestack Architecture Overview for more information about files.

Public Properties

  • An API key obtained from the Developer Portal.

    Declaration

    Swift

    public let apiKey: String
  • A Security object. nil by default.

    Declaration

    Swift

    public let security: Security?
  • A Filestack Handle. nil by default.

    Declaration

    Swift

    @objc
    public let handle: String
  • url

    A Filestack CDN URL corresponding to this FileLink.

    Declaration

    Swift

    @objc
    public lazy var url: URL { get set }

Public Functions

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

    Declaration

    Swift

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

    Parameters

    parameters

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

    queue

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

    downloadProgress

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

    completionHandler

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

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

    Declaration

    Swift

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

    Parameters

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

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

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

    Declaration

    Swift

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

    Parameters

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

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

  • Gets metadata associated to this Filelink as a JSON payload.

    Declaration

    Swift

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

    Parameters

    options

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

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

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

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

    Declaration

    Swift

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

    Parameters

    destinationURL

    The local URL where content should be saved.

    parameters

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

    queue

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

    downloadProgress

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

    completionHandler

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

  • Removes this FileLink from Filestack.

    Note

    Please ensure this FileLink object has the security property properly set up with a Policy that includes the remove permission.

    Declaration

    Swift

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

    Parameters

    parameters

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

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

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

  • Overwrites this FileLink with a provided local file.

    Note

    Please ensure this FileLink object has the security property properly set up with a Policy that includes the write permission.

    Declaration

    Swift

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

    Parameters

    parameters

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

    fileURL

    A local file that will replace the existing remote content.

    queue

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

    uploadProgress

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

    completionHandler

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

  • Overwrites this FileLink with a provided remote URL.

    Note

    Please ensure this FileLink object has the security property properly set up with a Policy that includes the write permission.

    Declaration

    Swift

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

    Parameters

    parameters

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

    queue

    The queue on which the completion handler is dispatched.

    remoteURL

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

    completionHandler

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

  • Returns an Transformable corresponding to this FileLink.

    Declaration

    Swift

    @objc
    func transformable() -> Transformable