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
|
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
#pragma once
#include <Quotient/csapi/definitions/auth_data.h>
#include <Quotient/csapi/definitions/client_device.h>
#include <Quotient/jobs/basejob.h>
namespace Quotient {
//! \brief List registered devices for the current user
//!
//! Gets information about all devices for the current user.
class QUOTIENT_API GetDevicesJob : public BaseJob {
public:
explicit GetDevicesJob();
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetDevicesJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData);
// Result properties
//! A list of all registered devices for this user.
QVector<Device> devices() const { return loadFromJson<QVector<Device>>("devices"_L1); }
};
inline auto collectResponse(const GetDevicesJob* job) { return job->devices(); }
//! \brief Get a single device
//!
//! Gets information on a single device, by device id.
class QUOTIENT_API GetDeviceJob : public BaseJob {
public:
//! \param deviceId
//! The device to retrieve.
explicit GetDeviceJob(const QString& deviceId);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetDeviceJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& deviceId);
// Result properties
//! Device information
Device device() const { return fromJson<Device>(jsonData()); }
};
inline auto collectResponse(const GetDeviceJob* job) { return job->device(); }
//! \brief Update a device
//!
//! Updates the metadata on the given device.
class QUOTIENT_API UpdateDeviceJob : public BaseJob {
public:
//! \param deviceId
//! The device to update.
//!
//! \param displayName
//! The new display name for this device. If not given, the
//! display name is unchanged.
explicit UpdateDeviceJob(const QString& deviceId, const QString& displayName = {});
};
//! \brief Delete a device
//!
//! This API endpoint uses the [User-Interactive Authentication
//! API](/client-server-api/#user-interactive-authentication-api).
//!
//! Deletes the given device, and invalidates any access token associated with it.
class QUOTIENT_API DeleteDeviceJob : public BaseJob {
public:
//! \param deviceId
//! The device to delete.
//!
//! \param auth
//! Additional authentication information for the
//! user-interactive authentication API.
explicit DeleteDeviceJob(const QString& deviceId,
const std::optional<AuthenticationData>& auth = std::nullopt);
};
//! \brief Bulk deletion of devices
//!
//! This API endpoint uses the [User-Interactive Authentication
//! API](/client-server-api/#user-interactive-authentication-api).
//!
//! Deletes the given devices, and invalidates any access token associated with them.
class QUOTIENT_API DeleteDevicesJob : public BaseJob {
public:
//! \param devices
//! The list of device IDs to delete.
//!
//! \param auth
//! Additional authentication information for the
//! user-interactive authentication API.
explicit DeleteDevicesJob(const QStringList& devices,
const std::optional<AuthenticationData>& auth = std::nullopt);
};
} // namespace Quotient
|