| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/jobs/basejob.h> |
| 8 | |
| 9 | #include <Quotient/application-service/definitions/location.h> |
| 10 | #include <Quotient/application-service/definitions/protocol.h> |
| 11 | #include <Quotient/application-service/definitions/user.h> |
| 12 | |
| 13 | namespace Quotient { |
| 14 | |
| 15 | /*! \brief Retrieve metadata about all protocols that a homeserver supports. |
| 16 | * |
| 17 | * Fetches the overall metadata about protocols supported by the |
| 18 | * homeserver. Includes both the available protocols and all fields |
| 19 | * required for queries against each protocol. |
| 20 | */ |
| 21 | class QUOTIENT_API GetProtocolsJob : public BaseJob { |
| 22 | public: |
| 23 | /// Retrieve metadata about all protocols that a homeserver supports. |
| 24 | explicit GetProtocolsJob(); |
| 25 | |
| 26 | /*! \brief Construct a URL without creating a full-fledged job object |
| 27 | * |
| 28 | * This function can be used when a URL for GetProtocolsJob |
| 29 | * is necessary but the job itself isn't. |
| 30 | */ |
| 31 | static QUrl makeRequestUrl(QUrl baseUrl); |
| 32 | |
| 33 | // Result properties |
| 34 | |
| 35 | /// The protocols supported by the homeserver. |
| 36 | QHash<QString, ThirdPartyProtocol> protocols() const |
| 37 | { |
| 38 | return fromJson<QHash<QString, ThirdPartyProtocol>>(json: jsonData()); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | /*! \brief Retrieve metadata about a specific protocol that the homeserver |
| 43 | * supports. |
| 44 | * |
| 45 | * Fetches the metadata from the homeserver about a particular third-party |
| 46 | * protocol. |
| 47 | */ |
| 48 | class QUOTIENT_API GetProtocolMetadataJob : public BaseJob { |
| 49 | public: |
| 50 | /*! \brief Retrieve metadata about a specific protocol that the homeserver |
| 51 | * supports. |
| 52 | * |
| 53 | * \param protocol |
| 54 | * The name of the protocol. |
| 55 | */ |
| 56 | explicit GetProtocolMetadataJob(const QString& protocol); |
| 57 | |
| 58 | /*! \brief Construct a URL without creating a full-fledged job object |
| 59 | * |
| 60 | * This function can be used when a URL for GetProtocolMetadataJob |
| 61 | * is necessary but the job itself isn't. |
| 62 | */ |
| 63 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol); |
| 64 | |
| 65 | // Result properties |
| 66 | |
| 67 | /// The protocol was found and metadata returned. |
| 68 | ThirdPartyProtocol data() const |
| 69 | { |
| 70 | return fromJson<ThirdPartyProtocol>(json: jsonData()); |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | /*! \brief Retrieve Matrix-side portals rooms leading to a third-party location. |
| 75 | * |
| 76 | * Requesting this endpoint with a valid protocol name results in a list |
| 77 | * of successful mapping results in a JSON array. Each result contains |
| 78 | * objects to represent the Matrix room or rooms that represent a portal |
| 79 | * to this third-party network. Each has the Matrix room alias string, |
| 80 | * an identifier for the particular third-party network protocol, and an |
| 81 | * object containing the network-specific fields that comprise this |
| 82 | * identifier. It should attempt to canonicalise the identifier as much |
| 83 | * as reasonably possible given the network type. |
| 84 | */ |
| 85 | class QUOTIENT_API QueryLocationByProtocolJob : public BaseJob { |
| 86 | public: |
| 87 | /*! \brief Retrieve Matrix-side portals rooms leading to a third-party |
| 88 | * location. |
| 89 | * |
| 90 | * \param protocol |
| 91 | * The protocol used to communicate to the third-party network. |
| 92 | * |
| 93 | * \param searchFields |
| 94 | * One or more custom fields to help identify the third-party |
| 95 | * location. |
| 96 | */ |
| 97 | explicit QueryLocationByProtocolJob(const QString& protocol, |
| 98 | const QString& searchFields = {}); |
| 99 | |
| 100 | /*! \brief Construct a URL without creating a full-fledged job object |
| 101 | * |
| 102 | * This function can be used when a URL for QueryLocationByProtocolJob |
| 103 | * is necessary but the job itself isn't. |
| 104 | */ |
| 105 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, |
| 106 | const QString& searchFields = {}); |
| 107 | |
| 108 | // Result properties |
| 109 | |
| 110 | /// At least one portal room was found. |
| 111 | QVector<ThirdPartyLocation> data() const |
| 112 | { |
| 113 | return fromJson<QVector<ThirdPartyLocation>>(json: jsonData()); |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | /*! \brief Retrieve the Matrix User ID of a corresponding third-party user. |
| 118 | * |
| 119 | * Retrieve a Matrix User ID linked to a user on the third-party service, given |
| 120 | * a set of user parameters. |
| 121 | */ |
| 122 | class QUOTIENT_API QueryUserByProtocolJob : public BaseJob { |
| 123 | public: |
| 124 | /*! \brief Retrieve the Matrix User ID of a corresponding third-party user. |
| 125 | * |
| 126 | * \param protocol |
| 127 | * The name of the protocol. |
| 128 | * |
| 129 | * \param fields |
| 130 | * One or more custom fields that are passed to the AS to help identify |
| 131 | * the user. |
| 132 | */ |
| 133 | explicit QueryUserByProtocolJob(const QString& protocol, |
| 134 | const QString& fields = {}); |
| 135 | |
| 136 | /*! \brief Construct a URL without creating a full-fledged job object |
| 137 | * |
| 138 | * This function can be used when a URL for QueryUserByProtocolJob |
| 139 | * is necessary but the job itself isn't. |
| 140 | */ |
| 141 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, |
| 142 | const QString& fields = {}); |
| 143 | |
| 144 | // Result properties |
| 145 | |
| 146 | /// The Matrix User IDs found with the given parameters. |
| 147 | QVector<ThirdPartyUser> data() const |
| 148 | { |
| 149 | return fromJson<QVector<ThirdPartyUser>>(json: jsonData()); |
| 150 | } |
| 151 | }; |
| 152 | |
| 153 | /*! \brief Reverse-lookup third-party locations given a Matrix room alias. |
| 154 | * |
| 155 | * Retrieve an array of third-party network locations from a Matrix room |
| 156 | * alias. |
| 157 | */ |
| 158 | class QUOTIENT_API QueryLocationByAliasJob : public BaseJob { |
| 159 | public: |
| 160 | /*! \brief Reverse-lookup third-party locations given a Matrix room alias. |
| 161 | * |
| 162 | * \param alias |
| 163 | * The Matrix room alias to look up. |
| 164 | */ |
| 165 | explicit QueryLocationByAliasJob(const QString& alias); |
| 166 | |
| 167 | /*! \brief Construct a URL without creating a full-fledged job object |
| 168 | * |
| 169 | * This function can be used when a URL for QueryLocationByAliasJob |
| 170 | * is necessary but the job itself isn't. |
| 171 | */ |
| 172 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& alias); |
| 173 | |
| 174 | // Result properties |
| 175 | |
| 176 | /// All found third-party locations. |
| 177 | QVector<ThirdPartyLocation> data() const |
| 178 | { |
| 179 | return fromJson<QVector<ThirdPartyLocation>>(json: jsonData()); |
| 180 | } |
| 181 | }; |
| 182 | |
| 183 | /*! \brief Reverse-lookup third-party users given a Matrix User ID. |
| 184 | * |
| 185 | * Retrieve an array of third-party users from a Matrix User ID. |
| 186 | */ |
| 187 | class QUOTIENT_API QueryUserByIDJob : public BaseJob { |
| 188 | public: |
| 189 | /*! \brief Reverse-lookup third-party users given a Matrix User ID. |
| 190 | * |
| 191 | * \param userid |
| 192 | * The Matrix User ID to look up. |
| 193 | */ |
| 194 | explicit QueryUserByIDJob(const QString& userid); |
| 195 | |
| 196 | /*! \brief Construct a URL without creating a full-fledged job object |
| 197 | * |
| 198 | * This function can be used when a URL for QueryUserByIDJob |
| 199 | * is necessary but the job itself isn't. |
| 200 | */ |
| 201 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& userid); |
| 202 | |
| 203 | // Result properties |
| 204 | |
| 205 | /// An array of third-party users. |
| 206 | QVector<ThirdPartyUser> data() const |
| 207 | { |
| 208 | return fromJson<QVector<ThirdPartyUser>>(json: jsonData()); |
| 209 | } |
| 210 | }; |
| 211 | |
| 212 | } // namespace Quotient |
| 213 | |