My agentic slop goes here. Not intended for anyone else!
at main 2.3 kB view raw
1(** JMAP Binary Data Operations 2 3 Binary data (files, attachments) is handled separately from JMAP API calls 4 through upload and download endpoints. 5 6 Reference: RFC 8620 Section 6 7*) 8 9(** Upload response from POST to upload endpoint *) 10module Upload = struct 11 type t = { 12 account_id : Jmap_id.t; 13 blob_id : Jmap_id.t; 14 content_type : string; 15 size : Jmap_primitives.UnsignedInt.t; 16 } 17 18 (** Accessors *) 19 let account_id t = t.account_id 20 let blob_id t = t.blob_id 21 let content_type t = t.content_type 22 let size t = t.size 23 24 (** Constructor *) 25 let v ~account_id ~blob_id ~content_type ~size = 26 { account_id; blob_id; content_type; size } 27 28 (** Parse upload response from JSON *) 29 let of_json _json = 30 (* TODO: Implement JSON parsing *) 31 raise (Jmap_error.Parse_error "Upload.of_json not yet implemented") 32end 33 34(** Blob/copy method for copying blobs between accounts *) 35module BlobCopy = struct 36 type request = { 37 from_account_id : Jmap_id.t; 38 account_id : Jmap_id.t; 39 blob_ids : Jmap_id.t list; 40 } 41 42 type response = { 43 from_account_id : Jmap_id.t; 44 account_id : Jmap_id.t; 45 copied : (Jmap_id.t * Jmap_id.t) list option; (** old id -> new id *) 46 not_copied : (Jmap_id.t * Jmap_error.set_error_detail) list option; 47 } 48 49 (** Accessors for request *) 50 let from_account_id (r : request) = r.from_account_id 51 let account_id (r : request) = r.account_id 52 let blob_ids (r : request) = r.blob_ids 53 54 (** Constructor for request *) 55 let request_v ~from_account_id ~account_id ~blob_ids = 56 { from_account_id; account_id; blob_ids } 57 58 (** Accessors for response *) 59 let response_from_account_id (r : response) = r.from_account_id 60 let response_account_id (r : response) = r.account_id 61 let copied (r : response) = r.copied 62 let not_copied (r : response) = r.not_copied 63 64 (** Constructor for response *) 65 let response_v ~from_account_id ~account_id ?copied ?not_copied () = 66 { from_account_id; account_id; copied; not_copied } 67 68 let request_of_json _json = 69 (* TODO: Implement JSON parsing *) 70 raise (Jmap_error.Parse_error "BlobCopy.request_of_json not yet implemented") 71 72 let response_of_json _json = 73 (* TODO: Implement JSON parsing *) 74 raise (Jmap_error.Parse_error "BlobCopy.response_of_json not yet implemented") 75end