Add td_api::deleteBusinessChatLink.
This commit is contained in:
parent
1d77c95fb2
commit
9d95eb4a68
@ -9776,11 +9776,14 @@ getBusinessChatLinks = BusinessChatLinks;
|
||||
//@link_info Description of the link to create
|
||||
createBusinessChatLink link_info:inputBusinessChatLink = BusinessChatLink;
|
||||
|
||||
//@description Edits existing business chat link for the current account. Requires Telegram Business subscription. Returns the edited link
|
||||
//@description Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link
|
||||
//@link The link to edit
|
||||
//@link_info New description of the link
|
||||
editBusinessChatLink link:string link_info:inputBusinessChatLink = BusinessChatLink;
|
||||
|
||||
//@description Deletes a business chat link of the current account @link The link to delete
|
||||
deleteBusinessChatLink link:string = Ok;
|
||||
|
||||
|
||||
//@description Returns an HTTPS link, which can be used to get information about the current user
|
||||
getUserLink = UserLink;
|
||||
|
@ -280,6 +280,31 @@ class EditBusinessChatLinkQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteBusinessChatLinkQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit DeleteBusinessChatLinkQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const string &link) {
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_deleteBusinessChatLink(link), {{"me"}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::account_deleteBusinessChatLink>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateBusinessLocationQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
DialogLocation location_;
|
||||
@ -523,6 +548,10 @@ void BusinessManager::edit_business_chat_link(const string &link,
|
||||
->send(link, InputBusinessChatLink(td_, std::move(link_info)));
|
||||
}
|
||||
|
||||
void BusinessManager::delete_business_chat_link(const string &link, Promise<Unit> &&promise) {
|
||||
td_->create_handler<DeleteBusinessChatLinkQuery>(std::move(promise))->send(link);
|
||||
}
|
||||
|
||||
void BusinessManager::set_business_location(DialogLocation &&location, Promise<Unit> &&promise) {
|
||||
td_->create_handler<UpdateBusinessLocationQuery>(std::move(promise))->send(std::move(location));
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ class BusinessManager final : public Actor {
|
||||
void edit_business_chat_link(const string &link, td_api::object_ptr<td_api::inputBusinessChatLink> &&link_info,
|
||||
Promise<td_api::object_ptr<td_api::businessChatLink>> &&promise);
|
||||
|
||||
void delete_business_chat_link(const string &link, Promise<Unit> &&promise);
|
||||
|
||||
void set_business_location(DialogLocation &&location, Promise<Unit> &&promise);
|
||||
|
||||
void set_business_work_hours(BusinessWorkHours &&work_hours, Promise<Unit> &&promise);
|
||||
|
@ -8004,6 +8004,13 @@ void Td::on_request(uint64 id, td_api::editBusinessChatLink &request) {
|
||||
business_manager_->edit_business_chat_link(request.link_, std::move(request.link_info_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::deleteBusinessChatLink &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.link_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
business_manager_->delete_business_chat_link(request.link_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setSupergroupUsername &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.username_);
|
||||
|
@ -1449,6 +1449,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::editBusinessChatLink &request);
|
||||
|
||||
void on_request(uint64 id, td_api::deleteBusinessChatLink &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setSupergroupUsername &request);
|
||||
|
||||
void on_request(uint64 id, td_api::toggleSupergroupUsernameIsActive &request);
|
||||
|
@ -6184,6 +6184,8 @@ class CliClient final : public Actor {
|
||||
get_args(args, link, text, title);
|
||||
send_request(td_api::make_object<td_api::editBusinessChatLink>(
|
||||
link, td_api::make_object<td_api::inputBusinessChatLink>(as_formatted_text(text), title)));
|
||||
} else if (op == "dbcl") {
|
||||
send_request(td_api::make_object<td_api::deleteBusinessChatLink>(args));
|
||||
} else if (op == "gbc") {
|
||||
send_request(td_api::make_object<td_api::getBusinessConnection>(args.empty() ? business_connection_id_ : args));
|
||||
} else if (op == "sco") {
|
||||
|
Loading…
Reference in New Issue
Block a user