Skip to content

Commit

Permalink
Bot API 7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Aug 1, 2024
1 parent abf6bad commit cc162b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import Foundation
/// Parameters container struct for `pinChatMessage` method
public struct TGPinChatMessageParams: Encodable {

/// Unique identifier of the business connection on behalf of which the message will be pinned
public var businessConnectionId: String?

/// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
public var chatId: TGChatId

Expand All @@ -20,12 +23,14 @@ public struct TGPinChatMessageParams: Encodable {

/// Custom keys for coding/decoding `PinChatMessageParams` struct
public enum CodingKeys: String, CodingKey {
case businessConnectionId = "business_connection_id"
case chatId = "chat_id"
case messageId = "message_id"
case disableNotification = "disable_notification"
}

public init(chatId: TGChatId, messageId: Int, disableNotification: Bool? = nil) {
public init(businessConnectionId: String? = nil, chatId: TGChatId, messageId: Int, disableNotification: Bool? = nil) {
self.businessConnectionId = businessConnectionId
self.chatId = chatId
self.messageId = messageId
self.disableNotification = disableNotification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct TGSetStickerSetThumbnailParams: Encodable {
/// User identifier of the sticker set owner
public var userId: Int64

/// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
/// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
public var thumbnail: TGFileInfo?

/// Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ import Foundation
/// Parameters container struct for `unpinChatMessage` method
public struct TGUnpinChatMessageParams: Encodable {

/// Unique identifier of the business connection on behalf of which the message will be unpinned
public var businessConnectionId: String?

/// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
public var chatId: TGChatId

/// Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
/// Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
public var messageId: Int?

/// Custom keys for coding/decoding `UnpinChatMessageParams` struct
public enum CodingKeys: String, CodingKey {
case businessConnectionId = "business_connection_id"
case chatId = "chat_id"
case messageId = "message_id"
}

public init(chatId: TGChatId, messageId: Int? = nil) {
public init(businessConnectionId: String? = nil, chatId: TGChatId, messageId: Int? = nil) {
self.businessConnectionId = businessConnectionId
self.chatId = chatId
self.messageId = messageId
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/SwiftTelegramSdk/Bot/Telegram/Models/TGUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public final class TGUser: Codable {
case canReadAllGroupMessages = "can_read_all_group_messages"
case supportsInlineQueries = "supports_inline_queries"
case canConnectToBusiness = "can_connect_to_business"
case hasMainWebApp = "has_main_web_app"
}

/// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
Expand Down Expand Up @@ -60,7 +61,10 @@ public final class TGUser: Codable {
/// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe.
public var canConnectToBusiness: Bool?

public init (id: Int64, isBot: Bool, firstName: String, lastName: String? = nil, username: String? = nil, languageCode: String? = nil, isPremium: Bool? = nil, addedToAttachmentMenu: Bool? = nil, canJoinGroups: Bool? = nil, canReadAllGroupMessages: Bool? = nil, supportsInlineQueries: Bool? = nil, canConnectToBusiness: Bool? = nil) {
/// Optional. True, if the bot has a main Web App. Returned only in getMe.
public var hasMainWebApp: Bool?

public init (id: Int64, isBot: Bool, firstName: String, lastName: String? = nil, username: String? = nil, languageCode: String? = nil, isPremium: Bool? = nil, addedToAttachmentMenu: Bool? = nil, canJoinGroups: Bool? = nil, canReadAllGroupMessages: Bool? = nil, supportsInlineQueries: Bool? = nil, canConnectToBusiness: Bool? = nil, hasMainWebApp: Bool? = nil) {
self.id = id
self.isBot = isBot
self.firstName = firstName
Expand All @@ -73,5 +77,6 @@ public final class TGUser: Codable {
self.canReadAllGroupMessages = canReadAllGroupMessages
self.supportsInlineQueries = supportsInlineQueries
self.canConnectToBusiness = canConnectToBusiness
self.hasMainWebApp = hasMainWebApp
}
}

0 comments on commit cc162b1

Please sign in to comment.