libkazv
sdk-model.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2020 Tusooa Zhu <tusooa@kazv.moe>
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 #pragma once
8 #include <libkazv-config.hpp>
9 
10 #include <context.hpp>
11 #include "client-model.hpp"
12 
13 namespace Kazv
14 {
15  struct SdkModel;
16 
17  using SdkAction = std::variant<
19  >;
20 
22 
23  using SdkResult = std::pair<SdkModel, SdkEffect>;
24 
25  struct SdkModel
26  {
28 
29  inline operator ClientModel() const { return client; }
30  inline const ClientModel &c() const { return client; }
31 
32  using Action = SdkAction;
33  using Effect = SdkEffect;
34  using Result = SdkResult;
35 
36  static SdkResult update(SdkModel s, SdkAction a);
37  };
38 
39  template<class Archive>
40  void serialize(Archive &ar, SdkModel &s, std::uint32_t const /*version*/)
41  {
42  ar & s.client;
43  }
44 }
45 
46 BOOST_CLASS_VERSION(Kazv::SdkModel, 0)
Definition: context.hpp:205
Definition: location.hpp:10
std::variant< RoomListAction, LoginAction, TokenLoginAction, LogoutAction, HardLogoutAction, GetWellknownAction, GetVersionsAction, SyncAction, SetShouldSyncAction, PostInitialFiltersAction, SetAccountDataAction, PaginateTimelineAction, SendMessageAction, SendStateEventAction, SaveLocalEchoAction, UpdateLocalEchoStatusAction, RedactEventAction, CreateRoomAction, GetRoomStatesAction, GetStateEventAction, InviteToRoomAction, JoinRoomByIdAction, JoinRoomAction, LeaveRoomAction, ForgetRoomAction, KickAction, BanAction, UnbanAction, SetAccountDataPerRoomAction, ProcessResponseAction, SetTypingAction, PostReceiptAction, SetReadMarkerAction, UploadContentAction, DownloadContentAction, DownloadThumbnailAction, SendToDeviceMessageAction, SendMultipleToDeviceMessagesAction, UploadIdentityKeysAction, GenerateAndUploadOneTimeKeysAction, QueryKeysAction, ClaimKeysAction, EncryptMegOlmEventAction, SetDeviceTrustLevelAction, SetTrustLevelNeededToSendKeysAction, PrepareForSharingRoomKeyAction, GetUserProfileAction, SetAvatarUrlAction, SetDisplayNameAction, ResubmitJobAction > ClientAction
Definition: clientfwd.hpp:145
std::pair< SdkModel, SdkEffect > SdkResult
Definition: sdk-model.hpp:23
Effect< SdkAction, lager::deps< JobInterface &, EventInterface & > > SdkEffect
Definition: sdk-model.hpp:21
std::variant< ClientAction > SdkAction
Definition: sdk-model.hpp:19
void serialize(Archive &ar, ClientModel &m, std::uint32_t const version)
Definition: client-model.hpp:582
Definition: client-model.hpp:59
Definition: sdk-model.hpp:26
SdkAction Action
Definition: sdk-model.hpp:32
static SdkResult update(SdkModel s, SdkAction a)
Definition: sdk-model.cpp:23
ClientModel client
Definition: sdk-model.hpp:27
const ClientModel & c() const
Definition: sdk-model.hpp:30
SdkResult Result
Definition: sdk-model.hpp:34