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

Bot API 8.0 - Gifts #237

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

ayrat555
Copy link
Owner

@ayrat555 ayrat555 commented Dec 1, 2024

No description provided.

@ayrat555 ayrat555 requested a review from EdJoPaTo December 1, 2024 11:08
@ayrat555 ayrat555 requested a review from pxp9 December 1, 2024 11:57
Copy link
Collaborator

@pxp9 pxp9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, just some doubts if you can solve it, pretty cool

#[serde(tag = "type", rename_all = "snake_case")]
pub enum TransactionPartner {
User(TransactionPartnerUser),
User(Box<TransactionPartnerUser>),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to use a Box instead of an owned value ?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a warning from clippy that one of the variants is too large

src/objects.rs Show resolved Hide resolved
src/objects.rs Show resolved Hide resolved
@@ -2238,23 +2252,24 @@ pub struct RevenueWithdrawalStateSucceeded {
#[derive(Eq)]
pub struct RevenueWithdrawalStateFailed {}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it not using the api_struct macro?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's enum. this macro is not applicable for enums

pub gift_id: String,
pub text: Option<String>,
pub text_parse_mode: Option<ParseMode>,
pub text_entities: Option<Vec<MessageEntity>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is an empty Vec simpler than None?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to be loyal to the Telegram API spec.

https://core.telegram.org/bots/api#sendgift

According to the spec this parameter is optional.

If we use empty vec may be simpler but it will be telling the library user that this parameter is required which is not true.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question is will it be able to decode as empty list if the field is not provided. for now I will merge as Option. but @EdJoPaTo you're free to submit pr changng that

@ayrat555 ayrat555 merged commit 9bded7b into ayrat555/bot-api-0.8.0-4 Dec 3, 2024
57 of 58 checks passed
@ayrat555 ayrat555 deleted the ayrat555/bot-api-0.8.0-5 branch December 3, 2024 09:57
ayrat555 added a commit that referenced this pull request Dec 3, 2024
* Bot API 8.0 - Media Sharing and File Downloads

* Bot API 8.0 - Gifts (#237)
ayrat555 added a commit that referenced this pull request Dec 3, 2024
* Bot API 8.0 - Media Sharing and File Downloads (#236)

* Bot API 8.0 - Gifts (#237)
ayrat555 added a commit that referenced this pull request Dec 3, 2024
* Bot API 8.0 - Star Subscriptions

* editUserStarSubscription

* Bot API 8.0 - Emoji Status (#235)

* Bot API 8.0 - Media Sharing and File Downloads (#236)

* Bot API 8.0 - Gifts (#237)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants