| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using Invercargill;
- using Invercargill.Mapping;
- namespace Statum.Model {
- /**
- * A Statum slot.
- *
- * A slot is an addressable container for a single snapshot. Its `key` is a
- * server-issued identifier used on the wire (in headers and directives),
- * its `scope` controls client-side persistence, and its `slot_type` is an
- * application-defined name under which the frontend exposes the slot's
- * current {@link SnapshotDto.public} data.
- *
- * Statum assumes at most one slot per type on the client.
- */
- public class SlotDto : Object {
- /** Server-issued identifier for the slot. */
- public string key { get; set; }
- /** Client-side persistence scope for the slot. */
- public Scope scope { get; set; }
- /**
- * Application-defined type name for the slot.
- *
- * Named `slot_type` (rather than `type`) because GObject reserves a
- * property named `type`; the JSON key remains `type` via the mapper.
- */
- public string slot_type { get; set; }
- /**
- * The {@link PropertyMapper} used to (de)serialise a {@link SlotDto}
- * to/from a {@link Invercargill.Properties} object (and therefore
- * JSON via Invercargill-Json).
- */
- public static PropertyMapper<SlotDto> get_mapper() {
- return PropertyMapper.build_for<SlotDto>(cfg => {
- cfg.map<string>("key", o => o.key, (o, v) => o.key = v);
- cfg.map<string>("scope", o => o.scope.to_string(), (o, v) => o.scope = Scope.parse(v));
- cfg.map<string>("type", o => o.slot_type, (o, v) => o.slot_type = v);
- cfg.set_constructor(() => new SlotDto());
- });
- }
- }
- }
|