statum-0.1.vapi 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /* statum-0.1.vapi generated by valac 0.56.19, do not modify. */
  2. [CCode (gir_namespace = "statum", gir_version = "0.1")]
  3. namespace Statum {
  4. namespace Cryptography {
  5. [CCode (cheader_filename = "statum-0.1.h")]
  6. public class EncryptionProvider : GLib.Object {
  7. public const string DEFAULT_NAMESPACE;
  8. public EncryptionProvider ();
  9. public string author_properties (string @namespace, Invercargill.Properties data) throws GLib.Error;
  10. public string author_string (string @namespace, string data);
  11. public Invercargill.Properties read_properties (string @namespace, string blob) throws GLib.Error;
  12. public string read_string (string @namespace, string blob) throws Statum.Cryptography.EncryptionError;
  13. public EncryptionProvider.with_keys (uint8[] signing_secret_key, uint8[] signing_public_key, uint8[] sealing_secret_key, uint8[] sealing_public_key) throws Locksmith.Error;
  14. }
  15. [CCode (cheader_filename = "statum-0.1.h")]
  16. public class SigningProvider : GLib.Object {
  17. public SigningProvider ();
  18. public Statum.Model.FrameDto author_frame (string content);
  19. public uint8[] get_public_key ();
  20. public string sign (string content);
  21. public bool verify (string content, string signature_b64);
  22. public void verify_frame (Statum.Model.FrameDto frame) throws Statum.Cryptography.SigningError;
  23. public bool verify_with_key (string content, string signature_b64, uint8[] verification_public_key);
  24. public SigningProvider.with_keys (uint8[] secret_key, uint8[] public_key) throws Locksmith.Error;
  25. public string signer_id { get; set; }
  26. }
  27. [CCode (cheader_filename = "statum-0.1.h")]
  28. public errordomain EncryptionError {
  29. DECRYPTION_FAILED,
  30. SIGNATURE_INVALID,
  31. NAMESPACE_MISMATCH
  32. }
  33. [CCode (cheader_filename = "statum-0.1.h")]
  34. public errordomain SigningError {
  35. INVALID_SIGNATURE
  36. }
  37. }
  38. namespace Model {
  39. [CCode (cheader_filename = "statum-0.1.h")]
  40. public class ActionDto : GLib.Object {
  41. public ActionDto ();
  42. public static Invercargill.Mapping.PropertyMapper<Statum.Model.ActionDto> get_mapper ();
  43. public InvercargillJson.JsonElement to_element () throws GLib.Error;
  44. public string method { get; set; }
  45. public string? @private { get; set; }
  46. public string uri { get; set; }
  47. }
  48. [CCode (cheader_filename = "statum-0.1.h")]
  49. public class ClearDirectiveDto : Statum.Model.DirectiveDto {
  50. public ClearDirectiveDto ();
  51. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  52. public static Invercargill.Mapping.PropertyMapper<Statum.Model.ClearDirectiveDto> get_mapper ();
  53. public ClearDirectiveDto.with_key (string key);
  54. public override string discriminator { get; }
  55. public string key { get; set; }
  56. }
  57. [CCode (cheader_filename = "statum-0.1.h")]
  58. public abstract class DirectiveDto : GLib.Object {
  59. protected DirectiveDto ();
  60. protected abstract Invercargill.Properties build_field_properties () throws GLib.Error;
  61. public static Invercargill.DataStructures.Series<Statum.Model.DirectiveDto> deserialize_array (InvercargillJson.JsonElement element) throws GLib.Error;
  62. public static Statum.Model.DirectiveDto from_json (InvercargillJson.JsonObject json) throws GLib.Error;
  63. public static InvercargillJson.JsonElement serialize_array (Invercargill.Lot<Statum.Model.DirectiveDto> directives) throws GLib.Error;
  64. public InvercargillJson.JsonElement to_json () throws GLib.Error;
  65. public InvercargillJson.JsonObject to_json_object () throws GLib.Error;
  66. public abstract string discriminator { get; }
  67. }
  68. [CCode (cheader_filename = "statum-0.1.h")]
  69. public class ErrorDirectiveDto : Statum.Model.DirectiveDto {
  70. public ErrorDirectiveDto ();
  71. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  72. public static Invercargill.Mapping.PropertyMapper<Statum.Model.ErrorDirectiveDto> get_mapper ();
  73. public string? code { get; set; }
  74. public Invercargill.Properties? data { get; set; }
  75. public override string discriminator { get; }
  76. public string? message { get; set; }
  77. }
  78. [CCode (cheader_filename = "statum-0.1.h")]
  79. public class FormResetDirectiveDto : Statum.Model.DirectiveDto {
  80. public FormResetDirectiveDto ();
  81. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  82. public static Invercargill.Mapping.PropertyMapper<Statum.Model.FormResetDirectiveDto> get_mapper ();
  83. public FormResetDirectiveDto.with_form (string form);
  84. public override string discriminator { get; }
  85. public string form { get; set; }
  86. }
  87. [CCode (cheader_filename = "statum-0.1.h")]
  88. public class FormSubmitDirectiveDto : Statum.Model.DirectiveDto {
  89. public FormSubmitDirectiveDto ();
  90. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  91. public static Invercargill.Mapping.PropertyMapper<Statum.Model.FormSubmitDirectiveDto> get_mapper ();
  92. public FormSubmitDirectiveDto.with_form (string form, string? action = null, string? method = null);
  93. public string? action { get; set; }
  94. public override string discriminator { get; }
  95. public string form { get; set; }
  96. public string? method { get; set; }
  97. }
  98. [CCode (cheader_filename = "statum-0.1.h")]
  99. public class FrameDto : GLib.Object {
  100. public FrameDto ();
  101. public static Invercargill.Mapping.PropertyMapper<Statum.Model.FrameDto> get_mapper ();
  102. public string content { get; set; }
  103. public string signature { get; set; }
  104. public string signer { get; set; }
  105. }
  106. [CCode (cheader_filename = "statum-0.1.h")]
  107. public class InvalidateDirectiveDto : Statum.Model.DirectiveDto {
  108. public InvalidateDirectiveDto ();
  109. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  110. public static Invercargill.Mapping.PropertyMapper<Statum.Model.InvalidateDirectiveDto> get_mapper ();
  111. public InvalidateDirectiveDto.with_signature (string signature);
  112. public override string discriminator { get; }
  113. public string signature { get; set; }
  114. }
  115. [CCode (cheader_filename = "statum-0.1.h")]
  116. public class NavigateDirectiveDto : Statum.Model.DirectiveDto {
  117. public NavigateDirectiveDto ();
  118. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  119. public static Invercargill.Mapping.PropertyMapper<Statum.Model.NavigateDirectiveDto> get_mapper ();
  120. public NavigateDirectiveDto.with_uri (string uri);
  121. public override string discriminator { get; }
  122. public string uri { get; set; }
  123. }
  124. [CCode (cheader_filename = "statum-0.1.h")]
  125. public class NotifyDirectiveDto : Statum.Model.DirectiveDto {
  126. public NotifyDirectiveDto ();
  127. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  128. public static Invercargill.Mapping.PropertyMapper<Statum.Model.NotifyDirectiveDto> get_mapper ();
  129. public NotifyDirectiveDto.@with (string kind, string message);
  130. public override string discriminator { get; }
  131. public string kind { get; set; }
  132. public string message { get; set; }
  133. }
  134. [CCode (cheader_filename = "statum-0.1.h")]
  135. public class PostDirectiveDto : Statum.Model.DirectiveDto {
  136. public PostDirectiveDto ();
  137. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  138. public static Invercargill.Mapping.PropertyMapper<Statum.Model.PostDirectiveDto> get_mapper ();
  139. public PostDirectiveDto.@with (string uri, Invercargill.Properties data);
  140. public Invercargill.Properties data { get; set; }
  141. public override string discriminator { get; }
  142. public string uri { get; set; }
  143. }
  144. [CCode (cheader_filename = "statum-0.1.h")]
  145. public class SetDirectiveDto : Statum.Model.DirectiveDto {
  146. public SetDirectiveDto ();
  147. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  148. public static Invercargill.Mapping.PropertyMapper<Statum.Model.SetDirectiveDto> get_mapper ();
  149. public SetDirectiveDto.with_frame (Statum.Model.FrameDto snapshot_frame);
  150. public override string discriminator { get; }
  151. public Statum.Model.FrameDto snapshot_frame { get; set; }
  152. }
  153. [CCode (cheader_filename = "statum-0.1.h")]
  154. public class SlotDto : GLib.Object {
  155. public SlotDto ();
  156. public static Invercargill.Mapping.PropertyMapper<Statum.Model.SlotDto> get_mapper ();
  157. public string key { get; set; }
  158. public Statum.Scope scope { get; set; }
  159. public string slot_type { get; set; }
  160. }
  161. [CCode (cheader_filename = "statum-0.1.h")]
  162. public class SnapshotDto : GLib.Object {
  163. public SnapshotDto ();
  164. public static Invercargill.Mapping.PropertyMapper<Statum.Model.SnapshotDto> get_mapper ();
  165. public GLib.DateTime as_at { get; set; }
  166. public GLib.DateTime? invalid_after { get; set; }
  167. public string? @private { get; set; }
  168. public Invercargill.Properties @public { get; set; }
  169. public Statum.Model.SlotDto slot { get; set; }
  170. public GLib.DateTime? transmit_after { get; set; }
  171. }
  172. [CCode (cheader_filename = "statum-0.1.h")]
  173. public class SubscribeDirectiveDto : Statum.Model.DirectiveDto {
  174. public SubscribeDirectiveDto ();
  175. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  176. public static Invercargill.Mapping.PropertyMapper<Statum.Model.SubscribeDirectiveDto> get_mapper ();
  177. public SubscribeDirectiveDto.with_key (string key);
  178. public override string discriminator { get; }
  179. public string key { get; set; }
  180. }
  181. [CCode (cheader_filename = "statum-0.1.h")]
  182. public class TransmitDirectiveDto : Statum.Model.DirectiveDto {
  183. public TransmitDirectiveDto ();
  184. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  185. public static Invercargill.Mapping.PropertyMapper<Statum.Model.TransmitDirectiveDto> get_mapper ();
  186. public TransmitDirectiveDto.@with (string key, bool retry);
  187. public override string discriminator { get; }
  188. public string key { get; set; }
  189. public bool retry { get; set; }
  190. }
  191. [CCode (cheader_filename = "statum-0.1.h")]
  192. public class UnsubscribeDirectiveDto : Statum.Model.DirectiveDto {
  193. public UnsubscribeDirectiveDto ();
  194. protected override Invercargill.Properties build_field_properties () throws GLib.Error;
  195. public static Invercargill.Mapping.PropertyMapper<Statum.Model.UnsubscribeDirectiveDto> get_mapper ();
  196. public UnsubscribeDirectiveDto.with_key (string key);
  197. public override string discriminator { get; }
  198. public string key { get; set; }
  199. }
  200. }
  201. [CCode (cheader_filename = "statum-0.1.h")]
  202. public class ActionEndpoint : GLib.Object, Astralis.Endpoint {
  203. public ActionEndpoint ();
  204. }
  205. [CCode (cheader_filename = "statum-0.1.h")]
  206. public class ActionRegistry : GLib.Object {
  207. public ActionRegistry ();
  208. public Statum.Model.ActionDto author<TAction> (string method = "POST");
  209. public Statum.Model.ActionDto author_private<TAction,TPrivate> (TPrivate model, string method = "POST") throws GLib.Error;
  210. public string guid_for<TAction> ();
  211. public string guid_for_type (GLib.Type type);
  212. public string namespace_for<TAction> ();
  213. public string namespace_for_type (GLib.Type type);
  214. public void register<TAction> ();
  215. public void register_type (GLib.Type type);
  216. public GLib.Type? resolve (string guid);
  217. }
  218. [CCode (cheader_filename = "statum-0.1.h")]
  219. public class AuthorizationPolicy : GLib.Object {
  220. public delegate Astralis.HttpResult? Guard (Astralis.HttpContext? http_context);
  221. public AuthorizationPolicy ();
  222. public Astralis.HttpResult? authorize_channel (Astralis.HttpContext? http_context);
  223. public Astralis.HttpResult? authorize_channel_subscriptions (Astralis.HttpContext? http_context);
  224. public Astralis.HttpResult? authorize_entrypoint (Astralis.HttpContext? http_context);
  225. public void guard_channel (owned Statum.AuthorizationPolicy.Guard guard);
  226. public void guard_channel_subscriptions (owned Statum.AuthorizationPolicy.Guard guard);
  227. public void guard_entrypoint (owned Statum.AuthorizationPolicy.Guard guard);
  228. }
  229. [CCode (cheader_filename = "statum-0.1.h")]
  230. public class ChannelEndpoint : Astralis.SseEndpoint, Statum.ChannelService {
  231. public const int MAX_CONNECTIONS_PER_IP;
  232. public const int MAX_SUBSCRIPTIONS_PER_CHANNEL;
  233. public const int MAX_TOTAL_CONNECTIONS;
  234. public ChannelEndpoint ();
  235. public bool can_accept_connection (string? ip);
  236. public bool has_channel (string id);
  237. public override async void new_connection (Astralis.HttpContext http_context, Astralis.RouteContext route_context, Astralis.SseStream stream);
  238. public bool subscribe (string id, string key);
  239. public void unsubscribe (string id, string key);
  240. public Statum.ConnectionTracker connection_tracker { get; private set; }
  241. public override uint retry_interval { get; }
  242. }
  243. [CCode (cheader_filename = "statum-0.1.h")]
  244. public class ChannelGatewayEndpoint : GLib.Object, Astralis.Endpoint {
  245. public ChannelGatewayEndpoint ();
  246. public virtual Astralis.HttpResult? authorize (Astralis.HttpContext http_context);
  247. }
  248. [CCode (cheader_filename = "statum-0.1.h")]
  249. public class ChannelSubscriptionEndpoint : GLib.Object, Astralis.Endpoint {
  250. public ChannelSubscriptionEndpoint ();
  251. public virtual Astralis.HttpResult? authorize (Astralis.HttpContext http_context);
  252. }
  253. [CCode (cheader_filename = "statum-0.1.h")]
  254. public class ClientScript : Statum.ConstantStatumResource {
  255. public ClientScript ();
  256. public override string get_best_encoding (Invercargill.Set<string> supported);
  257. public override unowned uint8[] get_encoding (string encoding);
  258. public override string content_type { get; }
  259. public override string file_hash { get; }
  260. public override string name { get; }
  261. }
  262. [CCode (cheader_filename = "statum-0.1.h")]
  263. public class ClientWorker : Statum.ConstantStatumResource {
  264. public ClientWorker ();
  265. public override string get_best_encoding (Invercargill.Set<string> supported);
  266. public override unowned uint8[] get_encoding (string encoding);
  267. public override string content_type { get; }
  268. public override string file_hash { get; }
  269. public override string name { get; }
  270. }
  271. [CCode (cheader_filename = "statum-0.1.h")]
  272. public class ConnectionTracker : GLib.Object {
  273. public ConnectionTracker (int max_total = ChannelEndpoint.MAX_TOTAL_CONNECTIONS, int max_per_ip = ChannelEndpoint.MAX_CONNECTIONS_PER_IP);
  274. public void acquired (string? ip);
  275. public bool can_accept (string? ip);
  276. public int open_for (string? ip);
  277. public int open_total ();
  278. public void released (string? ip);
  279. public int max_per_ip { get; private set; }
  280. public int max_total { get; private set; }
  281. }
  282. [CCode (cheader_filename = "statum-0.1.h")]
  283. public abstract class ConstantStatumResource : GLib.Object, Statum.StatumResource {
  284. protected ConstantStatumResource ();
  285. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  286. public abstract unowned uint8[] get_encoding (string encoding);
  287. public abstract string content_type { get; }
  288. public abstract string file_hash { get; }
  289. public abstract string name { get; }
  290. }
  291. [CCode (cheader_filename = "statum-0.1.h")]
  292. public class DirectiveBuilder : GLib.Object {
  293. public async Invercargill.Lot<Statum.Model.DirectiveDto> build () throws GLib.Error;
  294. public Statum.DirectiveBuilder clear (string key);
  295. public Statum.DirectiveBuilder error (string message, string? code = null, Invercargill.Properties? data = null);
  296. public Statum.DirectiveBuilder form_reset (string form_id);
  297. public Statum.DirectiveBuilder form_submit (string form_id, string? action = null, string? method = null);
  298. public Statum.DirectiveBuilder invalidate (string signature);
  299. public Statum.DirectiveBuilder navigate (string uri);
  300. public Statum.DirectiveBuilder notify (string kind, string message);
  301. public Statum.DirectiveBuilder post (string uri, Invercargill.Properties data);
  302. public Statum.DirectiveBuilder @set (Statum.Slot slot);
  303. public Statum.DirectiveBuilder set_frame (Statum.Model.FrameDto frame);
  304. public Statum.DirectiveBuilder set_global (string type_name) throws GLib.Error;
  305. public Statum.DirectiveBuilder set_private_typed<TPublic,TPrivate> (string type_name, Statum.Scope scope, TPublic pub, TPrivate priv) throws GLib.Error;
  306. public Statum.DirectiveBuilder set_typed<TPublic> (string type_name, Statum.Scope scope, TPublic pub) throws GLib.Error;
  307. public Statum.DirectiveBuilder subscribe (string key);
  308. public Statum.DirectiveBuilder subscribe_global (string type_name);
  309. public async Invercargill.Lot<Statum.Model.DirectiveDto> to_lot () throws GLib.Error;
  310. public Statum.DirectiveBuilder transmit (string key, bool retry = false);
  311. public Statum.DirectiveBuilder unsubscribe (string key);
  312. public Statum.DirectiveBuilder update (string key, Statum.State state);
  313. public Statum.DirectiveBuilder update_held<TPublic> (string type_name, owned Statum.UpdateMutator<TPublic> mutator) throws GLib.Error;
  314. }
  315. [CCode (cheader_filename = "statum-0.1.h")]
  316. public class EntrypointEndpoint : GLib.Object, Astralis.Endpoint {
  317. public EntrypointEndpoint ();
  318. public virtual Astralis.HttpResult? authorize (Astralis.HttpContext http_context);
  319. }
  320. [CCode (cheader_filename = "statum-0.1.h")]
  321. public class EntrypointMatch : GLib.Object {
  322. public EntrypointMatch ();
  323. public GLib.Type entrypoint_type { get; set; }
  324. public Invercargill.ReadOnlyAssociative<string,string> route_params { get; set; }
  325. }
  326. [CCode (cheader_filename = "statum-0.1.h")]
  327. public class EntrypointRouteTable : GLib.Object {
  328. public EntrypointRouteTable ();
  329. public Statum.EntrypointMatch? match (string uri);
  330. public void register (Astralis.EndpointRoute route, GLib.Type entrypoint_type);
  331. }
  332. [CCode (cheader_filename = "statum-0.1.h")]
  333. public class GObjectMapping : GLib.Object {
  334. public GObjectMapping ();
  335. public static GLib.Object from_properties (GLib.Type type, Invercargill.Properties props) throws GLib.Error;
  336. public static T from_properties_typed<T> (GLib.Type type, Invercargill.Properties props) throws GLib.Error;
  337. public static bool? get_bool (Invercargill.Properties props, string key);
  338. public static double? get_double (Invercargill.Properties props, string key);
  339. public static int? get_int (Invercargill.Properties props, string key);
  340. public static string? get_string (Invercargill.Properties props, string key);
  341. public static void register_mapper<T> (Invercargill.Mapping.PropertyMapper<T> mapper);
  342. public static Invercargill.DataStructures.PropertyDictionary to_properties (GLib.Object model) throws GLib.Error;
  343. }
  344. [CCode (cheader_filename = "statum-0.1.h")]
  345. public class HeldSlot : GLib.Object {
  346. public HeldSlot ();
  347. public GLib.DateTime as_at { get; set; }
  348. public GLib.DateTime? invalid_after { get; set; }
  349. public string key { get; set; }
  350. public Invercargill.Properties @private { get; set; }
  351. public Invercargill.Properties @public { get; set; }
  352. public Statum.Scope scope { get; set; }
  353. public GLib.DateTime? transmit_after { get; set; }
  354. public string type_name { get; set; }
  355. }
  356. [CCode (cheader_filename = "statum-0.1.h")]
  357. public class HeldSlotResolver : GLib.Object {
  358. public HeldSlotResolver ();
  359. public Statum.ResolvedSlots resolve (Astralis.HttpContext http_context);
  360. }
  361. [CCode (cheader_filename = "statum-0.1.h")]
  362. public class HeldStates : GLib.Object {
  363. public T @get<T> (string type_name);
  364. public Invercargill.Properties? get_properties (string type_name);
  365. }
  366. [CCode (cheader_filename = "statum-0.1.h")]
  367. public class ResolvedSlots : GLib.Object {
  368. public ResolvedSlots ();
  369. public Invercargill.DataStructures.Dictionary<string,Statum.HeldSlot> held { get; private set; }
  370. public Invercargill.DataStructures.Series<string> invalid_signatures { get; private set; }
  371. public Invercargill.DataStructures.Series<string> stale_keys { get; private set; }
  372. public Invercargill.DataStructures.Series<string> transmit_keys { get; private set; }
  373. }
  374. [CCode (cheader_filename = "statum-0.1.h")]
  375. public class ResourceEndpoint : GLib.Object, Astralis.Endpoint {
  376. public ResourceEndpoint ();
  377. }
  378. [CCode (cheader_filename = "statum-0.1.h")]
  379. public class Slot : GLib.Object {
  380. public Slot ();
  381. public Statum.State current_state { get; set; }
  382. public string id { get; set; }
  383. public Statum.Scope scope { get; set; }
  384. public string type_name { get; set; }
  385. }
  386. [CCode (cheader_filename = "statum-0.1.h")]
  387. public class SlotPostEndpoint : GLib.Object, Astralis.Endpoint {
  388. public SlotPostEndpoint ();
  389. }
  390. [CCode (cheader_filename = "statum-0.1.h")]
  391. public class State : GLib.Object {
  392. public State ();
  393. public GLib.DateTime last_touched { get; set; }
  394. public Invercargill.Properties private_data { get; set; }
  395. public Invercargill.Properties public_data { get; set; }
  396. public string type_name { get; set; }
  397. }
  398. [CCode (cheader_filename = "statum-0.1.h")]
  399. public abstract class StateModifier : GLib.Object, Statum.TopicStateModifier {
  400. protected Statum.StateService state_service;
  401. protected StateModifier ();
  402. public abstract GLib.Object? derive (GLib.Object payload, GLib.Object? current, Statum.HeldStates held);
  403. public abstract GLib.Type state_type { get; }
  404. public string state_type_name { get; }
  405. }
  406. [CCode (cheader_filename = "statum-0.1.h")]
  407. public class StateService : GLib.Object {
  408. public const string GLOBAL_KEY_PREFIX;
  409. public StateService ();
  410. public void cleanup ();
  411. public async void clear_global (string type_name);
  412. public async void clear_slot (string key);
  413. public Statum.Slot? get_slot (string id);
  414. public Statum.Slot new_global_slot (string type_name, Statum.Scope slot_scope, Statum.State state);
  415. public Statum.Slot new_slot (Statum.Scope slot_scope, Statum.State initial_state);
  416. public bool restore_slot (Statum.Model.FrameDto frame) throws GLib.Error;
  417. public Statum.Model.FrameDto? sign_slot (string id, bool unidirectional = false) throws GLib.Error;
  418. public async Statum.Model.FrameDto update (string key, Statum.State state) throws GLib.Error;
  419. public async Statum.Model.FrameDto update_global (string type_name, Statum.State state) throws GLib.Error;
  420. public async void update_global_typed<TPublic> (string type_name, owned Statum.UpdateMutator<TPublic> mutator) throws GLib.Error;
  421. }
  422. [CCode (cheader_filename = "statum-0.1.h")]
  423. public abstract class StatumAction : GLib.Object, Astralis.Endpoint {
  424. protected Statum.ActionRegistry action_registry;
  425. protected Statum.ChannelService channel_service;
  426. protected Statum.Cryptography.EncryptionProvider encryption_provider;
  427. protected Statum.StatumRequest request;
  428. protected Statum.HeldSlotResolver resolver;
  429. protected Inversion.Scope scope;
  430. protected Statum.StateService state_service;
  431. protected Statum.TopicRegistry topic_registry;
  432. public const string ACTION_PRIVATE_NAMESPACE;
  433. protected StatumAction ();
  434. protected Statum.DirectiveBuilder directives ();
  435. public abstract async Statum.DirectiveBuilder handle () throws GLib.Error;
  436. protected virtual string? private_error_code { get; }
  437. protected virtual string private_error_message { get; }
  438. protected virtual string private_namespace { get; }
  439. protected virtual bool requires_valid_private { get; }
  440. }
  441. [CCode (cheader_filename = "statum-0.1.h")]
  442. public class StatumConfigurator : GLib.Object {
  443. public Statum.StateService state_service;
  444. public Statum.TopicRegistry topic_registry;
  445. public StatumConfigurator ();
  446. public void action<TAction> ();
  447. public void add_page<TPage,TEntrypoint> () throws GLib.Error;
  448. public void add_resource<T> ();
  449. public void add_static_page<TPage> () throws GLib.Error;
  450. public void global<TPublic> (string type_name, TPublic initial) throws GLib.Error;
  451. public void guard_channel (owned Statum.AuthorizationPolicy.Guard guard);
  452. public void guard_channel_subscriptions (owned Statum.AuthorizationPolicy.Guard guard);
  453. public void guard_entrypoint (owned Statum.AuthorizationPolicy.Guard guard);
  454. public void topic<TTopic> (string prefix);
  455. public void topic_modifier<TModifier,TState> (string prefix);
  456. }
  457. [CCode (cheader_filename = "statum-0.1.h")]
  458. public class StatumDirectives : GLib.Object {
  459. public const string CONTENT_TYPE;
  460. public StatumDirectives ();
  461. public static Astralis.HttpResult to_result (Invercargill.Lot<Statum.Model.DirectiveDto> directives, Invercargill.Lot<string>? invalid_signatures = null, Statum.StateService? state_service = null, Invercargill.Lot<string>? stale_keys = null) throws GLib.Error;
  462. public static Astralis.HttpResult transmit_result (Invercargill.Lot<string> transmit_keys, Invercargill.Lot<string>? invalid_signatures = null) throws GLib.Error;
  463. }
  464. [CCode (cheader_filename = "statum-0.1.h")]
  465. public abstract class StatumEntrypoint : GLib.Object {
  466. protected Statum.ActionRegistry action_registry;
  467. protected Statum.ChannelService channel_service;
  468. protected Statum.StatumRequest request;
  469. protected Statum.StateService state_service;
  470. protected Statum.TopicRegistry topic_registry;
  471. protected StatumEntrypoint ();
  472. protected Statum.DirectiveBuilder directives ();
  473. public abstract async Statum.DirectiveBuilder handle () throws GLib.Error;
  474. }
  475. [CCode (cheader_filename = "statum-0.1.h")]
  476. public class StatumModule : GLib.Object, Inversion.Module {
  477. public StatumModule ();
  478. }
  479. [CCode (cheader_filename = "statum-0.1.h")]
  480. public abstract class StatumPage : GLib.Object, Astralis.Endpoint {
  481. protected StatumPage ();
  482. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  483. public abstract unowned uint8[] get_encoding (string encoding);
  484. public abstract string get_etag_for (string encoding);
  485. public abstract string content_type { get; }
  486. public abstract string route { get; }
  487. }
  488. [CCode (cheader_filename = "statum-0.1.h")]
  489. public class StatumRequest : GLib.Object {
  490. public StatumRequest ();
  491. public TPublic held_as<TPublic> (string type_name);
  492. public string? route (string name);
  493. public Invercargill.Properties? action_private { get; set; }
  494. public Astralis.FormData? form { get; set; }
  495. public Invercargill.ReadOnlyAssociative<string,Statum.HeldSlot> held { get; set; }
  496. public Invercargill.DataStructures.Catalogue<string,string> query { get; set; }
  497. public Invercargill.ReadOnlyAssociative<string,string> route_params { get; set; }
  498. public string uri { get; set; }
  499. }
  500. [CCode (cheader_filename = "statum-0.1.h")]
  501. public abstract class Topic<TPayload> : GLib.Object, Statum.TopicLoader {
  502. protected Topic ();
  503. public abstract async TPayload load (string topic_key) throws GLib.Error;
  504. }
  505. [CCode (cheader_filename = "statum-0.1.h")]
  506. public class TopicRegistry : GLib.Object {
  507. public TopicRegistry ();
  508. public void register_modifier<TModifier,TState> (string prefix);
  509. public void register_topic<TTopic> (string prefix);
  510. public void sweep ();
  511. public async void trigger (string topic_key) throws GLib.Error;
  512. public void watch (string topic_key, string slot_key, string slot_type, Invercargill.ReadOnlyAssociative<string,Statum.HeldSlot> request_held);
  513. }
  514. [CCode (cheader_filename = "statum-0.1.h")]
  515. public abstract class TypedStatumAction<TPrivate> : Statum.StatumAction {
  516. protected TypedStatumAction ();
  517. protected override string private_namespace { get; }
  518. protected virtual GLib.Type private_type { get; }
  519. protected TPrivate request_private { get; }
  520. protected override bool requires_valid_private { get; }
  521. }
  522. [CCode (cheader_filename = "statum-0.1.h")]
  523. public interface ChannelService : GLib.Object {
  524. public abstract async void push_clear (string key);
  525. public abstract async void push_set (string key, string frame_json);
  526. }
  527. [CCode (cheader_filename = "statum-0.1.h")]
  528. public interface StatumResource : GLib.Object {
  529. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  530. public abstract string get_etag_for (string encoding);
  531. public abstract Astralis.HttpResult to_result (string encoding, Astralis.StatusCode status = Astralis.StatusCode.OK) throws GLib.Error;
  532. public abstract string name { get; }
  533. }
  534. [CCode (cheader_filename = "statum-0.1.h")]
  535. public interface TopicLoader : GLib.Object {
  536. public abstract async GLib.Object? load_payload (string topic_key) throws GLib.Error;
  537. }
  538. [CCode (cheader_filename = "statum-0.1.h")]
  539. public interface TopicStateModifier : GLib.Object {
  540. public abstract async Statum.ModifierOutcome apply (GLib.Object payload, string slot_key, Statum.HeldStates held) throws GLib.Error;
  541. public abstract GLib.Type state_type { get; }
  542. }
  543. [CCode (cheader_filename = "statum-0.1.h")]
  544. public enum ModifierOutcome {
  545. UPDATED,
  546. UNCHANGED,
  547. CLEARED
  548. }
  549. [CCode (cheader_filename = "statum-0.1.h")]
  550. public enum Scope {
  551. DEVICE,
  552. SESSION,
  553. FLOW,
  554. PAGE,
  555. TRANSIENT;
  556. public string to_string ();
  557. public static Statum.Scope? from_string (string value);
  558. public static Statum.Scope parse (string value) throws GLib.Error;
  559. }
  560. [CCode (cheader_filename = "statum-0.1.h")]
  561. public errordomain ModelError {
  562. INVALID_SCOPE,
  563. UNKNOWN_DIRECTIVE
  564. }
  565. [CCode (cheader_filename = "statum-0.1.h")]
  566. public errordomain StateError {
  567. SLOT_NOT_FOUND,
  568. FRAME_EXPIRED
  569. }
  570. [CCode (cheader_filename = "statum-0.1.h")]
  571. public errordomain StatumError {
  572. CONFIGURATION
  573. }
  574. [CCode (cheader_filename = "statum-0.1.h")]
  575. public delegate void UpdateMutator<T> (T current);
  576. }