tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
BusinessOpeningHours.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
10 explicit BusinessOpeningHours(const nl::json& json) {
11 fromJson(json);
12 }
13
15 std::string timeZoneName;
16
18 std::vector<Ptr<BusinessOpeningHoursInterval>> openingHours;
19
20
23 nl::json toJson() const {
24 nl::json json = nl::json::object();
25 OBJECT_SERIALIZE_FIELD(json, "time_zone_name", timeZoneName);
26 OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "opening_hours", openingHours);
27 return json;
28 }
29
31 void fromJson(const nl::json& json) {
32 OBJECT_DESERIALIZE_FIELD(json, "time_zone_name", timeZoneName, "", false);
33 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "opening_hours", openingHours, false);
34 }
35 };
36}
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:27
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:46
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:89
Describes the opening hours of a business. https://core.telegram.org/bots/api#businessopeninghours.
std::string timeZoneName
Unique name of the time zone for which the opening hours are defined.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
BusinessOpeningHours(const nl::json &json)
std::vector< Ptr< BusinessOpeningHoursInterval > > openingHours
List of time intervals describing business opening hours.
nl::json toJson() const
Serializes this object to JSON.