(** Standard JMAP Methods and Core/echo. @see RFC 8620, Section 4 @see RFC 8620, Section 5 *) open Jmap_types open Jmap_error (** Generic representation of a record type. Actual types defined elsewhere. *) type generic_record (** Arguments for /get methods. @see RFC 8620, Section 5.1 *) module Get_args : sig type 'record t val account_id : 'record t -> id val ids : 'record t -> id list option val properties : 'record t -> string list option val v : account_id:id -> ?ids:id list -> ?properties:string list -> unit -> 'record t end (** Response for /get methods. @see RFC 8620, Section 5.1 *) module Get_response : sig type 'record t val account_id : 'record t -> id val state : 'record t -> string val list : 'record t -> 'record list val not_found : 'record t -> id list val v : account_id:id -> state:string -> list:'record list -> not_found:id list -> unit -> 'record t end (** Arguments for /changes methods. @see RFC 8620, Section 5.2 *) module Changes_args : sig type t val account_id : t -> id val since_state : t -> string val max_changes : t -> uint option val v : account_id:id -> since_state:string -> ?max_changes:uint -> unit -> t end (** Response for /changes methods. @see RFC 8620, Section 5.2 *) module Changes_response : sig type t val account_id : t -> id val old_state : t -> string val new_state : t -> string val has_more_changes : t -> bool val created : t -> id list val updated : t -> id list val destroyed : t -> id list val updated_properties : t -> string list option val v : account_id:id -> old_state:string -> new_state:string -> has_more_changes:bool -> created:id list -> updated:id list -> destroyed:id list -> ?updated_properties:string list -> unit -> t end (** Patch object for /set update. A list of (JSON Pointer path, value) pairs. @see RFC 8620, Section 5.3 *) type patch_object = (json_pointer * Yojson.Safe.t) list (** Arguments for /set methods. ['create_record] is the record type without server-set/immutable fields. ['update_record] is the patch object type (usually [patch_object]). @see RFC 8620, Section 5.3 *) module Set_args : sig type ('create_record, 'update_record) t val account_id : ('a, 'b) t -> id val if_in_state : ('a, 'b) t -> string option val create : ('a, 'b) t -> 'a id_map option val update : ('a, 'b) t -> 'b id_map option val destroy : ('a, 'b) t -> id list option val on_success_destroy_original : ('a, 'b) t -> bool option val destroy_from_if_in_state : ('a, 'b) t -> string option val on_destroy_remove_emails : ('a, 'b) t -> bool option val v : account_id:id -> ?if_in_state:string -> ?create:'a id_map -> ?update:'b id_map -> ?destroy:id list -> ?on_success_destroy_original:bool -> ?destroy_from_if_in_state:string -> ?on_destroy_remove_emails:bool -> unit -> ('a, 'b) t end (** Response for /set methods. ['created_record_info] is the server-set info for created records. ['updated_record_info] is the server-set/computed info for updated records. @see RFC 8620, Section 5.3 *) module Set_response : sig type ('created_record_info, 'updated_record_info) t val account_id : ('a, 'b) t -> id val old_state : ('a, 'b) t -> string option val new_state : ('a, 'b) t -> string val created : ('a, 'b) t -> 'a id_map option val updated : ('a, 'b) t -> 'b option id_map option val destroyed : ('a, 'b) t -> id list option val not_created : ('a, 'b) t -> Set_error.t id_map option val not_updated : ('a, 'b) t -> Set_error.t id_map option val not_destroyed : ('a, 'b) t -> Set_error.t id_map option val v : account_id:id -> ?old_state:string -> new_state:string -> ?created:'a id_map -> ?updated:'b option id_map -> ?destroyed:id list -> ?not_created:Set_error.t id_map -> ?not_updated:Set_error.t id_map -> ?not_destroyed:Set_error.t id_map -> unit -> ('a, 'b) t end (** Arguments for /copy methods. ['copy_record_override] contains the record id and override properties. @see RFC 8620, Section 5.4 *) module Copy_args : sig type 'copy_record_override t val from_account_id : 'a t -> id val if_from_in_state : 'a t -> string option val account_id : 'a t -> id val if_in_state : 'a t -> string option val create : 'a t -> 'a id_map val on_success_destroy_original : 'a t -> bool val destroy_from_if_in_state : 'a t -> string option val v : from_account_id:id -> ?if_from_in_state:string -> account_id:id -> ?if_in_state:string -> create:'a id_map -> ?on_success_destroy_original:bool -> ?destroy_from_if_in_state:string -> unit -> 'a t end (** Response for /copy methods. ['created_record_info] is the server-set info for the created copy. @see RFC 8620, Section 5.4 *) module Copy_response : sig type 'created_record_info t val from_account_id : 'a t -> id val account_id : 'a t -> id val old_state : 'a t -> string option val new_state : 'a t -> string val created : 'a t -> 'a id_map option val not_created : 'a t -> Set_error.t id_map option val v : from_account_id:id -> account_id:id -> ?old_state:string -> new_state:string -> ?created:'a id_map -> ?not_created:Set_error.t id_map -> unit -> 'a t end (** Module for filter types. @see RFC 8620, Section 5.5 *) module Filter : sig type t (** Create a filter from a condition (raw JSON) *) val condition : Yojson.Safe.t -> t (** Create a filter from a logical operator and a list of filters *) val operator : [ `AND | `OR | `NOT ] -> t list -> t end (** Comparator for sorting. @see RFC 8620, Section 5.5 *) module Comparator : sig type t val property : t -> string val is_ascending : t -> bool option val collation : t -> string option val keyword : t -> string option val other_fields : t -> Yojson.Safe.t string_map val v : property:string -> ?is_ascending:bool -> ?collation:string -> ?keyword:string -> ?other_fields:Yojson.Safe.t string_map -> unit -> t end (** Arguments for /query methods. @see RFC 8620, Section 5.5 *) module Query_args : sig type t val account_id : t -> id val filter : t -> Filter.t option val sort : t -> Comparator.t list option val position : t -> jint option val anchor : t -> id option val anchor_offset : t -> jint option val limit : t -> uint option val calculate_total : t -> bool option val collapse_threads : t -> bool option val sort_as_tree : t -> bool option val filter_as_tree : t -> bool option val v : account_id:id -> ?filter:Filter.t -> ?sort:Comparator.t list -> ?position:jint -> ?anchor:id -> ?anchor_offset:jint -> ?limit:uint -> ?calculate_total:bool -> ?collapse_threads:bool -> ?sort_as_tree:bool -> ?filter_as_tree:bool -> unit -> t end (** Response for /query methods. @see RFC 8620, Section 5.5 *) module Query_response : sig type t val account_id : t -> id val query_state : t -> string val can_calculate_changes : t -> bool val position : t -> uint val ids : t -> id list val total : t -> uint option val limit : t -> uint option val v : account_id:id -> query_state:string -> can_calculate_changes:bool -> position:uint -> ids:id list -> ?total:uint -> ?limit:uint -> unit -> t end (** Item indicating an added record in /queryChanges. @see RFC 8620, Section 5.6 *) module Added_item : sig type t val id : t -> id val index : t -> uint val v : id:id -> index:uint -> unit -> t end (** Arguments for /queryChanges methods. @see RFC 8620, Section 5.6 *) module Query_changes_args : sig type t val account_id : t -> id val filter : t -> Filter.t option val sort : t -> Comparator.t list option val since_query_state : t -> string val max_changes : t -> uint option val up_to_id : t -> id option val calculate_total : t -> bool option val collapse_threads : t -> bool option val v : account_id:id -> ?filter:Filter.t -> ?sort:Comparator.t list -> since_query_state:string -> ?max_changes:uint -> ?up_to_id:id -> ?calculate_total:bool -> ?collapse_threads:bool -> unit -> t end (** Response for /queryChanges methods. @see RFC 8620, Section 5.6 *) module Query_changes_response : sig type t val account_id : t -> id val old_query_state : t -> string val new_query_state : t -> string val total : t -> uint option val removed : t -> id list val added : t -> Added_item.t list val v : account_id:id -> old_query_state:string -> new_query_state:string -> ?total:uint -> removed:id list -> added:Added_item.t list -> unit -> t end (** Core/echo method: Arguments are mirrored in the response. @see RFC 8620, Section 4 *) type core_echo_args = Yojson.Safe.t type core_echo_response = Yojson.Safe.t