| 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 | namespace Quotient { |
| 10 | |
| 11 | /*! \brief Update this user's presence state. |
| 12 | * |
| 13 | * This API sets the given user's presence state. When setting the status, |
| 14 | * the activity time is updated to reflect that activity; the client does |
| 15 | * not need to specify the `last_active_ago` field. You cannot set the |
| 16 | * presence state of another user. |
| 17 | */ |
| 18 | class QUOTIENT_API SetPresenceJob : public BaseJob { |
| 19 | public: |
| 20 | /*! \brief Update this user's presence state. |
| 21 | * |
| 22 | * \param userId |
| 23 | * The user whose presence state to update. |
| 24 | * |
| 25 | * \param presence |
| 26 | * The new presence state. |
| 27 | * |
| 28 | * \param statusMsg |
| 29 | * The status message to attach to this state. |
| 30 | */ |
| 31 | explicit SetPresenceJob(const QString& userId, const QString& presence, |
| 32 | const QString& statusMsg = {}); |
| 33 | }; |
| 34 | |
| 35 | /*! \brief Get this user's presence state. |
| 36 | * |
| 37 | * Get the given user's presence state. |
| 38 | */ |
| 39 | class QUOTIENT_API GetPresenceJob : public BaseJob { |
| 40 | public: |
| 41 | /*! \brief Get this user's presence state. |
| 42 | * |
| 43 | * \param userId |
| 44 | * The user whose presence state to get. |
| 45 | */ |
| 46 | explicit GetPresenceJob(const QString& userId); |
| 47 | |
| 48 | /*! \brief Construct a URL without creating a full-fledged job object |
| 49 | * |
| 50 | * This function can be used when a URL for GetPresenceJob |
| 51 | * is necessary but the job itself isn't. |
| 52 | */ |
| 53 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId); |
| 54 | |
| 55 | // Result properties |
| 56 | |
| 57 | /// This user's presence. |
| 58 | QString presence() const { return loadFromJson<QString>(keyName: "presence"_ls ); } |
| 59 | |
| 60 | /// The length of time in milliseconds since an action was performed |
| 61 | /// by this user. |
| 62 | Omittable<int> lastActiveAgo() const |
| 63 | { |
| 64 | return loadFromJson<Omittable<int>>(keyName: "last_active_ago"_ls ); |
| 65 | } |
| 66 | |
| 67 | /// The state message for this user if one was set. |
| 68 | QString statusMsg() const { return loadFromJson<QString>(keyName: "status_msg"_ls ); } |
| 69 | |
| 70 | /// Whether the user is currently active |
| 71 | Omittable<bool> currentlyActive() const |
| 72 | { |
| 73 | return loadFromJson<Omittable<bool>>(keyName: "currently_active"_ls ); |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | } // namespace Quotient |
| 78 | |