1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #pragma once |
6 | |
7 | #include <Quotient/csapi/definitions/auth_data.h> |
8 | #include <Quotient/csapi/definitions/client_device.h> |
9 | |
10 | #include <Quotient/jobs/basejob.h> |
11 | |
12 | namespace Quotient { |
13 | |
14 | /*! \brief List registered devices for the current user |
15 | * |
16 | * Gets information about all devices for the current user. |
17 | */ |
18 | class QUOTIENT_API GetDevicesJob : public BaseJob { |
19 | public: |
20 | /// List registered devices for the current user |
21 | explicit GetDevicesJob(); |
22 | |
23 | /*! \brief Construct a URL without creating a full-fledged job object |
24 | * |
25 | * This function can be used when a URL for GetDevicesJob |
26 | * is necessary but the job itself isn't. |
27 | */ |
28 | static QUrl makeRequestUrl(QUrl baseUrl); |
29 | |
30 | // Result properties |
31 | |
32 | /// A list of all registered devices for this user. |
33 | QVector<Device> devices() const |
34 | { |
35 | return loadFromJson<QVector<Device>>(keyName: "devices"_ls ); |
36 | } |
37 | }; |
38 | |
39 | /*! \brief Get a single device |
40 | * |
41 | * Gets information on a single device, by device id. |
42 | */ |
43 | class QUOTIENT_API GetDeviceJob : public BaseJob { |
44 | public: |
45 | /*! \brief Get a single device |
46 | * |
47 | * \param deviceId |
48 | * The device to retrieve. |
49 | */ |
50 | explicit GetDeviceJob(const QString& deviceId); |
51 | |
52 | /*! \brief Construct a URL without creating a full-fledged job object |
53 | * |
54 | * This function can be used when a URL for GetDeviceJob |
55 | * is necessary but the job itself isn't. |
56 | */ |
57 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& deviceId); |
58 | |
59 | // Result properties |
60 | |
61 | /// Device information |
62 | Device device() const { return fromJson<Device>(json: jsonData()); } |
63 | }; |
64 | |
65 | /*! \brief Update a device |
66 | * |
67 | * Updates the metadata on the given device. |
68 | */ |
69 | class QUOTIENT_API UpdateDeviceJob : public BaseJob { |
70 | public: |
71 | /*! \brief Update a device |
72 | * |
73 | * \param deviceId |
74 | * The device to update. |
75 | * |
76 | * \param displayName |
77 | * The new display name for this device. If not given, the |
78 | * display name is unchanged. |
79 | */ |
80 | explicit UpdateDeviceJob(const QString& deviceId, |
81 | const QString& displayName = {}); |
82 | }; |
83 | |
84 | /*! \brief Delete a device |
85 | * |
86 | * This API endpoint uses the [User-Interactive Authentication |
87 | * API](/client-server-api/#user-interactive-authentication-api). |
88 | * |
89 | * Deletes the given device, and invalidates any access token associated with |
90 | * it. |
91 | */ |
92 | class QUOTIENT_API DeleteDeviceJob : public BaseJob { |
93 | public: |
94 | /*! \brief Delete a device |
95 | * |
96 | * \param deviceId |
97 | * The device to delete. |
98 | * |
99 | * \param auth |
100 | * Additional authentication information for the |
101 | * user-interactive authentication API. |
102 | */ |
103 | explicit DeleteDeviceJob(const QString& deviceId, |
104 | const Omittable<AuthenticationData>& auth = none); |
105 | }; |
106 | |
107 | /*! \brief Bulk deletion of devices |
108 | * |
109 | * This API endpoint uses the [User-Interactive Authentication |
110 | * API](/client-server-api/#user-interactive-authentication-api). |
111 | * |
112 | * Deletes the given devices, and invalidates any access token associated with |
113 | * them. |
114 | */ |
115 | class QUOTIENT_API DeleteDevicesJob : public BaseJob { |
116 | public: |
117 | /*! \brief Bulk deletion of devices |
118 | * |
119 | * \param devices |
120 | * The list of device IDs to delete. |
121 | * |
122 | * \param auth |
123 | * Additional authentication information for the |
124 | * user-interactive authentication API. |
125 | */ |
126 | explicit DeleteDevicesJob(const QStringList& devices, |
127 | const Omittable<AuthenticationData>& auth = none); |
128 | }; |
129 | |
130 | } // namespace Quotient |
131 | |