Skip to content

Commit 5c2d91e

Browse files
Merge pull request #48 from RxTelegram/v7.5
Add support for v7.5
2 parents bbeb070 + 7fbc9d9 commit 5c2d91e

25 files changed

+300
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
77

8-
RxTelegram.Bot supports Telegram Bot API 7.4 (as at May 28, 2024).
8+
RxTelegram.Bot supports Telegram Bot API 7.5 (as at June 18, 2024).
99

1010
This is a reactive designed .NET Library for the Telegram Bot API. It works with the official [Reactive Extentions](https://github.com/dotnet/reactive).
1111

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using RxTelegram.Bot.Interface.Payments;
2+
using RxTelegram.Bot.Utils.MultiType;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.Enums;
5+
6+
public enum RevenueWithdrawalStateType
7+
{
8+
[ImplementationType(typeof(RevenueWithdrawalStatePending))]
9+
Pending,
10+
11+
[ImplementationType(typeof(RevenueWithdrawalStateSucceeded))]
12+
Succeeded,
13+
14+
[ImplementationType(typeof(RevenueWithdrawalStateFailed))]
15+
Failed
16+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using RxTelegram.Bot.Interface.Payments;
2+
using RxTelegram.Bot.Utils.MultiType;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.Enums;
5+
6+
public enum TransactionPartnerType
7+
{
8+
[ImplementationType(typeof(TransactionPartnerUser))]
9+
User,
10+
11+
[ImplementationType(typeof(TransactionPartnerFragment))]
12+
Fragment,
13+
14+
15+
[ImplementationType(typeof(TransactionPartnerTelegramAds))]
16+
TelegramAds,
17+
18+
19+
[ImplementationType(typeof(TransactionPartnerOther))]
20+
Other
21+
}

src/RxTelegram.Bot/Interface/BaseTypes/InlineKeyboardButton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ public class InlineKeyboardButton
6868
/// NOTE: This type of button must always be the first button in the first row.
6969
/// </summary>
7070
public bool Pay { get; set; }
71-
}
71+
}

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/EditMessageLiveLocation.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
1010
/// </summary>
1111
public class EditMessageLiveLocation : BaseRequest
1212
{
13+
/// <summary>
14+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
15+
/// </summary>
16+
public string BusinessConnectionId { get; set; }
17+
1318
/// <summary>
1419
/// Required if inline_message_id is not specified. Identifier of the message to edit
1520
/// </summary>

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/StopMessageLiveLocation.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
99
/// </summary>
1010
public class StopMessageLiveLocation : BaseRequest
1111
{
12+
/// <summary>
13+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
14+
/// </summary>
15+
public string BusinessConnectionId { get; set; }
16+
1217
/// <summary>
1318
/// Required if inline_message_id is not specified. Identifier of the message with live location to stop
1419
/// </summary>
@@ -25,4 +30,4 @@ public class StopMessageLiveLocation : BaseRequest
2530
public InlineKeyboardMarkup ReplyMarkup { get; set; }
2631

2732
protected override IValidationResult Validate() => this.CreateValidation();
28-
}
33+
}

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageCaption.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
1010
/// </summary>
1111
public class EditMessageCaption : BaseTextRequest
1212
{
13+
/// <summary>
14+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
15+
/// </summary>
16+
public string BusinessConnectionId { get; set; }
17+
1318
/// <summary>
1419
/// Required if inline_message_id is not specified. Identifier of the message to edit
1520
/// </summary>

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageMedia.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
1212
/// </summary>
1313
public class EditMessageMedia : BaseRequest
1414
{
15+
/// <summary>
16+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
17+
/// </summary>
18+
public string BusinessConnectionId { get; set; }
19+
1520
/// <summary>
1621
/// Required if inline_message_id is not specified. Identifier of the message to edit
1722
/// </summary>
@@ -33,4 +38,4 @@ public class EditMessageMedia : BaseRequest
3338
public InlineKeyboardMarkup ReplyMarkup { get; set; }
3439

3540
protected override IValidationResult Validate() => this.CreateValidation();
36-
}
41+
}

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageReplyMarkup.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
99
/// </summary>
1010
public class EditMessageReplyMarkup : BaseRequest
1111
{
12+
/// <summary>
13+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
14+
/// </summary>
15+
public string BusinessConnectionId { get; set; }
16+
1217
/// <summary>
1318
/// Required if inline_message_id is not specified. Identifier of the message to edit
1419
/// </summary>
@@ -25,4 +30,4 @@ public class EditMessageReplyMarkup : BaseRequest
2530
public InlineKeyboardMarkup ReplyMarkup { get; set; }
2631

2732
protected override IValidationResult Validate() => this.CreateValidation();
28-
}
33+
}

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageText.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
1010
/// </summary>
1111
public class EditMessageText : BaseTextRequest
1212
{
13+
/// <summary>
14+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
15+
/// </summary>
16+
public string BusinessConnectionId { get; set; }
17+
1318
/// <summary>
1419
/// Optional
1520
/// Required if inline_message_id is not specified. Identifier of the message to edit

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/StopPoll.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
88
/// </summary>
99
public class StopPoll : BaseRequest
1010
{
11+
/// <summary>
12+
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
13+
/// </summary>
14+
public string BusinessConnectionId { get; set; }
15+
1116
/// <summary>
1217
/// Required
1318
/// Identifier of the original message with the poll
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace RxTelegram.Bot.Interface.Payments.Requests;
2+
3+
/// <summary>
4+
/// Returns the bot's Telegram Star transactions in chronological order.
5+
/// On success, returns a <see cref="StarTransactions"/> StarTransactions object.
6+
/// </summary>
7+
public class GetStarTransactions
8+
{
9+
/// <summary>
10+
/// Number of transactions to skip in the response
11+
/// </summary>
12+
public int? Offset { get; set; }
13+
14+
/// <summary>
15+
/// The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
16+
/// </summary>
17+
public int? Limit { get; set; }
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
using RxTelegram.Bot.Utils.MultiType;
3+
4+
namespace RxTelegram.Bot.Interface.Payments;
5+
6+
7+
public abstract class RevenueWithdrawalState : IMultiTypeClassByType<RevenueWithdrawalStateType>
8+
{
9+
public abstract RevenueWithdrawalStateType Type { get; set; }
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// The withdrawal failed and the transaction was refunded.
7+
/// </summary>
8+
public class RevenueWithdrawalStateFailed: RevenueWithdrawalState
9+
{
10+
/// <summary>
11+
/// Type of the state, always “failed”
12+
/// </summary>
13+
public override RevenueWithdrawalStateType Type { get; set; } = RevenueWithdrawalStateType.Failed;
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// The withdrawal is in progress.
7+
/// </summary>
8+
public class RevenueWithdrawalStatePending : RevenueWithdrawalState
9+
{
10+
/// <summary>
11+
/// Type of the state, always “pending”
12+
/// </summary>
13+
public override RevenueWithdrawalStateType Type { get; set; } = RevenueWithdrawalStateType.Pending;
14+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
3+
4+
namespace RxTelegram.Bot.Interface.Payments;
5+
6+
/// <summary>
7+
/// The withdrawal succeeded.
8+
/// </summary>
9+
public class RevenueWithdrawalStateSucceeded: RevenueWithdrawalState
10+
{
11+
/// <summary>
12+
/// Type of the state, always “succeeded”
13+
/// </summary>
14+
public override RevenueWithdrawalStateType Type { get; set; } = RevenueWithdrawalStateType.Succeeded;
15+
16+
/// <summary>
17+
/// Date the withdrawal was completed in Unix time
18+
/// </summary>
19+
public DateTime Date { get; set; }
20+
21+
/// <summary>
22+
/// An HTTPS URL that can be used to see transaction details
23+
/// </summary>
24+
public string Url { get; set; }
25+
26+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace RxTelegram.Bot.Interface.Payments;
2+
3+
/// <summary>
4+
/// Describes a Telegram Star transaction.
5+
/// </summary>
6+
public class StarTransaction
7+
{
8+
/// <summary>
9+
/// Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions.
10+
/// Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.
11+
/// </summary>
12+
public string Id { get; set; }
13+
14+
/// <summary>
15+
/// Number of Telegram Stars transferred by the transaction
16+
/// </summary>
17+
public int Amount { get; set; }
18+
19+
/// <summary>
20+
/// Date the transaction was created in Unix time
21+
/// </summary>
22+
public int Date { get; set; }
23+
24+
/// <summary>
25+
/// Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal).
26+
/// Only for incoming transactions
27+
/// </summary>
28+
public TransactionPartner Source { get; set; }
29+
30+
/// <summary>
31+
/// Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal).
32+
/// Only for outgoing transactions
33+
/// </summary>
34+
public TransactionPartner Receiver { get; set; }
35+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections.Generic;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// Contains a list of Telegram Star transactions.
7+
/// </summary>
8+
public class StarTransactions
9+
{
10+
/// <summary>
11+
/// The list of transactions
12+
/// </summary>
13+
public List<StarTransaction> Transactions { get; set; }
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
using RxTelegram.Bot.Utils.MultiType;
3+
4+
namespace RxTelegram.Bot.Interface.Payments;
5+
6+
public abstract class TransactionPartner: IMultiTypeClassByType<TransactionPartnerType>
7+
{
8+
public abstract TransactionPartnerType Type { get; set; }
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// Describes a withdrawal transaction with Fragment.
7+
/// </summary>
8+
public class TransactionPartnerFragment : TransactionPartner
9+
{
10+
/// <summary>
11+
/// Type of the transaction partner, always “fragment”
12+
/// </summary>
13+
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.Fragment;
14+
15+
/// <summary>
16+
/// Optional. State of the transaction if the transaction is outgoing
17+
/// </summary>
18+
public RevenueWithdrawalState WithdrawalState { get; set; }
19+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// Describes a transaction with an unknown source or recipient.
7+
/// </summary>
8+
public class TransactionPartnerOther : TransactionPartner
9+
{
10+
/// <summary>
11+
/// Type of the transaction partner, always “other”
12+
/// </summary>
13+
public override TransactionPartnerType Type { get; set; }
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// Describes a withdrawal transaction to the Telegram Ads platform.
7+
/// </summary>
8+
public class TransactionPartnerTelegramAds : TransactionPartner
9+
{
10+
/// <summary>
11+
/// Type of the transaction partner, always “telegram_ads”
12+
/// </summary>
13+
public override TransactionPartnerType Type { get; set; }
14+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using RxTelegram.Bot.Interface.BaseTypes;
2+
using RxTelegram.Bot.Interface.BaseTypes.Enums;
3+
4+
namespace RxTelegram.Bot.Interface.Payments;
5+
6+
/// <summary>
7+
/// Describes a transaction with a user.
8+
/// </summary>
9+
public class TransactionPartnerUser : TransactionPartner
10+
{
11+
/// <summary>
12+
/// Type of the transaction partner, always “user”
13+
/// </summary>
14+
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.User;
15+
16+
/// <summary>
17+
/// Information about the user
18+
/// </summary>
19+
public User User { get; set; }
20+
21+
/// <summary>
22+
/// Optional. Bot-specified invoice payload
23+
/// </summary>
24+
public string InvoicePayload { get; set; }
25+
}

src/RxTelegram.Bot/RxTelegram.Bot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<RepositoryUrl>https://github.com/RxTelegram/RxTelegram.Bot</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
1212
<PackageTags>Telegram;Bot;Api;Rx;Reactive;Observable;RxTelegram;RxTelegram.Bot</PackageTags>
13-
<PackageVersion>7.4.0</PackageVersion>
13+
<PackageVersion>7.5.0</PackageVersion>
1414
<PackageIcon>icon.png</PackageIcon>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1616
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>

0 commit comments

Comments
 (0)