···
+
* JMAP protocol implementation based on RFC8620
+
* https://datatracker.ietf.org/doc/html/rfc8620
+
(** Id string as per Section 1.2 *)
+
(** Int bounded within the range -2^53+1 to 2^53-1 as per Section 1.3 *)
+
(** UnsignedInt bounded within the range 0 to 2^53-1 as per Section 1.3 *)
+
type unsigned_int = int
+
(** Date string in RFC3339 format as per Section 1.4 *)
+
(** UTCDate is a Date with 'Z' time zone as per Section 1.4 *)
+
(** Error object as per Section 3.6.2 *)
+
description: string option;
+
(** Set error object as per Section 5.3 *)
+
description: string option;
+
properties: string list option;
+
(* Additional properties for specific error types *)
+
existing_id: id option; (* For alreadyExists error *)
+
(** Invocation object as per Section 3.2 *)
+
method_call_id: string;
+
(** ResultReference object as per Section 3.7 *)
+
type result_reference = {
+
(** FilterOperator, FilterCondition and Filter as per Section 5.5 *)
+
type filter_operator = {
+
operator: string; (* "AND", "OR", "NOT" *)
+
conditions: filter list;
+
and filter_condition = (string * Ezjsonm.value) list
+
| Operator of filter_operator
+
| Condition of filter_condition
+
(** Comparator object for sorting as per Section 5.5 *)
+
is_ascending: bool option; (* Optional, defaults to true *)
+
collation: string option; (* Optional, server-dependent default *)
+
(** PatchObject as per Section 5.3 *)
+
type patch_object = (string * Ezjsonm.value) list
+
(** AddedItem structure as per Section 5.6 *)
+
(** Account object as per Section 1.6.2 *)
+
account_capabilities: (string * Ezjsonm.value) list;
+
(** Core capability object as per Section 2 *)
+
type core_capability = {
+
max_size_upload: unsigned_int;
+
max_concurrent_upload: unsigned_int;
+
max_size_request: unsigned_int;
+
max_concurrent_requests: unsigned_int;
+
max_calls_in_request: unsigned_int;
+
max_objects_in_get: unsigned_int;
+
max_objects_in_set: unsigned_int;
+
collation_algorithms: string list;
+
(** PushSubscription keys object as per Section 7.2 *)
+
(** Session object as per Section 2 *)
+
capabilities: (string * Ezjsonm.value) list;
+
accounts: (id * account) list;
+
primary_accounts: (string * id) list;
+
event_source_url: string option;
+
(** TypeState for state changes as per Section 7.1 *)
+
type type_state = (string * string) list
+
(** StateChange object as per Section 7.1 *)
+
changed: (id * type_state) list;
+
(** PushVerification object as per Section 7.2.2 *)
+
type push_verification = {
+
push_subscription_id: id;
+
verification_code: string;
+
(** PushSubscription object as per Section 7.2 *)
+
type push_subscription = {
+
device_client_id: string;
+
keys: push_keys option;
+
verification_code: string option;
+
expires: utc_date option;
+
types: string list option;
+
(** Request object as per Section 3.3 *)
+
method_calls: Ezjsonm.value invocation list;
+
created_ids: (id * id) list option;
+
(** Response object as per Section 3.4 *)
+
method_responses: Ezjsonm.value invocation list;
+
created_ids: (id * id) list option;
+
(** Standard method arguments and responses *)
+
(** Arguments for Foo/get method as per Section 5.1 *)
+
type 'a get_arguments = {
+
properties: string list option;
+
(** Response for Foo/get method as per Section 5.1 *)
+
type 'a get_response = {
+
(** Arguments for Foo/changes method as per Section 5.2 *)
+
type changes_arguments = {
+
max_changes: unsigned_int option;
+
(** Response for Foo/changes method as per Section 5.2 *)
+
type changes_response = {
+
has_more_changes: bool;
+
(** Arguments for Foo/set method as per Section 5.3 *)
+
type 'a set_arguments = {
+
if_in_state: string option;
+
create: (id * 'a) list option;
+
update: (id * patch_object) list option;
+
destroy: id list option;
+
(** Response for Foo/set method as per Section 5.3 *)
+
type 'a set_response = {
+
old_state: string option;
+
created: (id * 'a) list option;
+
updated: (id * 'a option) list option;
+
destroyed: id list option;
+
not_created: (id * set_error) list option;
+
not_updated: (id * set_error) list option;
+
not_destroyed: (id * set_error) list option;
+
(** Arguments for Foo/copy method as per Section 5.4 *)
+
type 'a copy_arguments = {
+
if_from_in_state: string option;
+
if_in_state: string option;
+
create: (id * 'a) list;
+
on_success_destroy_original: bool option;
+
destroy_from_if_in_state: string option;
+
(** Response for Foo/copy method as per Section 5.4 *)
+
type 'a copy_response = {
+
old_state: string option;
+
created: (id * 'a) list option;
+
not_created: (id * set_error) list option;
+
(** Arguments for Foo/query method as per Section 5.5 *)
+
type query_arguments = {
+
sort: comparator list option;
+
position: int_t option;
+
anchor_offset: int_t option;
+
limit: unsigned_int option;
+
calculate_total: bool option;
+
(** Response for Foo/query method as per Section 5.5 *)
+
type query_response = {
+
can_calculate_changes: bool;
+
position: unsigned_int;
+
total: unsigned_int option;
+
limit: unsigned_int option;
+
(** Arguments for Foo/queryChanges method as per Section 5.6 *)
+
type query_changes_arguments = {
+
sort: comparator list option;
+
since_query_state: string;
+
max_changes: unsigned_int option;
+
calculate_total: bool option;
+
(** Response for Foo/queryChanges method as per Section 5.6 *)
+
type query_changes_response = {
+
old_query_state: string;
+
new_query_state: string;
+
total: unsigned_int option;
+
added: added_item list option;
+
(** Arguments for Blob/copy method as per Section 6.3 *)
+
type blob_copy_arguments = {
+
(** Response for Blob/copy method as per Section 6.3 *)
+
type blob_copy_response = {
+
copied: (id * id) list option;
+
not_copied: (id * set_error) list option;
+
(** Upload response as per Section 6.1 *)
+
type upload_response = {
+
(** Problem details object as per RFC7807 and Section 3.6.1 *)
+
type problem_details = {
+
limit: string option; (* For "limit" error *)