OptimizeStorage

public struct OptimizeStorage : Codable, Equatable, TDFunction

Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can’t be deleted

  • Undocumented

    Declaration

    Swift

    public typealias Result = StorageStatistics
  • Limit on the total size of files after deletion. Pass -1 to use the default limit

    Declaration

    Swift

    public let size: Int53
  • ttl

    Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit

    Declaration

    Swift

    public let ttl: Int32
  • Limit on the total count of files after deletion. Pass -1 to use the default limit

    Declaration

    Swift

    public let count: Int32
  • The amount of time after the creation of a file during which it can’t be deleted, in seconds. Pass -1 to use the default value

    Declaration

    Swift

    public let immunityDelay: Int32
  • If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted

    Declaration

    Swift

    public let fileTypes: [FileType]
  • If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)

    Declaration

    Swift

    public let chatIds: [Int53]
  • If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)

    Declaration

    Swift

    public let excludeChatIds: [Int53]
  • Same as in getStorageStatistics. Affects only returned statistics

    Declaration

    Swift

    public let chatLimit: Int32
  • Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can’t be deleted

    Declaration

    Swift

    public init(size: Int53, ttl: Int32, count: Int32, immunityDelay: Int32, fileTypes: [FileType], chatIds: [Int53], excludeChatIds: [Int53], chatLimit: Int32)

    Parameters

    size

    Limit on the total size of files after deletion. Pass -1 to use the default limit

    ttl

    Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit

    count

    Limit on the total count of files after deletion. Pass -1 to use the default limit

    immunityDelay

    The amount of time after the creation of a file during which it can’t be deleted, in seconds. Pass -1 to use the default value

    fileTypes

    If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted

    chatIds

    If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)

    excludeChatIds

    If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)

    chatLimit

    Same as in getStorageStatistics. Affects only returned statistics