// Telegrammer - Telegram Bot Swift SDK.
// This file is autogenerated by API/generate_wrappers.rb script.

public extension Bot {

    /// Parameters container struct for `setChatDescription` method
    struct SetChatDescriptionParams: JSONEncodable {

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

        /// New chat description, 0-255 characters
        var description: String?

        /// Custom keys for coding/decoding `SetChatDescriptionParams` struct
        enum CodingKeys: String, CodingKey {
            case chatId = "chat_id"
            case description = "description"
        }

        public init(chatId: ChatId, description: String? = nil) {
            self.chatId = chatId
            self.description = description
        }
    }

    /**
     Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

     SeeAlso Telegram Bot API Reference:
     [SetChatDescriptionParams](https://core.telegram.org/bots/api#setchatdescription)
     
     - Parameters:
         - params: Parameters container, see `SetChatDescriptionParams` struct
     - Throws: Throws on errors
     - Returns: Future of `Bool` type
     */
    @discardableResult
    func setChatDescription(params: SetChatDescriptionParams) throws -> Future<Bool> {
        let body = try httpBody(for: params)
        let headers = httpHeaders(for: params)
        return try client
            .request(endpoint: "setChatDescription", body: body, headers: headers)
            .flatMapThrowing { (container) -> Bool in
                return try self.processContainer(container)
        }
    }
}
