128 std::optional<StateEventBatch>
state;
244 std::optional<StateEventBatch>
state;
259 immer::map<std::string, JoinedRoom>
join;
262 immer::map<std::string, InvitedRoom>
invite;
264 immer::map<std::string, KnockedRoom>
knock;
267 immer::map<std::string, LeftRoom>
leave;
291 std::optional<Rooms>
rooms()
const;
295 std::optional<EventBatch>
presence()
const;
373 explicit SyncJob(std::string serverUrl
374 , std::string _accessToken
376 std::optional<std::string> filter = std::nullopt, std::optional<std::string> since = std::nullopt, std::optional<bool> fullState = std::nullopt, std::optional<std::string> setPresence = std::nullopt, std::optional<int> timeout = std::nullopt
381 std::optional<std::string> filter, std::optional<std::string> since, std::optional<bool> fullState, std::optional<std::string> setPresence, std::optional<int> timeout);
383 static BaseJob::Body buildBody(std::optional<std::string> filter, std::optional<std::string> since, std::optional<bool> fullState, std::optional<std::string> setPresence, std::optional<int> timeout);
396 using namespace Kazv;
403 if (! jo.is_object()) { jo = json::object(); }
417 if (jo.contains(
"m.heroes"s)) {
418 result.
mHeroes = jo.at(
"m.heroes"s);
420 if (jo.contains(
"m.joined_member_count"s)) {
423 if (jo.contains(
"m.invited_member_count"s)) {
431 struct adl_serializer<
SyncJob::UnreadNotificationCounts> {
435 if (! jo.is_object()) { jo = json::object(); }
447 if (jo.contains(
"highlight_count"s)) {
450 if (jo.contains(
"notification_count"s)) {
462 if (! jo.is_object()) { jo = json::object(); }
482 if (jo.contains(
"summary"s)) {
483 result.
summary = jo.at(
"summary"s);
485 if (jo.contains(
"state"s)) {
486 result.
state = jo.at(
"state"s);
488 if (jo.contains(
"timeline"s)) {
489 result.
timeline = jo.at(
"timeline"s);
491 if (jo.contains(
"ephemeral"s)) {
494 if (jo.contains(
"account_data"s)) {
497 if (jo.contains(
"unread_notifications"s)) {
509 if (! jo.is_object()) { jo = json::object(); }
519 if (jo.contains(
"events"s)) {
520 result.
events = jo.at(
"events"s);
531 if (! jo.is_object()) { jo = json::object(); }
541 if (jo.contains(
"invite_state"s)) {
553 if (! jo.is_object()) { jo = json::object(); }
563 if (jo.contains(
"events"s)) {
564 result.
events = jo.at(
"events"s);
575 if (! jo.is_object()) { jo = json::object(); }
585 if (jo.contains(
"knock_state"s)) {
597 if (! jo.is_object()) { jo = json::object(); }
611 if (jo.contains(
"state"s)) {
612 result.
state = jo.at(
"state"s);
614 if (jo.contains(
"timeline"s)) {
615 result.
timeline = jo.at(
"timeline"s);
617 if (jo.contains(
"account_data"s)) {
629 if (! jo.is_object()) { jo = json::object(); }
645 if (jo.contains(
"join"s)) {
646 result.
join = jo.at(
"join"s);
648 if (jo.contains(
"invite"s)) {
649 result.
invite = jo.at(
"invite"s);
651 if (jo.contains(
"knock"s)) {
652 result.
knock = jo.at(
"knock"s);
654 if (jo.contains(
"leave"s)) {
655 result.
leave = jo.at(
"leave"s);
JsonWrap deviceLists() const
Information on end-to-end device updates, as specified in End-to-end encryption.
Definition: sync.cpp:145
std::optional< EventBatch > accountData() const
The global private data created by this user.
Definition: sync.cpp:123
std::optional< Rooms > rooms() const
Updates to rooms.
Definition: sync.cpp:101
JsonWrap toDevice() const
Information on the send-to-device messages for the client device, as defined in Send-to-Device messag...
Definition: sync.cpp:134
immer::map< std::string, int > deviceOneTimeKeysCount() const
Information on end-to-end encryption keys, as specified in End-to-end encryption.
Definition: sync.cpp:156
JobResponse(Response r)
Definition: sync.cpp:76
std::string nextBatch() const
The batch token to supply in the since param of the next /sync request.
Definition: sync.cpp:90
bool success() const
Definition: sync.cpp:79
std::optional< EventBatch > presence() const
The updates to the presence status of other users.
Definition: sync.cpp:112
Synchronise the client's state and receive new messages.
Definition: sync.hpp:39
SyncJob withData(JsonWrap j) &&
Definition: sync.cpp:62
static BaseJob::Query buildQuery(std::optional< std::string > filter, std::optional< std::string > since, std::optional< bool > fullState, std::optional< std::string > setPresence, std::optional< int > timeout)
Definition: sync.cpp:13
static BaseJob::Body buildBody(std::optional< std::string > filter, std::optional< std::string > since, std::optional< bool > fullState, std::optional< std::string > setPresence, std::optional< int > timeout)
Definition: sync.cpp:30
static constexpr auto needsAuth()
Definition: sync.hpp:317
SyncJob(std::string serverUrl, std::string _accessToken, std::optional< std::string > filter=std::nullopt, std::optional< std::string > since=std::nullopt, std::optional< bool > fullState=std::nullopt, std::optional< std::string > setPresence=std::nullopt, std::optional< int > timeout=std::nullopt)
Synchronise the client's state and receive new messages.
Definition: sync.cpp:42
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
immer::flex_vector< Event > EventList
Definition: types.hpp:107
Definition: location.hpp:27
The stripped state of a room that the user has been invited to.
Definition: sync.hpp:149
EventList events
The stripped state events that form the invite state.
Definition: sync.hpp:151
Synchronise the client's state with the latest state on the server.
Definition: sync.hpp:177
std::optional< InviteState > inviteState
The stripped state of a room that the user has been invited to.
Definition: sync.hpp:180
Synchronise the client's state with the latest state on the server.
Definition: sync.hpp:113
std::optional< EventBatch > accountData
The private data that this user has attached to this room.
Definition: sync.hpp:138
Timeline timeline
The timeline of messages and state changes in the room.
Definition: sync.hpp:131
std::optional< UnreadNotificationCounts > unreadNotifications
Counts of unread notifications for this room.
Definition: sync.hpp:142
std::optional< EventBatch > ephemeral
The ephemeral events in the room that aren't recorded in the timeline or state of the room.
Definition: sync.hpp:135
std::optional< RoomSummary > summary
Information about the room which clients may need to correctly render it to users.
Definition: sync.hpp:116
std::optional< StateEventBatch > state
Updates to the state, between the time indicated by the since parameter, and the start of the timelin...
Definition: sync.hpp:128
The stripped state of a room that the user has knocked upon.
Definition: sync.hpp:186
EventList events
The stripped state events that form the knock state.
Definition: sync.hpp:188
Synchronise the client's state with the latest state on the server.
Definition: sync.hpp:214
std::optional< KnockState > knockState
The stripped state of a room that the user has knocked upon.
Definition: sync.hpp:216
Synchronise the client's state with the latest state on the server.
Definition: sync.hpp:242
std::optional< StateEventBatch > state
The state updates for the room up to the start of the timeline.
Definition: sync.hpp:244
Timeline timeline
The timeline of messages and state changes in the room up to the point when the user left.
Definition: sync.hpp:247
std::optional< EventBatch > accountData
The private data that this user has attached to this room.
Definition: sync.hpp:250
Information about the room which clients may need to correctly render it to users.
Definition: sync.hpp:46
std::optional< int > mJoinedMemberCount
The number of users with membership of join, including the client's own user ID.
Definition: sync.hpp:71
immer::array< std::string > mHeroes
The users which can be used to generate a room name if the room does not have one.
Definition: sync.hpp:66
std::optional< int > mInvitedMemberCount
The number of users with membership of invite.
Definition: sync.hpp:75
Updates to rooms.
Definition: sync.hpp:256
immer::map< std::string, JoinedRoom > join
The rooms that the user has joined, mapped as room ID to room information.
Definition: sync.hpp:259
immer::map< std::string, KnockedRoom > knock
The rooms that the user has knocked upon, mapped as room ID to room information.
Definition: sync.hpp:264
immer::map< std::string, InvitedRoom > invite
The rooms that the user has been invited to, mapped as room ID to room information.
Definition: sync.hpp:262
immer::map< std::string, LeftRoom > leave
The rooms that the user has left or been banned from, mapped as room ID to room information.
Definition: sync.hpp:267
Counts of unread notifications for this room.
Definition: sync.hpp:83
std::optional< int > notificationCount
The total number of unread notifications for this room.
Definition: sync.hpp:87
std::optional< int > highlightCount
The number of unread notifications for this room with the highlight flag set.
Definition: sync.hpp:85
Definition: timeline_batch.hpp:13
Definition: basejob.hpp:50
static void to_json(json &jo, const SyncJob::InviteState &pod)
Definition: sync.hpp:507
static void from_json(const json &jo, SyncJob::InviteState &result)
Definition: sync.hpp:516
static void from_json(const json &jo, SyncJob::InvitedRoom &result)
Definition: sync.hpp:538
static void to_json(json &jo, const SyncJob::InvitedRoom &pod)
Definition: sync.hpp:529
static void from_json(const json &jo, SyncJob::JoinedRoom &result)
Definition: sync.hpp:479
static void to_json(json &jo, const SyncJob::JoinedRoom &pod)
Definition: sync.hpp:460
static void from_json(const json &jo, SyncJob::KnockState &result)
Definition: sync.hpp:560
static void to_json(json &jo, const SyncJob::KnockState &pod)
Definition: sync.hpp:551
static void from_json(const json &jo, SyncJob::KnockedRoom &result)
Definition: sync.hpp:582
static void to_json(json &jo, const SyncJob::KnockedRoom &pod)
Definition: sync.hpp:573
static void from_json(const json &jo, SyncJob::LeftRoom &result)
Definition: sync.hpp:608
static void to_json(json &jo, const SyncJob::LeftRoom &pod)
Definition: sync.hpp:595
static void to_json(json &jo, const SyncJob::RoomSummary &pod)
Definition: sync.hpp:401
static void from_json(const json &jo, SyncJob::RoomSummary &result)
Definition: sync.hpp:414
static void from_json(const json &jo, SyncJob::Rooms &result)
Definition: sync.hpp:642
static void to_json(json &jo, const SyncJob::Rooms &pod)
Definition: sync.hpp:627
static void from_json(const json &jo, SyncJob::UnreadNotificationCounts &result)
Definition: sync.hpp:444
static void to_json(json &jo, const SyncJob::UnreadNotificationCounts &pod)
Definition: sync.hpp:433