Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for api v8.0 #63

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Build
run: dotnet build --configuration Release
test:
Expand All @@ -24,6 +30,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Test
run: dotnet test --configuration Release
sonarqube:
Expand All @@ -39,6 +51,12 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Build
run: dotnet build --configuration Release
test:
Expand All @@ -18,6 +24,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Test
run: dotnet test --configuration Release
sonarqube:
Expand All @@ -33,6 +45,12 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet '8.0.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using RxTelegram.Bot.Interface.InlineMode.InlineQueryResults;
using RxTelegram.Bot.Interface.Validation;
using RxTelegram.Bot.Validation;

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Inline;

/// <summary>
/// Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
/// </summary>
public class SavePreparedInlineMessage : BaseValidation
{
/// <summary>
/// Unique identifier of the target user that can use the prepared message
/// </summary>
public long UserId { get; set; }

/// <summary>
/// A JSON-serialized object describing the message to be sent
/// </summary>
public BaseInlineQueryResult Result { get; set; }

/// <summary>
/// Pass True if the message can be sent to private chats with users
/// </summary>
public bool AllowUserChats { get; set; }

/// <summary>
/// Pass True if the message can be sent to private chats with bots
/// </summary>
public bool AllowBotChats { get; set; }

/// <summary>
/// Pass True if the message can be sent to group and supergroup chats
/// </summary>
public bool AllowGroupChats { get; set; }

/// <summary>
/// Pass True if the message can be sent to channel chats
/// </summary>
public bool AllowChannelChats { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using RxTelegram.Bot.Interface.Validation;
using RxTelegram.Bot.Validation;

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Users;

/// <summary>
/// Changes the emoji status for a given user that previously allowed the bot to manage their
/// emoji status via the Mini App method <see cref="TelegramBot.RequestEmojiStatusAccess"/> . Returns True on success.

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / test

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / test

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved

Check warning on line 8 in src/RxTelegram.Bot/Interface/BaseTypes/Requests/Users/SetUserEmojiStatus.cs

View workflow job for this annotation

GitHub Actions / sonarqube

XML comment has cref attribute 'RequestEmojiStatusAccess' that could not be resolved
/// </summary>
public class SetUserEmojiStatus : BaseValidation
{
/// <summary>
/// Unique identifier of the target user
/// </summary>
public long UserId { get; set; }

/// <summary>
/// Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
/// </summary>
public string EmojiStatusCustomEmojiId { get; set; }

/// <summary>
/// Expiration date of the emoji status, if any
/// </summary>
public int EmojiStatusExpirationDate { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public class BotCommandScopeChatMember : BotCommandScopeBase
/// <summary>
/// Unique identifier of the target user
/// </summary>
public int UserId { get; set; }
public long UserId { get; set; }
}
17 changes: 17 additions & 0 deletions src/RxTelegram.Bot/Interface/InlineMode/PreparedInlineMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace RxTelegram.Bot.Interface.InlineMode;

/// <summary>
/// Describes an inline message to be sent by a user of a Mini App.
/// </summary>
public class PreparedInlineMessage
{
/// <summary>
/// Unique identifier of the prepared message
/// </summary>
public string Id { get; set; }

/// <summary>
/// Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used
/// </summary>
public int ExpirationDate { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ namespace RxTelegram.Bot.Interface.Payments.Requests;
/// </summary>
public class CreateInvoiceLink : BaseValidation
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the link will be created.
/// For payments in Telegram Stars only.
/// </summary>
public string BusinessConnectionId { get; set; }

/// <summary>
/// Product name, 1-32 characters
/// </summary>
Expand Down Expand Up @@ -40,6 +46,16 @@ public class CreateInvoiceLink : BaseValidation
/// </summary>
public List<LabeledPrice> Prices { get; set; }

/// <summary>
/// The number of seconds the subscription will be active for before the next payment.
/// The currency must be set to “XTR” (Telegram Stars) if the parameter is used.
/// Currently, it must always be 2592000 (30 days) if specified.
/// Any number of subscriptions can be active for a given bot at the same time,
/// including multiple concurrent subscriptions from the same user.
/// Subscription price must not exceed 2500 Telegram Stars.
/// </summary>
public int SubscriptionPeriod { get; set; }

/// <summary>
/// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double).
/// <example>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using RxTelegram.Bot.Interface.Validation;
using RxTelegram.Bot.Validation;

namespace RxTelegram.Bot.Interface.Payments.Requests;

/// <summary>
/// Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
/// </summary>
public class EditUserStarSubscription : BaseValidation
{
/// <summary>
/// Identifier of the user whose subscription will be edited
/// </summary>
public long UserId { get; set; }

/// <summary>
/// Telegram payment identifier for the subscription
/// </summary>
public string TelegramPaymentChargeId { get; set; }

/// <summary>
/// Pass True to cancel extension of the user subscription;
/// the subscription must be active up to the end of the current subscription period.
/// Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
/// </summary>
public bool IsCanceled { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using RxTelegram.Bot.Interface.Validation;
using RxTelegram.Bot.Validation;

namespace RxTelegram.Bot.Interface.Payments.Requests;

/// <summary>
/// Returns the bot's Telegram Star transactions in chronological order.
/// On success, returns a <see cref="StarTransactions"/> StarTransactions object.
/// </summary>
public class GetStarTransactions
public class GetStarTransactions : BaseValidation
{
/// <summary>
/// Number of transactions to skip in the response
Expand All @@ -15,4 +18,6 @@ public class GetStarTransactions
/// The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
/// </summary>
public int? Limit { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
17 changes: 16 additions & 1 deletion src/RxTelegram.Bot/Interface/Payments/SuccessfulPayment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ public class SuccessfulPayment
/// </summary>
public string InvoicePayload { get; set; }

/// <summary>
/// Optional. Expiration date of the subscription, in Unix time; for recurring payments only
/// </summary>
public int SubscriptionExpirationDate { get; set; }

/// <summary>
/// Optional. True, if the payment is a recurring payment for a subscription
/// </summary>
public bool IsRecurring { get; set; }

/// <summary>
/// Optional. True, if the payment is the first payment for a subscription
/// </summary>
public bool IsFirstRecurring { get; set; }

/// <summary>
/// Optional. Identifier of the shipping option chosen by the user
/// </summary>
Expand All @@ -43,4 +58,4 @@ public class SuccessfulPayment
/// Provider payment identifier
/// </summary>
public string ProviderPaymentChargeId { get; set; }
}
}
11 changes: 11 additions & 0 deletions src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using RxTelegram.Bot.Interface.BaseTypes;
using RxTelegram.Bot.Interface.BaseTypes.Enums;
using RxTelegram.Bot.Interface.Stickers;

namespace RxTelegram.Bot.Interface.Payments;

Expand All @@ -24,6 +25,11 @@ public class TransactionPartnerUser : TransactionPartner
/// </summary>
public string InvoicePayload { get; set; }

/// <summary>
/// Optional. The duration of the paid subscription
/// </summary>
public int? SubscriptionPeriod { get; set; }

/// <summary>
/// Optional. Information about the paid media bought by the user
/// </summary>
Expand All @@ -33,4 +39,9 @@ public class TransactionPartnerUser : TransactionPartner
/// Optional. Bot-specified paid media payload
/// </summary>
public string PaidMediaPayload { get; set; }

/// <summary>
/// Optional. The gift sent to the user by the bot
/// </summary>
public Gift Gift { get; set; }
}
32 changes: 32 additions & 0 deletions src/RxTelegram.Bot/Interface/Stickers/Gift.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace RxTelegram.Bot.Interface.Stickers;

/// <summary>
/// This object represents a gift that can be sent by the bot.
/// </summary>
public class Gift
{
/// <summary>
/// Unique identifier of the gift
/// </summary>
public string Id { get; set; }

/// <summary>
/// The sticker that represents the gift
/// </summary>
public Sticker Sticker { get; set; }

/// <summary>
/// The number of Telegram Stars that must be paid to send the sticker
/// </summary>
public int StarCount { get; set; }

/// <summary>
/// Optional. The total number of the gifts of this type that can be sent; for limited gifts only
/// </summary>
public int TotalCount { get; set; }

/// <summary>
/// Optional. The number of remaining gifts of this type that can be sent; for limited gifts only
/// </summary>
public int RemainingCount { get; set; }
}
11 changes: 11 additions & 0 deletions src/RxTelegram.Bot/Interface/Stickers/Gifts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace RxTelegram.Bot.Interface.Stickers;

/// <summary>
/// This object represent a list of gifts.
/// </summary>
public class GiftsObject
{
public List<Gift> Gifts { get; set; }
}
Loading
Loading