From b84b4c422852478c595a3e489eefb2ea491d5756 Mon Sep 17 00:00:00 2001 From: Quetzal Rivera Date: Sun, 7 Jul 2024 08:35:47 -0600 Subject: [PATCH] feat: Update to Bot API 7.7 --- README.md | 8 ++-- src/examples/readme.md | 2 +- .../MaybeInaccessibleMessage/Message.cs | 6 +++ .../Payments/RefundedPayment.cs | 41 +++++++++++++++++++ src/library/Telegram.BotAPI/PropertyNames.cs | 1 + src/library/Telegram.BotAPI/README.md | 8 ++-- .../Telegram.BotAPI/Telegram.BotAPI.csproj | 6 +-- 7 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 src/library/Telegram.BotAPI/Payments/RefundedPayment.cs diff --git a/README.md b/README.md index 803be5e..be347c1 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ | -------------------------------------------------- | -------------------------------- | [![NuGet version (Telegram.BotAPI)](https://img.shields.io/nuget/v/Telegram.BotAPI?style=flat-square&logo=nuget)](https://www.nuget.org/packages/Telegram.BotAPI/) -[![Compatible with Bot API v7.6](https://img.shields.io/badge/Bot%20API%20version-v7.6-blue?style=flat-square)](https://core.telegram.org/bots/api#july-1-2024) +[![Compatible with Bot API v7.7](https://img.shields.io/badge/Bot%20API%20version-v7.7-blue?style=flat-square)](https://core.telegram.org/bots/api#july-7-2024) -**Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. It contains all the methods and types available in the Bot API 7.6 released on July 1, 2024. +**Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. It contains all the methods and types available in the Bot API 7.7 released on July 7, 2024. [![Telegram Chat](https://img.shields.io/badge/Telegram.BotAPI%20--%20Chat-Join-blue?style=social&logo=telegram)](https://t.me/TBAPINET) @@ -12,8 +12,8 @@ ## Features -- Contains pre-defined methods for all Bot API 7.6 methods. -- Contains classes for each object type used in the Bot API 7.6. +- Contains pre-defined methods for all Bot API 7.7 methods. +- Contains classes for each object type used in the Bot API 7.7. - Sync and async methods. - Uses [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/). diff --git a/src/examples/readme.md b/src/examples/readme.md index dba5fe3..1f7419f 100644 --- a/src/examples/readme.md +++ b/src/examples/readme.md @@ -1,7 +1,7 @@ # Telegram.BotAPI NET Examples [![NuGet version (Telegram.BotAPI)](https://img.shields.io/nuget/v/Telegram.BotAPI?style=flat-square&logo=nuget)](https://www.nuget.org/packages/Telegram.BotAPI/) -[![Compatible with Bot API v7.6](https://img.shields.io/badge/Bot%20API%20version-v7.6-blue?style=flat-square)](https://core.telegram.org/bots/api#july-1-2024) +[![Compatible with Bot API v7.7](https://img.shields.io/badge/Bot%20API%20version-v7.7-blue?style=flat-square)](https://core.telegram.org/bots/api#july-7-2024) ## Sample list diff --git a/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs b/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs index bae35d0..217b7c7 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs @@ -374,6 +374,12 @@ public class Message : MaybeInaccessibleMessage [JsonPropertyName(PropertyNames.SuccessfulPayment)] public SuccessfulPayment? SuccessfulPayment { get; set; } + /// + /// Optional. Message is a service message about a refunded payment, information about the payment. More about payments » + /// + [JsonPropertyName(PropertyNames.RefundedPayment)] + public RefundedPayment? RefundedPayment { get; set; } + /// /// Optional. Service message: users were shared with the bot /// diff --git a/src/library/Telegram.BotAPI/Payments/RefundedPayment.cs b/src/library/Telegram.BotAPI/Payments/RefundedPayment.cs new file mode 100644 index 0000000..d7cb036 --- /dev/null +++ b/src/library/Telegram.BotAPI/Payments/RefundedPayment.cs @@ -0,0 +1,41 @@ +// Copyright (c) 2024 Quetzal Rivera. +// Licensed under the MIT License, See LICENCE in the project root for license information. +//* This file is auto-generated. Don't edit it manually! + +namespace Telegram.BotAPI.Payments; + +/// +/// This object contains basic information about a refunded payment. +/// +public class RefundedPayment +{ + /// + /// Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR” + /// + [JsonPropertyName(PropertyNames.Currency)] + public string Currency { get; set; } = null!; + + /// + /// Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + /// + [JsonPropertyName(PropertyNames.TotalAmount)] + public int TotalAmount { get; set; } + + /// + /// Bot-specified invoice payload + /// + [JsonPropertyName(PropertyNames.InvoicePayload)] + public string InvoicePayload { get; set; } = null!; + + /// + /// Telegram payment identifier + /// + [JsonPropertyName(PropertyNames.TelegramPaymentChargeId)] + public string TelegramPaymentChargeId { get; set; } = null!; + + /// + /// Optional. Provider payment identifier + /// + [JsonPropertyName(PropertyNames.ProviderPaymentChargeId)] + public string? ProviderPaymentChargeId { get; set; } +} diff --git a/src/library/Telegram.BotAPI/PropertyNames.cs b/src/library/Telegram.BotAPI/PropertyNames.cs index c668b9c..473e04b 100644 --- a/src/library/Telegram.BotAPI/PropertyNames.cs +++ b/src/library/Telegram.BotAPI/PropertyNames.cs @@ -398,6 +398,7 @@ public static partial class PropertyNames public const string Reaction = "reaction"; public const string Reactions = "reactions"; public const string Receiver = "receiver"; + public const string RefundedPayment = "refunded_payment"; public const string RemoveCaption = "remove_caption"; public const string RemoveDate = "remove_date"; public const string RemoveKeyboard = "remove_keyboard"; diff --git a/src/library/Telegram.BotAPI/README.md b/src/library/Telegram.BotAPI/README.md index b94bb0e..840fa60 100644 --- a/src/library/Telegram.BotAPI/README.md +++ b/src/library/Telegram.BotAPI/README.md @@ -1,17 +1,17 @@ # Telegram.BotAPI -[![Compatible with Bot API v7.6](https://img.shields.io/badge/Bot%20API%20version-v7.6-blue?style=flat-square)](https://core.telegram.org/bots/api#july-1-2024) +[![Compatible with Bot API v7.7](https://img.shields.io/badge/Bot%20API%20version-v7.7-blue?style=flat-square)](https://core.telegram.org/bots/api#july-7-2024) **Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. Free and open source. -It contains all the methods and types available in the Bot API 7.6 released on July 1, 2024. +It contains all the methods and types available in the Bot API 7.7 released on July 7, 2024. --- ## Features -- Contains pre-defined methods for all Bot API 7.6 methods. -- Contains classes for each object type used in the Bot API 7.6. +- Contains pre-defined methods for all Bot API 7.7 methods. +- Contains classes for each object type used in the Bot API 7.7. - Sync and async methods. - Uses [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/). diff --git a/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj b/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj index 3b4466b..6e4cb3b 100644 --- a/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj +++ b/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 7.6 + 7.7 $(AssemblyName) Quetzal Rivera true @@ -10,7 +10,7 @@ Quetzal Rivera 2024 © en true - A very complete library to use Telegram Bot API in your NET project. Full support for Bot API v7.6 (July 1, 2024). + A very complete library to use Telegram Bot API in your NET project. Full support for Bot API v7.7 (July 7, 2024). - Contains all classes and methods available from the Bot API. Telegram;Bot;API @@ -25,7 +25,7 @@ https://github.com/Eptagone/Telegram.BotAPI Telegram.BotAPI - Updated to Bot API 7.6 + Updated to Bot API 7.7 true latest-recommended README.md