FileRestrictions

public struct FileRestrictions

A value type describing the constraints applied to file uploads.

This model is used to determine whether attachments can be uploaded, the maximum allowed file size (in MiB, where 1 MiB = 1024×1024 bytes), and the list of permitted MIME types.

Note

If isAttachmentsEnabled is false, uploads should be disabled regardless of size or type.

Properties

  • Maximum size of allowed uploads in megabytes (1024x1024).

    Declaration

    Swift

    public let allowedFileSize: Int32
  • Details of allowed file mime types.

    Declaration

    Swift

    public let allowedFileTypes: [AllowedFileType]
  • True iff attachment uploads are allowed. If false, no uploads are allowed.

    Declaration

    Swift

    public let isAttachmentsEnabled: Bool

Init

  • Creates a new set of file upload restrictions.

    Declaration

    Swift

    public init(allowedFileSize: Int32, allowedFileTypes: [AllowedFileType], isAttachmentsEnabled: Bool)

    Parameters

    allowedFileSize

    The maximum allowed file size in mebibytes (MiB, 1024x1024 bytes).

    allowedFileTypes

    The list of permitted MIME types for uploads.

    isAttachmentsEnabled

    A Boolean value indicating whether attachment uploads are allowed at all.