(** JMAP Binary Data Operations Binary data (files, attachments) is handled separately from JMAP API calls through upload and download endpoints. Reference: RFC 8620 Section 6 *) (** Upload response from POST to upload endpoint *) module Upload = struct type t = { account_id : Jmap_id.t; blob_id : Jmap_id.t; content_type : string; size : Jmap_primitives.UnsignedInt.t; } (** Accessors *) let account_id t = t.account_id let blob_id t = t.blob_id let content_type t = t.content_type let size t = t.size (** Constructor *) let v ~account_id ~blob_id ~content_type ~size = { account_id; blob_id; content_type; size } (** Parse upload response from JSON *) let of_json _json = (* TODO: Implement JSON parsing *) raise (Jmap_error.Parse_error "Upload.of_json not yet implemented") end (** Blob/copy method for copying blobs between accounts *) module BlobCopy = struct type request = { from_account_id : Jmap_id.t; account_id : Jmap_id.t; blob_ids : Jmap_id.t list; } type response = { from_account_id : Jmap_id.t; account_id : Jmap_id.t; copied : (Jmap_id.t * Jmap_id.t) list option; (** old id -> new id *) not_copied : (Jmap_id.t * Jmap_error.set_error_detail) list option; } (** Accessors for request *) let from_account_id (r : request) = r.from_account_id let account_id (r : request) = r.account_id let blob_ids (r : request) = r.blob_ids (** Constructor for request *) let request_v ~from_account_id ~account_id ~blob_ids = { from_account_id; account_id; blob_ids } (** Accessors for response *) let response_from_account_id (r : response) = r.from_account_id let response_account_id (r : response) = r.account_id let copied (r : response) = r.copied let not_copied (r : response) = r.not_copied (** Constructor for response *) let response_v ~from_account_id ~account_id ?copied ?not_copied () = { from_account_id; account_id; copied; not_copied } let request_of_json _json = (* TODO: Implement JSON parsing *) raise (Jmap_error.Parse_error "BlobCopy.request_of_json not yet implemented") let response_of_json _json = (* TODO: Implement JSON parsing *) raise (Jmap_error.Parse_error "BlobCopy.response_of_json not yet implemented") end