statum-0.1.vapi 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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);
  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);
  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 ChannelEndpoint : Astralis.SseEndpoint, Statum.ChannelService {
  220. public ChannelEndpoint ();
  221. public bool has_channel (string id);
  222. public override async void new_connection (Astralis.HttpContext http_context, Astralis.RouteContext route_context, Astralis.SseStream stream);
  223. public void subscribe (string id, string key);
  224. public void unsubscribe (string id, string key);
  225. public override uint retry_interval { get; }
  226. }
  227. [CCode (cheader_filename = "statum-0.1.h")]
  228. public class ChannelSubscriptionEndpoint : GLib.Object, Astralis.Endpoint {
  229. public ChannelSubscriptionEndpoint ();
  230. }
  231. [CCode (cheader_filename = "statum-0.1.h")]
  232. public class ClientScript : Statum.ConstantStatumResource {
  233. public ClientScript ();
  234. public override string get_best_encoding (Invercargill.Set<string> supported);
  235. public override unowned uint8[] get_encoding (string encoding);
  236. public override string content_type { get; }
  237. public override string file_hash { get; }
  238. public override string name { get; }
  239. }
  240. [CCode (cheader_filename = "statum-0.1.h")]
  241. public class ClientWorker : Statum.ConstantStatumResource {
  242. public ClientWorker ();
  243. public override string get_best_encoding (Invercargill.Set<string> supported);
  244. public override unowned uint8[] get_encoding (string encoding);
  245. public override string content_type { get; }
  246. public override string file_hash { get; }
  247. public override string name { get; }
  248. }
  249. [CCode (cheader_filename = "statum-0.1.h")]
  250. public abstract class ConstantStatumResource : GLib.Object, Statum.StatumResource {
  251. protected ConstantStatumResource ();
  252. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  253. public abstract unowned uint8[] get_encoding (string encoding);
  254. public abstract string content_type { get; }
  255. public abstract string file_hash { get; }
  256. public abstract string name { get; }
  257. }
  258. [CCode (cheader_filename = "statum-0.1.h")]
  259. public class DirectiveBuilder : GLib.Object {
  260. public async Invercargill.Lot<Statum.Model.DirectiveDto> build () throws GLib.Error;
  261. public Statum.DirectiveBuilder clear (string key);
  262. public Statum.DirectiveBuilder error (string message, string? code = null, Invercargill.Properties? data = null);
  263. public Statum.DirectiveBuilder form_reset (string form_id);
  264. public Statum.DirectiveBuilder form_submit (string form_id, string? action = null, string? method = null);
  265. public Statum.DirectiveBuilder invalidate (string signature);
  266. public Statum.DirectiveBuilder navigate (string uri);
  267. public Statum.DirectiveBuilder notify (string kind, string message);
  268. public Statum.DirectiveBuilder post (string uri, Invercargill.Properties data);
  269. public Statum.DirectiveBuilder @set (Statum.Slot slot);
  270. public Statum.DirectiveBuilder set_frame (Statum.Model.FrameDto frame);
  271. public Statum.DirectiveBuilder set_global (string type_name) throws GLib.Error;
  272. public Statum.DirectiveBuilder set_private_typed<TPublic,TPrivate> (string type_name, Statum.Scope scope, TPublic pub, TPrivate priv) throws GLib.Error;
  273. public Statum.DirectiveBuilder set_typed<TPublic> (string type_name, Statum.Scope scope, TPublic pub) throws GLib.Error;
  274. public Statum.DirectiveBuilder subscribe (string key);
  275. public Statum.DirectiveBuilder subscribe_global (string type_name);
  276. public async Invercargill.Lot<Statum.Model.DirectiveDto> to_lot () throws GLib.Error;
  277. public Statum.DirectiveBuilder transmit (string key, bool retry = false);
  278. public Statum.DirectiveBuilder unsubscribe (string key);
  279. public Statum.DirectiveBuilder update (string key, Statum.State state);
  280. public Statum.DirectiveBuilder update_held<TPublic> (string type_name, owned Statum.UpdateMutator<TPublic> mutator) throws GLib.Error;
  281. }
  282. [CCode (cheader_filename = "statum-0.1.h")]
  283. public class EntrypointEndpoint : GLib.Object, Astralis.Endpoint {
  284. public EntrypointEndpoint ();
  285. }
  286. [CCode (cheader_filename = "statum-0.1.h")]
  287. public class EntrypointMatch : GLib.Object {
  288. public EntrypointMatch ();
  289. public GLib.Type entrypoint_type { get; set; }
  290. public Invercargill.ReadOnlyAssociative<string,string> route_params { get; set; }
  291. }
  292. [CCode (cheader_filename = "statum-0.1.h")]
  293. public class EntrypointRouteTable : GLib.Object {
  294. public EntrypointRouteTable ();
  295. public Statum.EntrypointMatch? match (string uri);
  296. public void register (Astralis.EndpointRoute route, GLib.Type entrypoint_type);
  297. }
  298. [CCode (cheader_filename = "statum-0.1.h")]
  299. public class GObjectMapping : GLib.Object {
  300. public GObjectMapping ();
  301. public static GLib.Object from_properties (GLib.Type type, Invercargill.Properties props) throws GLib.Error;
  302. public static T from_properties_typed<T> (GLib.Type type, Invercargill.Properties props) throws GLib.Error;
  303. public static bool? get_bool (Invercargill.Properties props, string key);
  304. public static double? get_double (Invercargill.Properties props, string key);
  305. public static int? get_int (Invercargill.Properties props, string key);
  306. public static string? get_string (Invercargill.Properties props, string key);
  307. public static void register_mapper<T> (Invercargill.Mapping.PropertyMapper<T> mapper);
  308. public static Invercargill.DataStructures.PropertyDictionary to_properties (GLib.Object model) throws GLib.Error;
  309. }
  310. [CCode (cheader_filename = "statum-0.1.h")]
  311. public class HeldSlot : GLib.Object {
  312. public HeldSlot ();
  313. public GLib.DateTime as_at { get; set; }
  314. public GLib.DateTime? invalid_after { get; set; }
  315. public string key { get; set; }
  316. public Invercargill.Properties @private { get; set; }
  317. public Invercargill.Properties @public { get; set; }
  318. public Statum.Scope scope { get; set; }
  319. public GLib.DateTime? transmit_after { get; set; }
  320. public string type_name { get; set; }
  321. }
  322. [CCode (cheader_filename = "statum-0.1.h")]
  323. public class HeldSlotResolver : GLib.Object {
  324. public HeldSlotResolver ();
  325. public Statum.ResolvedSlots resolve (Astralis.HttpContext http_context);
  326. }
  327. [CCode (cheader_filename = "statum-0.1.h")]
  328. public class HeldStates : GLib.Object {
  329. public T @get<T> (string type_name);
  330. public Invercargill.Properties? get_properties (string type_name);
  331. }
  332. [CCode (cheader_filename = "statum-0.1.h")]
  333. public class ResolvedSlots : GLib.Object {
  334. public ResolvedSlots ();
  335. public Invercargill.DataStructures.Dictionary<string,Statum.HeldSlot> held { get; private set; }
  336. public Invercargill.DataStructures.Series<string> invalid_signatures { get; private set; }
  337. public Invercargill.DataStructures.Series<string> stale_keys { get; private set; }
  338. public Invercargill.DataStructures.Series<string> transmit_keys { get; private set; }
  339. }
  340. [CCode (cheader_filename = "statum-0.1.h")]
  341. public class ResourceEndpoint : GLib.Object, Astralis.Endpoint {
  342. public ResourceEndpoint ();
  343. }
  344. [CCode (cheader_filename = "statum-0.1.h")]
  345. public class Slot : GLib.Object {
  346. public Slot ();
  347. public Statum.State current_state { get; set; }
  348. public string id { get; set; }
  349. public Statum.Scope scope { get; set; }
  350. public string type_name { get; set; }
  351. }
  352. [CCode (cheader_filename = "statum-0.1.h")]
  353. public class SlotPostEndpoint : GLib.Object, Astralis.Endpoint {
  354. public SlotPostEndpoint ();
  355. }
  356. [CCode (cheader_filename = "statum-0.1.h")]
  357. public class State : GLib.Object {
  358. public State ();
  359. public GLib.DateTime last_touched { get; set; }
  360. public Invercargill.Properties private_data { get; set; }
  361. public Invercargill.Properties public_data { get; set; }
  362. public string type_name { get; set; }
  363. }
  364. [CCode (cheader_filename = "statum-0.1.h")]
  365. public abstract class StateModifier : GLib.Object, Statum.TopicStateModifier {
  366. protected Statum.StateService state_service;
  367. protected StateModifier ();
  368. public abstract GLib.Object? derive (GLib.Object payload, GLib.Object? current, Statum.HeldStates held);
  369. public abstract GLib.Type state_type { get; }
  370. public string state_type_name { get; }
  371. }
  372. [CCode (cheader_filename = "statum-0.1.h")]
  373. public class StateService : GLib.Object {
  374. public const string GLOBAL_KEY_PREFIX;
  375. public StateService ();
  376. public void cleanup ();
  377. public async void clear_global (string type_name);
  378. public async void clear_slot (string key);
  379. public Statum.Slot? get_slot (string id);
  380. public Statum.Slot new_global_slot (string type_name, Statum.Scope slot_scope, Statum.State state);
  381. public Statum.Slot new_slot (Statum.Scope slot_scope, Statum.State initial_state);
  382. public bool restore_slot (Statum.Model.FrameDto frame) throws GLib.Error;
  383. public Statum.Model.FrameDto? sign_slot (string id, bool unidirectional = false) throws GLib.Error;
  384. public async Statum.Model.FrameDto update (string key, Statum.State state) throws GLib.Error;
  385. public async Statum.Model.FrameDto update_global (string type_name, Statum.State state) throws GLib.Error;
  386. public async void update_global_typed<TPublic> (string type_name, owned Statum.UpdateMutator<TPublic> mutator) throws GLib.Error;
  387. }
  388. [CCode (cheader_filename = "statum-0.1.h")]
  389. public abstract class StatumAction : GLib.Object, Astralis.Endpoint {
  390. protected Statum.ActionRegistry action_registry;
  391. protected Statum.ChannelService channel_service;
  392. protected Statum.Cryptography.EncryptionProvider encryption_provider;
  393. protected Statum.StatumRequest request;
  394. protected Statum.HeldSlotResolver resolver;
  395. protected Inversion.Scope scope;
  396. protected Statum.StateService state_service;
  397. protected Statum.TopicRegistry topic_registry;
  398. public const string ACTION_PRIVATE_NAMESPACE;
  399. protected StatumAction ();
  400. protected Statum.DirectiveBuilder directives ();
  401. public abstract async Statum.DirectiveBuilder handle () throws GLib.Error;
  402. protected virtual string? private_error_code { get; }
  403. protected virtual string private_error_message { get; }
  404. protected virtual string private_namespace { get; }
  405. protected virtual bool requires_valid_private { get; }
  406. }
  407. [CCode (cheader_filename = "statum-0.1.h")]
  408. public class StatumConfigurator : GLib.Object {
  409. public Statum.StateService state_service;
  410. public Statum.TopicRegistry topic_registry;
  411. public StatumConfigurator ();
  412. public void action<TAction> ();
  413. public void add_page<TPage,TEntrypoint> () throws GLib.Error;
  414. public void add_resource<T> ();
  415. public void add_static_page<TPage> () throws GLib.Error;
  416. public void global<TPublic> (string type_name, TPublic initial) throws GLib.Error;
  417. public void topic<TTopic> (string prefix);
  418. public void topic_modifier<TModifier,TState> (string prefix);
  419. }
  420. [CCode (cheader_filename = "statum-0.1.h")]
  421. public class StatumDirectives : GLib.Object {
  422. public const string CONTENT_TYPE;
  423. public StatumDirectives ();
  424. 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;
  425. public static Astralis.HttpResult transmit_result (Invercargill.Lot<string> transmit_keys, Invercargill.Lot<string>? invalid_signatures = null) throws GLib.Error;
  426. }
  427. [CCode (cheader_filename = "statum-0.1.h")]
  428. public abstract class StatumEntrypoint : GLib.Object {
  429. protected Statum.ActionRegistry action_registry;
  430. protected Statum.ChannelService channel_service;
  431. protected Statum.StatumRequest request;
  432. protected Statum.StateService state_service;
  433. protected Statum.TopicRegistry topic_registry;
  434. protected StatumEntrypoint ();
  435. protected Statum.DirectiveBuilder directives ();
  436. public abstract async Statum.DirectiveBuilder handle () throws GLib.Error;
  437. }
  438. [CCode (cheader_filename = "statum-0.1.h")]
  439. public class StatumModule : GLib.Object, Inversion.Module {
  440. public StatumModule ();
  441. }
  442. [CCode (cheader_filename = "statum-0.1.h")]
  443. public abstract class StatumPage : GLib.Object, Astralis.Endpoint {
  444. protected StatumPage ();
  445. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  446. public abstract unowned uint8[] get_encoding (string encoding);
  447. public abstract string get_etag_for (string encoding);
  448. public abstract string content_type { get; }
  449. public abstract string route { get; }
  450. }
  451. [CCode (cheader_filename = "statum-0.1.h")]
  452. public class StatumRequest : GLib.Object {
  453. public StatumRequest ();
  454. public TPublic held_as<TPublic> (string type_name);
  455. public string? route (string name);
  456. public Invercargill.Properties? action_private { get; set; }
  457. public Astralis.FormData? form { get; set; }
  458. public Invercargill.ReadOnlyAssociative<string,Statum.HeldSlot> held { get; set; }
  459. public Invercargill.DataStructures.Catalogue<string,string> query { get; set; }
  460. public Invercargill.ReadOnlyAssociative<string,string> route_params { get; set; }
  461. public string uri { get; set; }
  462. }
  463. [CCode (cheader_filename = "statum-0.1.h")]
  464. public abstract class Topic<TPayload> : GLib.Object, Statum.TopicLoader {
  465. protected Topic ();
  466. public abstract async TPayload load (string topic_key) throws GLib.Error;
  467. }
  468. [CCode (cheader_filename = "statum-0.1.h")]
  469. public class TopicRegistry : GLib.Object {
  470. public TopicRegistry ();
  471. public void register_modifier<TModifier,TState> (string prefix);
  472. public void register_topic<TTopic> (string prefix);
  473. public void sweep ();
  474. public async void trigger (string topic_key) throws GLib.Error;
  475. public void watch (string topic_key, string slot_key, string slot_type, Invercargill.ReadOnlyAssociative<string,Statum.HeldSlot> request_held);
  476. }
  477. [CCode (cheader_filename = "statum-0.1.h")]
  478. public abstract class TypedStatumAction<TPrivate> : Statum.StatumAction {
  479. protected TypedStatumAction ();
  480. protected override string private_namespace { get; }
  481. protected virtual GLib.Type private_type { get; }
  482. protected TPrivate request_private { get; }
  483. protected override bool requires_valid_private { get; }
  484. }
  485. [CCode (cheader_filename = "statum-0.1.h")]
  486. public interface ChannelService : GLib.Object {
  487. public abstract async void push_clear (string key);
  488. public abstract async void push_set (string key, string frame_json);
  489. }
  490. [CCode (cheader_filename = "statum-0.1.h")]
  491. public interface StatumResource : GLib.Object {
  492. public abstract string get_best_encoding (Invercargill.Set<string> supported);
  493. public abstract string get_etag_for (string encoding);
  494. public abstract Astralis.HttpResult to_result (string encoding, Astralis.StatusCode status = Astralis.StatusCode.OK) throws GLib.Error;
  495. public abstract string name { get; }
  496. }
  497. [CCode (cheader_filename = "statum-0.1.h")]
  498. public interface TopicLoader : GLib.Object {
  499. public abstract async GLib.Object? load_payload (string topic_key) throws GLib.Error;
  500. }
  501. [CCode (cheader_filename = "statum-0.1.h")]
  502. public interface TopicStateModifier : GLib.Object {
  503. public abstract async Statum.ModifierOutcome apply (GLib.Object payload, string slot_key, Statum.HeldStates held) throws GLib.Error;
  504. public abstract GLib.Type state_type { get; }
  505. }
  506. [CCode (cheader_filename = "statum-0.1.h")]
  507. public enum ModifierOutcome {
  508. UPDATED,
  509. UNCHANGED,
  510. CLEARED
  511. }
  512. [CCode (cheader_filename = "statum-0.1.h")]
  513. public enum Scope {
  514. DEVICE,
  515. SESSION,
  516. FLOW,
  517. PAGE,
  518. TRANSIENT;
  519. public string to_string ();
  520. public static Statum.Scope? from_string (string value);
  521. public static Statum.Scope parse (string value) throws GLib.Error;
  522. }
  523. [CCode (cheader_filename = "statum-0.1.h")]
  524. public errordomain ModelError {
  525. INVALID_SCOPE,
  526. UNKNOWN_DIRECTIVE
  527. }
  528. [CCode (cheader_filename = "statum-0.1.h")]
  529. public errordomain StateError {
  530. SLOT_NOT_FOUND
  531. }
  532. [CCode (cheader_filename = "statum-0.1.h")]
  533. public errordomain StatumError {
  534. CONFIGURATION
  535. }
  536. [CCode (cheader_filename = "statum-0.1.h")]
  537. public delegate void UpdateMutator<T> (T current);
  538. }