Home telegram - api.Chat
Post
Cancel

telegram - api.Chat

enum Chat

1
2
3
4
5
case chatEmpty(id: Int64)
case chat(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?)
case chatForbidden(id: Int64, title: String)
case channel(flags: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?)
case channelForbidden(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?)

enum ChatPhoto

1
2
case chatPhotoEmpty
case chatPhoto(flags: Int32, photoId: Int64, strippedThumb: Buffer?, dcId: Int32)

imageRepresentationsForApiChatPhoto

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMediaImageRepresentation] {
    var representations: [TelegramMediaImageRepresentation] = []
    switch photo {
        case let .chatPhoto(_, photoId, strippedThumb, dcId):
            let smallResource: TelegramMediaResource
            let fullSizeResource: TelegramMediaResource

            smallResource = CloudPeerPhotoSizeMediaResource(datacenterId: dcId, photoId: photoId, sizeSpec: .small, volumeId: nil, localId: nil)
            fullSizeResource = CloudPeerPhotoSizeMediaResource(datacenterId: dcId, photoId: photoId, sizeSpec: .fullSize, volumeId: nil, localId: nil)

            representations.append(TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 80, height: 80), resource: smallResource, progressiveSizes: [], immediateThumbnailData: strippedThumb?.makeData()))
            representations.append(TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 640, height: 640), resource: fullSizeResource, progressiveSizes: [], immediateThumbnailData: strippedThumb?.makeData()))
        case .chatPhotoEmpty:
            break
    }
    return representations
}

enum ChatAdminRights

1
case chatAdminRights(flags: Int32)

enum ChatBannedRights

1
case chatBannedRights(flags: Int32, untilDate: Int32)

enum RestrictionReason

1
case restrictionReason(platform: String, reason: String, text: String)
This post is licensed under CC BY 4.0 by the author.