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 119 120 121 122 123 124 125 126 127
|
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
#pragma once
#include <Quotient/jobs/basejob.h>
namespace Quotient {
//! \brief Create a new mapping from room alias to room ID.
class QUOTIENT_API SetRoomAliasJob : public BaseJob {
public:
//! \param roomAlias
//! The room alias to set. Its format is defined
//! [in the appendices](/appendices/#room-aliases).
//!
//! \param roomId
//! The room ID to set.
explicit SetRoomAliasJob(const QString& roomAlias, const QString& roomId);
};
//! \brief Get the room ID corresponding to this room alias.
//!
//! Requests that the server resolve a room alias to a room ID.
//!
//! The server will use the federation API to resolve the alias if the
//! domain part of the alias does not correspond to the server's own
//! domain.
class QUOTIENT_API GetRoomIdByAliasJob : public BaseJob {
public:
//! \param roomAlias
//! The room alias. Its format is defined
//! [in the appendices](/appendices/#room-aliases).
explicit GetRoomIdByAliasJob(const QString& roomAlias);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetRoomIdByAliasJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomAlias);
// Result properties
//! The room ID for this room alias.
QString roomId() const { return loadFromJson<QString>("room_id"_L1); }
//! A list of servers that are aware of this room alias.
QStringList servers() const { return loadFromJson<QStringList>("servers"_L1); }
struct Response {
//! The room ID for this room alias.
QString roomId{};
//! A list of servers that are aware of this room alias.
QStringList servers{};
};
};
template <std::derived_from<GetRoomIdByAliasJob> JobT>
constexpr inline auto doCollectResponse<JobT> =
[](JobT* j) -> GetRoomIdByAliasJob::Response { return { j->roomId(), j->servers() }; };
//! \brief Remove a mapping of room alias to room ID.
//!
//! Remove a mapping of room alias to room ID.
//!
//! Servers may choose to implement additional access control checks here, for instance that
//! room aliases can only be deleted by their creator or a server administrator.
//!
//! **Note:**
//! Servers may choose to update the `alt_aliases` for the `m.room.canonical_alias`
//! state event in the room when an alias is removed. Servers which choose to update the
//! canonical alias event are recommended to, in addition to their other relevant permission
//! checks, delete the alias and return a successful response even if the user does not
//! have permission to update the `m.room.canonical_alias` event.
class QUOTIENT_API DeleteRoomAliasJob : public BaseJob {
public:
//! \param roomAlias
//! The room alias to remove. Its format is defined
//! [in the appendices](/appendices/#room-aliases).
explicit DeleteRoomAliasJob(const QString& roomAlias);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for DeleteRoomAliasJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomAlias);
};
//! \brief Get a list of local aliases on a given room.
//!
//! Get a list of aliases maintained by the local server for the
//! given room.
//!
//! This endpoint can be called by users who are in the room (external
//! users receive an `M_FORBIDDEN` error response). If the room's
//! `m.room.history_visibility` maps to `world_readable`, any
//! user can call this endpoint.
//!
//! Servers may choose to implement additional access control checks here,
//! such as allowing server administrators to view aliases regardless of
//! membership.
//!
//! **Note:**
//! Clients are recommended not to display this list of aliases prominently
//! as they are not curated, unlike those listed in the `m.room.canonical_alias`
//! state event.
class QUOTIENT_API GetLocalAliasesJob : public BaseJob {
public:
//! \param roomId
//! The room ID to find local aliases of.
explicit GetLocalAliasesJob(const QString& roomId);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetLocalAliasesJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomId);
// Result properties
//! The server's local aliases on the room. Can be empty.
QStringList aliases() const { return loadFromJson<QStringList>("aliases"_L1); }
};
inline auto collectResponse(const GetLocalAliasesJob* job) { return job->aliases(); }
} // namespace Quotient
|