From 47fd589ea249c247cf7f4ddbd5d5f65a1aa77aa5 Mon Sep 17 00:00:00 2001 From: Akshett Rai Jindal Date: Wed, 21 Aug 2024 01:18:18 +0530 Subject: [PATCH] Add `BusinessOpeningHoursInterval` and `BusinessOpeningHours` structs --- crates/teloxide-core/src/types.rs | 2 ++ .../src/types/business_opening_hours.rs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 crates/teloxide-core/src/types/business_opening_hours.rs diff --git a/crates/teloxide-core/src/types.rs b/crates/teloxide-core/src/types.rs index c95847d3..2ad352a8 100644 --- a/crates/teloxide-core/src/types.rs +++ b/crates/teloxide-core/src/types.rs @@ -11,6 +11,7 @@ pub use bot_name::*; pub use bot_short_description::*; pub use business_intro::*; pub use business_location::*; +pub use business_opening_hours::*; pub use callback_game::*; pub use callback_query::*; pub use chat::*; @@ -168,6 +169,7 @@ mod bot_name; mod bot_short_description; mod business_intro; mod business_location; +mod business_opening_hours; mod callback_game; mod callback_query; mod chat; diff --git a/crates/teloxide-core/src/types/business_opening_hours.rs b/crates/teloxide-core/src/types/business_opening_hours.rs new file mode 100644 index 00000000..54e1a1e2 --- /dev/null +++ b/crates/teloxide-core/src/types/business_opening_hours.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BusinessOpeningHoursInterval { + /// The minute's sequence number in a week, starting on Monday, marking the + /// start of the time interval during which the business is open; + /// 0 - 7 * 24* 60 + pub opening_minute: u16, + + /// The minute's sequence number in a week, starting on Monday, marking the + /// end of the time interval during which the business is open; + /// 0 - 8 * 24* 60 + pub closing_minute: u16, +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BusinessOpeningHours { + /// Unique name of the time zone for which the opening hours are defined. + pub time_zone_name: String, + + /// List of time intervals describing business opening hours. + pub opening_hours: Vec, +}