tdlib-obf API
Reference documentation for the public tdlib-obf API, generated from TDLib schemas and public headers
Loading...
Searching...
No Matches
Client.h
Go to the documentation of this file.
1//
2// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7#pragma once
8
10
11#include "td/telegram/td_api.h"
13
14#include <cstdint>
15#include <memory>
16
17namespace td {
18
55class ClientManager final {
56 public:
61
65 using ClientId = std::int32_t;
66
72 using RequestId = std::uint64_t;
73
80
87 void send(ClientId client_id, RequestId request_id, td_api::object_ptr<td_api::Function> &&request);
88
108
116 Response receive(double timeout);
117
125
134 using LogMessageCallbackPtr = void (*)(int verbosity_level, const char *message);
135
145 static void set_log_message_callback(int max_verbosity_level, LogMessageCallbackPtr callback);
146
151
155 ClientManager(ClientManager &&other) noexcept;
156
161
167
168 private:
169 friend class Client;
170 class Impl;
171 std::unique_ptr<Impl> impl_;
172};
173
207class Client final {
208 public:
213
230
235 void send(Request &&request);
236
251
259 Response receive(double timeout);
260
267 static Response execute(Request &&request);
268
273
277 Client(Client &&other) noexcept;
278
282 Client &operator=(Client &&other) noexcept;
283
284 private:
285 class Impl;
286 std::unique_ptr<Impl> impl_;
287};
288
289} // namespace td
Response receive(double timeout)
void send(Request &&request)
static Response execute(Request &&request)
Client(Client &&other) noexcept
Client & operator=(Client &&other) noexcept
static void set_log_message_callback(int max_verbosity_level, LogMessageCallbackPtr callback)
ClientManager(ClientManager &&other) noexcept
void(*)(int verbosity_level, const char *message) LogMessageCallbackPtr
Definition Client.h:134
std::uint64_t RequestId
Definition Client.h:72
void send(ClientId client_id, RequestId request_id, td_api::object_ptr< td_api::Function > &&request)
static ClientManager * get_manager_singleton()
ClientManager & operator=(ClientManager &&other) noexcept
Response receive(double timeout)
ClientId create_client_id()
std::int32_t ClientId
Definition Client.h:65
static td_api::object_ptr< td_api::Object > execute(td_api::object_ptr< td_api::Function > &&request)
std::uint64_t id
Definition Client.h:223
td_api::object_ptr< td_api::Function > function
Definition Client.h:228
std::uint64_t id
Definition Client.h:244
td_api::object_ptr< td_api::Object > object
Definition Client.h:249
td_api::object_ptr< td_api::Object > object
Definition Client.h:106
::td::tl_object_ptr< Type > object_ptr
Definition td_api.h:58