* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#pragma once
#include "types.hpp"
namespace Kazv {
/// Contains optional extra information about the event.
struct UnsignedData
{
/// The time in milliseconds that has elapsed since the event was sent. This field is generated by the local homeserver, and may be incorrect if the local time on at least one of the two servers is out of sync, which can cause the age to either be negative or greater than it actually is.
std::optional<int> age;
/// The event that redacted this event, if any.
JsonWrap redactedBecause;
/// The client-supplied transaction ID, for example, provided via
/// Adjusts the membership state for a user in a room. It is preferable to use the membership APIs (``/rooms/<room id>/invite`` etc) when performing membership actions rather than adjusting the state directly as there are a restricted set of valid transformations. For example, user A cannot force user B to join a room, and trying to force this state change directly will fail.
///
/// The following membership states are specified:
///
/// - ``invite`` - The user has been invited to join a room, but has not yet joined it. They may not participate in the room until they join.
///
/// - ``join`` - The user has joined the room (possibly after accepting an invite), and may participate in it.
///
/// - ``leave`` - The user was once joined to the room, but has since left (possibly by choice, or possibly by being kicked).
///
/// - ``ban`` - The user has been banned from the room, and is no longer allowed to join it until they are un-banned from the room (by having their membership state set to a value other than ``ban``).
///
/// - ``knock`` - This is a reserved word, which currently has no meaning.
///
/// The ``third_party_invite`` property will be set if this invite is an ``invite`` event and is the successor of an ``m.room.third_party_invite`` event, and absent otherwise.
///
/// This event may also include an ``invite_room_state`` key inside the event's ``unsigned`` data.
/// If present, this contains an array of ``StrippedState`` Events. These events provide information
/// on a subset of state events such as the room name.
///
/// The user for which a membership applies is represented by the ``state_key``. Under some conditions,
/// the ``sender`` and ``state_key`` may not match - this may be interpreted as the ``sender`` affecting
/// the membership state of the ``state_key`` user.
///
/// The ``membership`` for a given user can change over time. The table below represents the various changes
/// over time and how clients and servers must interpret those changes. Previous membership can be retrieved
/// from the ``prev_content`` object on an event. If not present, the user's previous membership must be assumed
/// as ``leave``.
///
/// .. TODO: Improve how this table is written? We use a csv-table to get around vertical header restrictions.
/// "from ``invite``","No change.","User joined the room.","If the ``state_key`` is the same as the ``sender``, the user rejected the invite. Otherwise, the ``state_key`` user had their invite revoked.","User was banned.","Not implemented."
/// "from ``join``","Must never happen.","``displayname`` or ``avatar_url`` changed.","If the ``state_key`` is the same as the ``sender``, the user left. Otherwise, the ``state_key`` user was kicked.","User was kicked and banned.","Not implemented."
/// "from ``leave``","New invitation sent.","User joined.","No change.","User was banned.","Not implemented."
/// "from ``ban``","Must never happen.","Must never happen.","User was unbanned.","No change.","Not implemented."
/// Adjusts the membership state for a user in a room. It is preferable to use the membership APIs (``/rooms/<room id>/invite`` etc) when performing membership actions rather than adjusting the state directly as there are a restricted set of valid transformations. For example, user A cannot force user B to join a room, and trying to force this state change directly will fail.
///
/// The following membership states are specified:
///
/// - ``invite`` - The user has been invited to join a room, but has not yet joined it. They may not participate in the room until they join.
///
/// - ``join`` - The user has joined the room (possibly after accepting an invite), and may participate in it.
///
/// - ``leave`` - The user was once joined to the room, but has since left (possibly by choice, or possibly by being kicked).
///
/// - ``ban`` - The user has been banned from the room, and is no longer allowed to join it until they are un-banned from the room (by having their membership state set to a value other than ``ban``).
///
/// - ``knock`` - This is a reserved word, which currently has no meaning.
///
/// The ``third_party_invite`` property will be set if this invite is an ``invite`` event and is the successor of an ``m.room.third_party_invite`` event, and absent otherwise.
///
/// This event may also include an ``invite_room_state`` key inside the event's ``unsigned`` data.
/// If present, this contains an array of ``StrippedState`` Events. These events provide information
/// on a subset of state events such as the room name.
///
/// The user for which a membership applies is represented by the ``state_key``. Under some conditions,
/// the ``sender`` and ``state_key`` may not match - this may be interpreted as the ``sender`` affecting
/// the membership state of the ``state_key`` user.
///
/// The ``membership`` for a given user can change over time. The table below represents the various changes
/// over time and how clients and servers must interpret those changes. Previous membership can be retrieved
/// from the ``prev_content`` object on an event. If not present, the user's previous membership must be assumed
/// as ``leave``.
///
/// .. TODO: Improve how this table is written? We use a csv-table to get around vertical header restrictions.
/// "from ``invite``","No change.","User joined the room.","If the ``state_key`` is the same as the ``sender``, the user rejected the invite. Otherwise, the ``state_key`` user had their invite revoked.","User was banned.","Not implemented."
/// "from ``join``","Must never happen.","``displayname`` or ``avatar_url`` changed.","If the ``state_key`` is the same as the ``sender``, the user left. Otherwise, the ``state_key`` user was kicked.","User was kicked and banned.","Not implemented."
/// "from ``leave``","New invitation sent.","User joined.","No change.","User was banned.","Not implemented."
/// "from ``ban``","Must never happen.","Must never happen.","User was unbanned.","No change.","Not implemented."
/// The ``user_id`` this membership event relates to. In all cases except for when ``membership`` is
/// ``join``, the user ID sending the event does not need to match the user ID in the ``state_key``,
/// unlike other events. Regular authorisation rules still apply.
std::string stateKey;
/// Adjusts the membership state for a user in a room. It is preferable to use the membership APIs (``/rooms/<room id>/invite`` etc) when performing membership actions rather than adjusting the state directly as there are a restricted set of valid transformations. For example, user A cannot force user B to join a room, and trying to force this state change directly will fail.
///
/// The following membership states are specified:
///
/// - ``invite`` - The user has been invited to join a room, but has not yet joined it. They may not participate in the room until they join.
///
/// - ``join`` - The user has joined the room (possibly after accepting an invite), and may participate in it.
///
/// - ``leave`` - The user was once joined to the room, but has since left (possibly by choice, or possibly by being kicked).
///
/// - ``ban`` - The user has been banned from the room, and is no longer allowed to join it until they are un-banned from the room (by having their membership state set to a value other than ``ban``).
///
/// - ``knock`` - This is a reserved word, which currently has no meaning.
///
/// The ``third_party_invite`` property will be set if this invite is an ``invite`` event and is the successor of an ``m.room.third_party_invite`` event, and absent otherwise.
///
/// This event may also include an ``invite_room_state`` key inside the event's ``unsigned`` data.
/// If present, this contains an array of ``StrippedState`` Events. These events provide information
/// on a subset of state events such as the room name.
///
/// The user for which a membership applies is represented by the ``state_key``. Under some conditions,
/// the ``sender`` and ``state_key`` may not match - this may be interpreted as the ``sender`` affecting
/// the membership state of the ``state_key`` user.
///
/// The ``membership`` for a given user can change over time. The table below represents the various changes
/// over time and how clients and servers must interpret those changes. Previous membership can be retrieved
/// from the ``prev_content`` object on an event. If not present, the user's previous membership must be assumed
/// as ``leave``.
///
/// .. TODO: Improve how this table is written? We use a csv-table to get around vertical header restrictions.
/// "from ``invite``","No change.","User joined the room.","If the ``state_key`` is the same as the ``sender``, the user rejected the invite. Otherwise, the ``state_key`` user had their invite revoked.","User was banned.","Not implemented."
/// "from ``join``","Must never happen.","``displayname`` or ``avatar_url`` changed.","If the ``state_key`` is the same as the ``sender``, the user left. Otherwise, the ``state_key`` user was kicked.","User was kicked and banned.","Not implemented."
/// "from ``leave``","New invitation sent.","User joined.","No change.","User was banned.","Not implemented."
/// "from ``ban``","Must never happen.","Must never happen.","User was unbanned.","No change.","Not implemented."
/// Adjusts the membership state for a user in a room. It is preferable to use the membership APIs (``/rooms/<room id>/invite`` etc) when performing membership actions rather than adjusting the state directly as there are a restricted set of valid transformations. For example, user A cannot force user B to join a room, and trying to force this state change directly will fail.
///
/// The following membership states are specified:
///
/// - ``invite`` - The user has been invited to join a room, but has not yet joined it. They may not participate in the room until they join.
///
/// - ``join`` - The user has joined the room (possibly after accepting an invite), and may participate in it.
///
/// - ``leave`` - The user was once joined to the room, but has since left (possibly by choice, or possibly by being kicked).
///
/// - ``ban`` - The user has been banned from the room, and is no longer allowed to join it until they are un-banned from the room (by having their membership state set to a value other than ``ban``).
///
/// - ``knock`` - This is a reserved word, which currently has no meaning.
///
/// The ``third_party_invite`` property will be set if this invite is an ``invite`` event and is the successor of an ``m.room.third_party_invite`` event, and absent otherwise.
///
/// This event may also include an ``invite_room_state`` key inside the event's ``unsigned`` data.
/// If present, this contains an array of ``StrippedState`` Events. These events provide information
/// on a subset of state events such as the room name.
///
/// The user for which a membership applies is represented by the ``state_key``. Under some conditions,
/// the ``sender`` and ``state_key`` may not match - this may be interpreted as the ``sender`` affecting
/// the membership state of the ``state_key`` user.
///
/// The ``membership`` for a given user can change over time. The table below represents the various changes
/// over time and how clients and servers must interpret those changes. Previous membership can be retrieved
/// from the ``prev_content`` object on an event. If not present, the user's previous membership must be assumed
/// as ``leave``.
///
/// .. TODO: Improve how this table is written? We use a csv-table to get around vertical header restrictions.
/// "from ``invite``","No change.","User joined the room.","If the ``state_key`` is the same as the ``sender``, the user rejected the invite. Otherwise, the ``state_key`` user had their invite revoked.","User was banned.","Not implemented."
/// "from ``join``","Must never happen.","``displayname`` or ``avatar_url`` changed.","If the ``state_key`` is the same as the ``sender``, the user left. Otherwise, the ``state_key`` user was kicked.","User was kicked and banned.","Not implemented."
/// "from ``leave``","New invitation sent.","User joined.","No change.","User was banned.","Not implemented."
/// "from ``ban``","Must never happen.","Must never happen.","User was unbanned.","No change.","Not implemented."
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#pragma once
#include "types.hpp"
namespace Kazv {
struct EventFilter
{
/// The maximum number of events to return.
std::optional<int> limit;
/// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the ``'senders'`` filter.
immer::array<std::string> notSenders;
/// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the ``'types'`` filter. A '*' can be used as a wildcard to match any sequence of characters.
immer::array<std::string> notTypes;
/// A list of senders IDs to include. If this list is absent then all senders are included.
immer::array<std::string> senders;
/// A list of event types to include. If this list is absent then all event types are included. A ``'*'`` can be used as a wildcard to match any sequence of characters.
immer::array<std::string> types;
};
}
namespace nlohmann
{
using namespace Kazv;
template<>
struct adl_serializer<EventFilter> {
static void to_json(json& jo, const EventFilter &pod)
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#pragma once
#include "types.hpp"
#include "csapi/definitions/event_filter.hpp"
namespace Kazv {
struct RoomEventFilter : EventFilter
{
/// If ``true``, enables lazy-loading of membership events. See
/// `Lazy-loading room members <#lazy-loading-room-members>`_
/// for more information. Defaults to ``false``.
std::optional<bool> lazyLoadMembers;
/// If ``true``, sends all membership events for all events, even if they have already
/// been sent to the client. Does not
/// apply unless ``lazy_load_members`` is ``true``. See
/// `Lazy-loading room members <#lazy-loading-room-members>`_
/// for more information. Defaults to ``false``.
std::optional<bool> includeRedundantMembers;
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the ``'rooms'`` filter.
immer::array<std::string> notRooms;
/// A list of room IDs to include. If this list is absent then all rooms are included.
immer::array<std::string> rooms;
/// If ``true``, includes only events with a ``url`` key in their content. If ``false``, excludes those events. If omitted, ``url`` key is not considered for filtering.
std::optional<bool> containsUrl;
};
}
namespace nlohmann
{
using namespace Kazv;
template<>
struct adl_serializer<RoomEventFilter> {
static void to_json(json& jo, const RoomEventFilter &pod)
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the ``'rooms'`` filter. This filter is applied before the filters in ``ephemeral``, ``state``, ``timeline`` or ``account_data``
immer::array<std::string> notRooms;
/// A list of room IDs to include. If this list is absent then all rooms are included. This filter is applied before the filters in ``ephemeral``, ``state``, ``timeline`` or ``account_data``
immer::array<std::string> rooms;
/// The events that aren't recorded in the room history, e.g. typing and receipts, to include for rooms.
RoomEventFilter ephemeral;
/// Include rooms that the user has left in the sync, default false
std::optional<bool> includeLeave;
/// The state events to include for rooms.
RoomEventFilter state;
/// The message and state update events to include for rooms.
RoomEventFilter timeline;
/// The per user account data to include for rooms.
RoomEventFilter accountData;
};
}
namespace nlohmann
{
using namespace Kazv;
template<>
struct adl_serializer<RoomFilter> {
static void to_json(json& jo, const RoomFilter &pod)
/// List of event fields to include. If this list is absent then all fields are included. The entries may include '.' characters to indicate sub-fields. So ['content.body'] will include the 'body' field of the 'content' object. A literal '.' character in a field name may be escaped using a '\\'. A server may include more fields than were requested.
immer::array<std::string> eventFields;
/// The format to use for events. 'client' will return the events in a format suitable for clients. 'federation' will return the raw event as received over federation. The default is 'client'.
std::string eventFormat;
/// The presence updates to include.
EventFilter presence;
/// The user account data that isn't associated with rooms to include.
/*! \brief Gets the list of currently joined users and their profile data.
*
* This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than ``/members`` as it can be implemented more efficiently on the server.
*/
class GetJoinedMembersByRoomJob : public BaseJob {
public:
// Inner data structures
/// This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than ``/members`` as it can be implemented more efficiently on the server.
struct RoomMember
{
/// The display name of the user this object is representing.
std::string displayName;
/// The mxc avatar url of the user this object is representing.
std::string avatarUrl;
};
// Construction/destruction
/*! \brief Gets the list of currently joined users and their profile data.