mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Move deserialization prefix for giveaway_message_id
field to types module
because it will be used in `ChatBoostSourceGiveaway` later
This commit is contained in:
parent
1abf1fa519
commit
e5edaceb22
2 changed files with 6 additions and 4 deletions
|
@ -306,6 +306,11 @@ pub use recipient::*;
|
|||
pub use seconds::*;
|
||||
pub use user_id::*;
|
||||
|
||||
use serde_with::with_prefix;
|
||||
|
||||
// Deserialization prefix for giveaway_message_id field used in GiveawayWinners
|
||||
with_prefix!(prefix_giveaway_message_id "giveaway_");
|
||||
|
||||
/// Converts an `i64` timestamp to a `choro::DateTime`, producing serde error
|
||||
/// for invalid timestamps
|
||||
pub(crate) fn serde_timestamp<E: serde::de::Error>(
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::with_prefix;
|
||||
|
||||
use crate::types::{Chat, MessageId, User};
|
||||
|
||||
with_prefix!(prefix_giveaway "giveaway_");
|
||||
|
||||
/// This object represents a message about the completion of a giveaway with
|
||||
/// public winners.
|
||||
#[serde_with::skip_serializing_none]
|
||||
|
@ -15,7 +12,7 @@ pub struct GiveawayWinners {
|
|||
pub chat: Chat,
|
||||
|
||||
/// Identifier of the messsage with the giveaway in the chat
|
||||
#[serde(flatten, with = "prefix_giveaway")]
|
||||
#[serde(flatten, with = "crate::types::prefix_giveaway_message_id")]
|
||||
pub giveaway_message_id: MessageId,
|
||||
|
||||
/// Point in time (Unix timestamp) when winners of the giveaway were
|
||||
|
|
Loading…
Reference in a new issue