summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/td/telegram/TdCallback.h
blob: 82b775dd8f556643d20640ac2a9cb847e5cfd58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once

///\file

#include "td/telegram/td_api.h"

#include <cstdint>

namespace td {

/**
 * Interface of callback for low-level interaction with TDLib.
 */
class TdCallback {
 public:
  /**
   * This function is called for every answer to a request made to TDLib and for every incoming update of the type td_api::Update.
   * \param id Request identifier or 0 for incoming updates.
   * \param result Answer to the TDLib request or an incoming update.
   */
  virtual void on_result(std::uint64_t id, td_api::object_ptr<td_api::Object> result) = 0;

  /**
   * This function is called for every unsuccessful request made to TDLib.
   * \param id Request identifier.
   * \param error An answer to a TDLib request or an incoming update.
   */
  virtual void on_error(std::uint64_t id, td_api::object_ptr<td_api::error> error) = 0;

  /**
   * Destroys the TdCallback.
   */
  virtual ~TdCallback() = default;
};

}  // namespace td