1 // 2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 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 9 ///\file 10 11 #include "td/telegram/td_api.h" 12 13 #include <cstdint> 14 15 namespace td { 16 17 /** 18 * Interface of callback for low-level interaction with TDLib. 19 */ 20 class TdCallback { 21 public: 22 /** 23 * This function is called for every answer to a request made to TDLib and for every incoming update of the type td_api::Update. 24 * \param id Request identifier or 0 for incoming updates. 25 * \param result Answer to the TDLib request or an incoming update. 26 */ 27 virtual void on_result(std::uint64_t id, td_api::object_ptr<td_api::Object> result) = 0; 28 29 /** 30 * This function is called for every unsuccessful request made to TDLib. 31 * \param id Request identifier. 32 * \param error An answer to a TDLib request or an incoming update. 33 */ 34 virtual void on_error(std::uint64_t id, td_api::object_ptr<td_api::error> error) = 0; 35 36 /** 37 * Destroys the TdCallback. 38 */ 39 virtual ~TdCallback() = default; 40 }; 41 42 } // namespace td 43