Rename work hours to opening hours.

This commit is contained in:
levlam 2024-02-27 16:03:34 +03:00
parent 50ba48fbfa
commit 7b257b4def
8 changed files with 41 additions and 41 deletions

View File

@ -581,8 +581,8 @@ chatLocation location:location address:string = ChatLocation;
//@description Send away messages if the account was online more than 10 minutes
businessAwayMessageScheduleOffline = BusinessAwayMessageSchedule;
//@description Send away messages outside of the business work hours
businessAwayMessageScheduleOutsideOfWorkHours = BusinessAwayMessageSchedule;
//@description Send away messages outside of the business opening hours
businessAwayMessageScheduleOutsideOfOpeningHours = BusinessAwayMessageSchedule;
//@description Send away messages only in the specified time span
//@start_date Point in time (Unix timestamp) when the away messages will start to be sent
@ -617,17 +617,17 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients
//@description Describes an interval of time when the business is open
//@start_minute The first minute of the interval since start of the week; 0-7*24*60
//@end_minute The first minute after the end of the interval since start of the week; 1-8*24*60
businessWorkHoursInterval start_minute:int32 end_minute:int32 = BusinessWorkHoursInterval;
businessOpeningHoursInterval start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval;
//@description Describes work hours of a business @time_zone_id Unique time zone identifier @work_hours Intervals of the time when the business is open
businessWorkHours time_zone_id:string work_hours:vector<businessWorkHoursInterval> = BusinessWorkHours;
//@description Describes opening hours of a business @time_zone_id Unique time zone identifier @opening_hours Intervals of the time when the business is open
businessOpeningHours time_zone_id:string opening_hours:vector<businessOpeningHoursInterval> = BusinessOpeningHours;
//@description Contains information about a Telegram Business account
//@location Location of the business; may be null if none
//@work_hours Work hours of the business; may be null if none
//@opening_hours Opening hours of the business; may be null if none
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
businessInfo location:businessLocation work_hours:businessWorkHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
@ -9350,8 +9350,8 @@ setLocation location:location = Ok;
//@description Changes the business location of the current user. Requires Telegram Business subscription @location The new location of the business; pass null to remove the location
setBusinessLocation location:businessLocation = Ok;
//@description Changes the business work hours of the current user. Requires Telegram Business subscription @work_hours The new work hours of the business; pass null to remove the work hours
setBusinessWorkHours work_hours:businessWorkHours = Ok;
//@description Changes the business opening hours of the current user. Requires Telegram Business subscription @opening_hours The new opening hours of the business; pass null to remove the opening hours
setBusinessOpeningHours opening_hours:businessOpeningHours = Ok;
//@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription @greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message
setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMessageSettings = Ok;

View File

