Policy

@objc(FSPolicy)
public class Policy : NSObject

Represents a policy object.

See Creating Policies for more information about policies.

Properties

  • The expiration date for the policy.

    Declaration

    Swift

    public let expiry: Date
  • The calls that you allow this policy to make.

    See also

    PolicyCall

    Declaration

    Swift

    public let call: PolicyCall?
  • The unique file handle that you would like to access.

    Declaration

    Swift

    public var handle: String?
  • url

    It is possible to create a subset of external URL domains that are allowed to be image/document sources for processing.filestackapi.com transformations.

    The URL parameter only applies to processing engine transformations and cannot be used to restrict uploads via the picker to specific domains for example. The filter is a regular expression that must match the input URL. The following is an example of a policy that restricts conversion requests to urls from wikimedia:

    {
        "expiry":1577836800,
        "call":["convert"],
        "url":"https://upload\\.wikimedia\\.org/wikipedia/.*"
    }
    

    Declaration

    Swift

    public var url: String?
  • The maximum file size in bytes that can be stored by your request.

    Declaration

    Swift

    public var maxSize: UInt?
  • The minimum file size that can be stored by your request.

    Declaration

    Swift

    public var minSize: UInt?
  • For policies that store files, a Perl-like regular expression that must match the path that the files will be stored under.

    Declaration

    Swift

    public var path: String?
  • For policies that store files, a Perl-like regular expression that must match the container/bucket that the files will be stored under.

    Declaration

    Swift

    public var container: String?

Lifecycle

  • Convenience initializer with expiry time.

    Declaration

    Swift

    @objc
    public convenience init(expiry: Date)
  • Convenience initializer with expiry time and call permissions.

    Declaration

    Swift

    public convenience init(expiry: Date, call: PolicyCall)
  • The designated initializer.

    Declaration

    Swift

    @nonobjc
    public init(expiry: Date,
                call: PolicyCall? = nil,
                handle: String? = nil,
                url: String? = nil,
                maxSize: UInt? = nil,
                minSize: UInt? = nil,
                path: String? = nil,
                container: String? = nil)