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



public extension Bot {

    /// Parameters container struct for `getGameHighScores` method
    struct GetGameHighScoresParams: JSONEncodable {

        /// Target user id
        var userId: Int64

        /// Required if inline_message_id is not specified. Unique identifier for the target chat
        var chatId: Int64?

        /// Required if inline_message_id is not specified. Identifier of the sent message
        var messageId: Int?

        /// Required if chat_id and message_id are not specified. Identifier of the inline message
        var inlineMessageId: String?

        /// Custom keys for coding/decoding `GetGameHighScoresParams` struct
        enum CodingKeys: String, CodingKey {
            case userId = "user_id"
            case chatId = "chat_id"
            case messageId = "message_id"
            case inlineMessageId = "inline_message_id"
        }

        public init(userId: Int64, chatId: Int64? = nil, messageId: Int? = nil, inlineMessageId: String? = nil) {
            self.userId = userId
            self.chatId = chatId
            self.messageId = messageId
            self.inlineMessageId = inlineMessageId
        }
    }

    /**
     Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
     This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change.

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