Skip to content

Commit 20f621b

Browse files
Merge pull request #66 from RxTelegram/v8.1.0
Add support for api v8.1
2 parents fd00043 + 1e4de0c commit 20f621b

File tree

9 files changed

+76
-6
lines changed

9 files changed

+76
-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 8.0 (as at November 17, 2024).
8+
RxTelegram.Bot supports Telegram Bot API 8.1 (as at December 4, 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

src/RxTelegram.Bot/Interface/BaseTypes/Enums/TransactionPartnerType.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ public enum TransactionPartnerType
1515
[ImplementationType(typeof(TransactionPartnerTelegramAds))]
1616
TelegramAds,
1717

18-
1918
[ImplementationType(typeof(TransactionPartnerOther))]
2019
Other,
2120

2221
[ImplementationType(typeof(TransactionPartnerTelegramApi))]
23-
TelegramApi
22+
TelegramApi,
23+
24+
[ImplementationType(typeof(TransactionPartnerAffiliateProgram))]
25+
AffiliateProgram
2426
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using RxTelegram.Bot.Interface.BaseTypes;
2+
3+
namespace RxTelegram.Bot.Interface.Payments;
4+
5+
/// <summary>
6+
/// Contains information about the affiliate that received a commission via this transaction.
7+
/// </summary>
8+
public class AffiliateInfo
9+
{
10+
/// <summary>
11+
/// Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user
12+
/// </summary>
13+
public User AffiliateUser { get; set; }
14+
15+
/// <summary>
16+
/// Optional. The chat that received an affiliate commission if it was received by a chat
17+
/// </summary>
18+
public Chat AffiliateChat { get; set; }
19+
20+
/// <summary>
21+
/// The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users
22+
/// </summary>
23+
public int CommissionPerMille { get; set; }
24+
25+
/// <summary>
26+
/// Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0;
27+
/// can be negative for refunds
28+
/// </summary>
29+
public int Amount { get; set; }
30+
31+
/// <summary>
32+
/// Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999;
33+
/// can be negative for refunds
34+
/// </summary>
35+
public int? NanostarAmount { get; set; }
36+
}

src/RxTelegram.Bot/Interface/Payments/StarTransaction.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public class StarTransaction
1616
/// </summary>
1717
public int Amount { get; set; }
1818

19+
/// <summary>
20+
/// Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999
21+
/// </summary>
22+
public int? NanostarAmount { get; set; }
23+
1924
/// <summary>
2025
/// Date the transaction was created in Unix time
2126
/// </summary>
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 the affiliate program that issued the affiliate commission received via this transaction.
8+
/// </summary>
9+
public class TransactionPartnerAffiliateProgram : TransactionPartner
10+
{
11+
/// <summary>
12+
/// Type of the transaction partner, always “affiliate_program”
13+
/// </summary>
14+
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.AffiliateProgram;
15+
16+
/// <summary>
17+
/// Optional. Information about the bot that sponsored the affiliate program
18+
/// </summary>
19+
public User SponsorUser { get; set; }
20+
21+
/// <summary>
22+
/// The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users
23+
/// </summary>
24+
public int CommissionPerMille { get; set; }
25+
}

src/RxTelegram.Bot/Interface/Payments/TransactionPartnerOther.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public class TransactionPartnerOther : TransactionPartner
1010
/// <summary>
1111
/// Type of the transaction partner, always “other”
1212
/// </summary>
13-
public override TransactionPartnerType Type { get; set; }
13+
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.Other;
1414
}

src/RxTelegram.Bot/Interface/Payments/TransactionPartnerTelegramAds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public class TransactionPartnerTelegramAds : TransactionPartner
1010
/// <summary>
1111
/// Type of the transaction partner, always “telegram_ads”
1212
/// </summary>
13-
public override TransactionPartnerType Type { get; set; }
13+
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.TelegramAds;
1414
}

src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class TransactionPartnerUser : TransactionPartner
2020
/// </summary>
2121
public User User { get; set; }
2222

23+
public AffiliateInfo Affiliate { get; set; }
24+
2325
/// <summary>
2426
/// Optional. Bot-specified invoice payload
2527
/// </summary>

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>8.0.0</PackageVersion>
13+
<PackageVersion>8.1.0</PackageVersion>
1414
<PackageIcon>icon.png</PackageIcon>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1616
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>

0 commit comments

Comments
 (0)