@ -39,7 +39,7 @@ BusinessAwayMessageSchedule::BusinessAwayMessageSchedule(
case td_api::businessAwayMessageScheduleOffline::ID:
type_ = Type::Offline;
break;
case td_api::businessAwayMessageScheduleOutsideOfWorkHours::ID:
case td_api::businessAwayMessageScheduleOutsideOfOpeningHours::ID:
type_ = Type::OutsideOfWorkHours;
break;
case td_api::businessAwayMessageScheduleCustom::ID: {
@ -60,7 +60,7 @@ BusinessAwayMessageSchedule::get_business_away_message_schedule_object() const {
case Type::Offline:
return td_api::make_object<td_api::businessAwayMessageScheduleOffline>();
case Type::OutsideOfWorkHours:
return td_api::make_object<td_api::businessAwayMessageScheduleOutsideOfWorkHours>();
return td_api::make_object<td_api::businessAwayMessageScheduleOutsideOfOpeningHours>();
case Type::Custom:
return td_api::make_object<td_api::businessAwayMessageScheduleCustom>(start_date_, end_date_);
default:

View File

@ -10,7 +10,7 @@ namespace td {
td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(Td *td) const {
return td_api::make_object<td_api::businessInfo>(location_.get_business_location_object(),
work_hours_.get_business_work_hours_object(),
work_hours_.get_business_opening_hours_object(),
greeting_message_.get_business_greeting_message_settings_object(td),
away_message_.get_business_away_message_settings_object(td));
}

View File

@ -11,9 +11,9 @@
namespace td {
td_api::object_ptr<td_api::businessWorkHoursInterval>
BusinessWorkHours::WorkHoursInterval::get_business_work_hours_interval_object() const {
return td_api::make_object<td_api::businessWorkHoursInterval>(start_minute_, end_minute_);
td_api::object_ptr<td_api::businessOpeningHoursInterval>
BusinessWorkHours::WorkHoursInterval::get_business_opening_hours_interval_object() const {
return td_api::make_object<td_api::businessOpeningHoursInterval>(start_minute_, end_minute_);
}
telegram_api::object_ptr<telegram_api::businessWeeklyOpen>
@ -31,12 +31,12 @@ BusinessWorkHours::BusinessWorkHours(telegram_api::object_ptr<telegram_api::busi
}
}
BusinessWorkHours::BusinessWorkHours(td_api::object_ptr<td_api::businessWorkHours> &&work_hours) {
BusinessWorkHours::BusinessWorkHours(td_api::object_ptr<td_api::businessOpeningHours> &&work_hours) {
if (work_hours != nullptr) {
work_hours_ =
transform(work_hours->work_hours_, [](const td_api::object_ptr<td_api::businessWorkHoursInterval> &interval) {
return WorkHoursInterval(interval->start_minute_, interval->end_minute_);
});
work_hours_ = transform(work_hours->opening_hours_,
[](const td_api::object_ptr<td_api::businessOpeningHoursInterval> &interval) {
return WorkHoursInterval(interval->start_minute_, interval->end_minute_);
});
time_zone_id_ = std::move(work_hours->time_zone_id_);
}
}
@ -45,14 +45,14 @@ bool BusinessWorkHours::is_empty() const {
return work_hours_.empty();
}
td_api::object_ptr<td_api::businessWorkHours> BusinessWorkHours::get_business_work_hours_object() const {
td_api::object_ptr<td_api::businessOpeningHours> BusinessWorkHours::get_business_opening_hours_object() const {
if (is_empty()) {
return nullptr;
}
return td_api::make_object<td_api::businessWorkHours>(time_zone_id_,
transform(work_hours_, [](const WorkHoursInterval &interval) {
return interval.get_business_work_hours_interval_object();
}));
return td_api::make_object<td_api::businessOpeningHours>(
time_zone_id_, transform(work_hours_, [](const WorkHoursInterval &interval) {
return interval.get_business_opening_hours_interval_object();
}));
}
telegram_api::object_ptr<telegram_api::businessWorkHours> BusinessWorkHours::get_input_business_work_hours() const {

View File

@ -22,11 +22,11 @@ class BusinessWorkHours {
explicit BusinessWorkHours(telegram_api::object_ptr<telegram_api::businessWorkHours> &&work_hours);
explicit BusinessWorkHours(td_api::object_ptr<td_api::businessWorkHours> &&work_hours);
explicit BusinessWorkHours(td_api::object_ptr<td_api::businessOpeningHours> &&work_hours);
bool is_empty() const;
td_api::object_ptr<td_api::businessWorkHours> get_business_work_hours_object() const;
td_api::object_ptr<td_api::businessOpeningHours> get_business_opening_hours_object() const;
telegram_api::object_ptr<telegram_api::businessWorkHours> get_input_business_work_hours() const;
@ -45,7 +45,7 @@ class BusinessWorkHours {
WorkHoursInterval(int32 start_minute, int32 end_minute) : start_minute_(start_minute), end_minute_(end_minute) {
}
td_api::object_ptr<td_api::businessWorkHoursInterval> get_business_work_hours_interval_object() const;
td_api::object_ptr<td_api::businessOpeningHoursInterval> get_business_opening_hours_interval_object() const;
telegram_api::object_ptr<telegram_api::businessWeeklyOpen> get_input_business_weekly_open() const;

View File

@ -7773,10 +7773,10 @@ void Td::on_request(uint64 id, td_api::setBusinessLocation &request) {
contacts_manager_->set_business_location(DialogLocation(std::move(request.location_)), std::move(promise));
}
void Td::on_request(uint64 id, td_api::setBusinessWorkHours &request) {
void Td::on_request(uint64 id, td_api::setBusinessOpeningHours &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->set_business_work_hours(BusinessWorkHours(std::move(request.work_hours_)), std::move(promise));
contacts_manager_->set_business_work_hours(BusinessWorkHours(std::move(request.opening_hours_)), std::move(promise));
}
void Td::on_request(uint64 id, td_api::setBusinessGreetingMessageSettings &request) {

View File

@ -1378,7 +1378,7 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::setBusinessLocation &request);
void on_request(uint64 id, td_api::setBusinessWorkHours &request);
void on_request(uint64 id, td_api::setBusinessOpeningHours &request);
void on_request(uint64 id, td_api::setBusinessGreetingMessageSettings &request);

View File

@ -5921,23 +5921,23 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::setBusinessLocation>(td_api::make_object<td_api::businessLocation>(
longitude.empty() ? nullptr : as_location(latitude, longitude, string()), "business address")));
}
} else if (op == "sbwh") {
} else if (op == "sboh") {
string time_zone_id;
string work_hours;
get_args(args, time_zone_id, work_hours);
string opening_hours;
get_args(args, time_zone_id, opening_hours);
if (time_zone_id.empty()) {
send_request(td_api::make_object<td_api::setBusinessWorkHours>(nullptr));
send_request(td_api::make_object<td_api::setBusinessOpeningHours>(nullptr));
} else {
auto minutes = to_integers<int32>(work_hours);
auto minutes = to_integers<int32>(opening_hours);
if (minutes.size() % 2 == 1) {
minutes.push_back(8 * 24 * 60);
}
vector<td_api::object_ptr<td_api::businessWorkHoursInterval>> intervals;
vector<td_api::object_ptr<td_api::businessOpeningHoursInterval>> intervals;
for (size_t i = 0; i < minutes.size(); i += 2) {
intervals.push_back(td_api::make_object<td_api::businessWorkHoursInterval>(minutes[i], minutes[i + 1]));
intervals.push_back(td_api::make_object<td_api::businessOpeningHoursInterval>(minutes[i], minutes[i + 1]));
}
send_request(td_api::make_object<td_api::setBusinessWorkHours>(
td_api::make_object<td_api::businessWorkHours>(time_zone_id, std::move(intervals))));
send_request(td_api::make_object<td_api::setBusinessOpeningHours>(
td_api::make_object<td_api::businessOpeningHours>(time_zone_id, std::move(intervals))));
}
} else if (op == "sbgms") {
string shortcut_id;
@ -5966,7 +5966,7 @@ class CliClient final : public Actor {
if (schedule[0] == 'o') {
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleOffline>();
} else if (schedule[0] == 'h') {
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleOutsideOfWorkHours>();
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleOutsideOfOpeningHours>();
} else {
auto start_date = to_integer<int32>(schedule);
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleCustom>(