// SPDX-FileCopyrightText: 2020 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once #include #include #include class QTcpServer; class QTcpSocket; namespace Quotient { class Connection; /*! Single sign-on (SSO) session encapsulation * * This class is responsible for setting up of a new SSO session, providing * a URL to be opened (usually, in a web browser) and handling the callback * response after completing the single sign-on, all the way to actually * logging the user in. It does NOT open and render the SSO URL, it only does * the necessary backstage work. * * Clients only need to open the URL; the rest is done for them. * Client code can look something like: * \code * QDesktopServices::openUrl( * connection->prepareForSso(initialDeviceName)->ssoUrl()); * \endcode */ class SsoSession : public QObject { Q_OBJECT Q_PROPERTY(QUrl ssoUrl READ ssoUrl CONSTANT) Q_PROPERTY(QUrl callbackUrl READ callbackUrl CONSTANT) public: SsoSession(Connection* connection, const QString& initialDeviceName, const QString& deviceId = {}); ~SsoSession() override; QUrl ssoUrl() const; QUrl callbackUrl() const; private: class Private; std::unique_ptr d; }; } // namespace Quotient uotient/refs/?id=6dd950637d0c90c7540cd64b2eb002f1414389a5'>refslogtreecommitdiff
blob: 67420545608b9466c52bf0db6646f67d7f06d0f7 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "jobs/basejob.h"

#include <QtCore/QJsonObject>

namespace QMatrixClient
{
    // Operations

    /// Send a state event to the given room.
    ///
    /// State events can be sent using this endpoint.  These events will be
    /// overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all
    /// match.
    /// 
    /// Requests to this endpoint **cannot use transaction IDs**
    /// like other ``PUT`` paths because they cannot be differentiated from the
    /// ``state_key``. Furthermore, ``POST`` is unsupported on state paths.
    /// 
    /// The body of the request should be the content object of the event; the
    /// fields in this object will vary depending on the type of event. See
    /// `Room Events`_ for the ``m.`` event specification.
    class SetRoomStateWithKeyJob : public BaseJob
    {
        public:
            /*! Send a state event to the given room.
             * \param roomId
             *   The room to set the state in
             * \param eventType
             *   The type of event to send.
             * \param stateKey
             *   The state_key for the state to send. Defaults to the empty string.
             * \param body
             *   State events can be sent using this endpoint.  These events will be
             *   overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all
             *   match.
             *   
             *   Requests to this endpoint **cannot use transaction IDs**
             *   like other ``PUT`` paths because they cannot be differentiated from the
             *   ``state_key``. Furthermore, ``POST`` is unsupported on state paths.
             *   
             *   The body of the request should be the content object of the event; the
             *   fields in this object will vary depending on the type of event. See
             *   `Room Events`_ for the ``m.`` event specification.
             */
            explicit SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey, const QJsonObject& body = {});
            ~SetRoomStateWithKeyJob() override;

            // Result properties

            /// A unique identifier for the event.
            const QString& eventId() const;

        protected:
            Status parseJson(const QJsonDocument& data) override;

        private:
            class Private;
            QScopedPointer<Private> d;
    };

    /// Send a state event to the given room.
    ///
    /// State events can be sent using this endpoint. This endpoint is
    /// equivalent to calling `/rooms/{roomId}/state/{eventType}/{stateKey}`
    /// with an empty `stateKey`. Previous state events with matching
    /// `<roomId>` and `<eventType>`, and empty `<stateKey>`, will be overwritten.
    /// 
    /// Requests to this endpoint **cannot use transaction IDs**
    /// like other ``PUT`` paths because they cannot be differentiated from the
    /// ``state_key``. Furthermore, ``POST`` is unsupported on state paths.
    /// 
    /// The body of the request should be the content object of the event; the
    /// fields in this object will vary depending on the type of event. See
    /// `Room Events`_ for the ``m.`` event specification.
    class SetRoomStateJob : public BaseJob
    {
        public:
            /*! Send a state event to the given room.
             * \param roomId
             *   The room to set the state in
             * \param eventType
             *   The type of event to send.
             * \param body
             *   State events can be sent using this endpoint. This endpoint is
             *   equivalent to calling `/rooms/{roomId}/state/{eventType}/{stateKey}`
             *   with an empty `stateKey`. Previous state events with matching
             *   `<roomId>` and `<eventType>`, and empty `<stateKey>`, will be overwritten.
             *   
             *   Requests to this endpoint **cannot use transaction IDs**
             *   like other ``PUT`` paths because they cannot be differentiated from the
             *   ``state_key``. Furthermore, ``POST`` is unsupported on state paths.
             *   
             *   The body of the request should be the content object of the event; the
             *   fields in this object will vary depending on the type of event. See
             *   `Room Events`_ for the ``m.`` event specification.
             */
            explicit SetRoomStateJob(const QString& roomId, const QString& eventType, const QJsonObject& body = {});
            ~SetRoomStateJob() override;

            // Result properties

            /// A unique identifier for the event.
            const QString& eventId() const;

        protected:
            Status parseJson(const QJsonDocument& data) override;

        private:
            class Private;
            QScopedPointer<Private> d;
    };
} // namespace QMatrixClient