Add td_api::getBusinessChatLinks.
This commit is contained in:
parent
de881cce99
commit
c4b42c2678
@ -9764,6 +9764,10 @@ toggleBusinessConnectedBotChatIsPaused chat_id:int53 is_paused:Bool = Ok;
|
||||
removeBusinessConnectedBotFromChat chat_id:int53 = Ok;
|
||||
|
||||
|
||||
//@description Returns business chat links created for the current account
|
||||
getBusinessChatLinks = BusinessChatLinks;
|
||||
|
||||
|
||||
//@description Returns an HTTPS link, which can be used to get information about the current user
|
||||
getUserLink = UserLink;
|
||||
|
||||
|
@ -8,11 +8,13 @@
|
||||
|
||||
#include "td/telegram/AccessRights.h"
|
||||
#include "td/telegram/BusinessAwayMessage.h"
|
||||
#include "td/telegram/BusinessChatLink.h"
|
||||
#include "td/telegram/BusinessConnectedBot.h"
|
||||
#include "td/telegram/BusinessGreetingMessage.h"
|
||||
#include "td/telegram/BusinessIntro.h"
|
||||
#include "td/telegram/BusinessRecipients.h"
|
||||
#include "td/telegram/BusinessWorkHours.h"
|
||||
#include "td/telegram/ChatManager.h"
|
||||
#include "td/telegram/DialogLocation.h"
|
||||
#include "td/telegram/DialogManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
@ -185,6 +187,37 @@ class DisablePeerConnectedBotQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class GetBusinessChatLinksQuery final : public Td::ResultHandler {
|
||||
Promise<td_api::object_ptr<td_api::businessChatLinks>> promise_;
|
||||
|
||||
public:
|
||||
explicit GetBusinessChatLinksQuery(Promise<td_api::object_ptr<td_api::businessChatLinks>> &&promise)
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send() {
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_getBusinessChatLinks(), {{"me"}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::account_getBusinessChatLinks>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
auto ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for GetBusinessChatLinksQuery: " << to_string(ptr);
|
||||
td_->user_manager_->on_get_users(std::move(ptr->users_), "GetBusinessChatLinksQuery");
|
||||
td_->chat_manager_->on_get_chats(std::move(ptr->chats_), "GetBusinessChatLinksQuery");
|
||||
promise_.set_value(
|
||||
BusinessChatLinks(td_->user_manager_.get(), std::move(ptr->links_)).get_business_chat_links_object());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateBusinessLocationQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
DialogLocation location_;
|
||||
@ -411,6 +444,10 @@ void BusinessManager::remove_business_connected_bot_from_dialog(DialogId dialog_
|
||||
td_->create_handler<DisablePeerConnectedBotQuery>(std::move(promise))->send(dialog_id);
|
||||
}
|
||||
|
||||
void BusinessManager::get_business_chat_links(Promise<td_api::object_ptr<td_api::businessChatLinks>> &&promise) {
|
||||
td_->create_handler<GetBusinessChatLinksQuery>(std::move(promise))->send();
|
||||
}
|
||||
|
||||
void BusinessManager::set_business_location(DialogLocation &&location, Promise<Unit> &&promise) {
|
||||
td_->create_handler<UpdateBusinessLocationQuery>(std::move(promise))->send(std::move(location));
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ class BusinessManager final : public Actor {
|
||||
|
||||
void remove_business_connected_bot_from_dialog(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
|
||||
void get_business_chat_links(Promise<td_api::object_ptr<td_api::businessChatLinks>> &&promise);
|
||||
|
||||
void set_business_location(DialogLocation &&location, Promise<Unit> &&promise);
|
||||
|
||||
void set_business_work_hours(BusinessWorkHours &&work_hours, Promise<Unit> &&promise);
|
||||
|
@ -7985,6 +7985,12 @@ void Td::on_request(uint64 id, const td_api::removeBusinessConnectedBotFromChat
|
||||
business_manager_->remove_business_connected_bot_from_dialog(DialogId(request.chat_id_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getBusinessChatLinks &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
business_manager_->get_business_chat_links(std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setSupergroupUsername &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.username_);
|
||||
|
@ -1443,6 +1443,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::removeBusinessConnectedBotFromChat &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getBusinessChatLinks &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setSupergroupUsername &request);
|
||||
|
||||
void on_request(uint64 id, td_api::toggleSupergroupUsernameIsActive &request);
|
||||
|
@ -6169,6 +6169,8 @@ class CliClient final : public Actor {
|
||||
UserId bot_user_id;
|
||||
get_args(args, bot_user_id);
|
||||
send_request(td_api::make_object<td_api::deleteBusinessConnectedBot>(bot_user_id));
|
||||
} else if (op == "gbcl") {
|
||||
send_request(td_api::make_object<td_api::getBusinessChatLinks>());
|
||||
} else if (op == "gbc") {
|
||||
send_request(td_api::make_object<td_api::getBusinessConnection>(args.empty() ? business_connection_id_ : args));
|
||||
} else if (op == "sco") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user