libQuotient
A Qt library for building matrix clients
connectiondata.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2015 Felix Rohrbach <kde@fxrh.de>
2 // SPDX-FileCopyrightText: 2016 Kitsune Ral <Kitsune-Ral@users.sf.net>
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 
5 #pragma once
6 
7 #include "util.h"
8 
9 #include <QtCore/QUrl>
10 
11 #include <chrono>
12 
13 namespace Quotient {
14 
15 class NetworkAccessManager;
16 class BaseJob;
17 
18 class QUOTIENT_API ConnectionData {
19 public:
20  explicit ConnectionData(QUrl baseUrl);
21  Q_DISABLE_COPY_MOVE(ConnectionData)
22  virtual ~ConnectionData();
23 
24  void submit(BaseJob* job);
25  void limitRate(std::chrono::milliseconds nextCallAfter);
26 
27  QByteArray accessToken() const;
28  QUrl baseUrl() const;
29  const QString& deviceId() const;
30  const QString& userId() const;
31  HomeserverData homeserverData() const;
32  Quotient::NetworkAccessManager *nam() const;
33 
34  void setBaseUrl(QUrl baseUrl);
35  [[deprecated("Use setAccessToken() or setIdentity() instead")]]
36  void setToken(QByteArray accessToken);
37  [[deprecated("Use setIdentity() instead")]]
38  void setDeviceId(const QString& deviceId);
39  [[deprecated("Use setIdentity() instead")]]
40  void setUserId(const QString& userId);
41  void setIdentity(const QString& userId, const QString& deviceId, QByteArray accessToken = {});
42  void setAccessToken(QByteArray accessToken);
43  void setSupportedSpecVersions(QStringList versions);
44 
45  QString lastEvent() const;
46  void setLastEvent(QString identifier);
47 
48  QString generateTxnId() const;
49 
50 private:
51  class Private;
52  ImplPtr<Private> d;
53 };
54 } // namespace Quotient