Google Docs API client for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

codec: small lib let open Json.Codec in cleanup

gdocs/{comments,store}, meross/abilities, oci/spec/arch. The
gdocs/comments record had a stray-edit casualty -- a `t_continued`
fragment from an interrupted edit -- collapsed back into a single
clean record. Hoisted `let id (t : t) = t.id` accessor for comments;
others are clash-free.

+8 -7
+3 -1
lib/comments.ml
··· 21 21 resolved : bool; 22 22 } 23 23 24 + let id (t : t) = t.id 25 + 24 26 let pp ppf c = 25 27 let author = if c.author = "" then "(unknown)" else c.author in 26 28 Fmt.pf ppf "%s: %s" author c.content ··· 65 67 anchor; 66 68 resolved; 67 69 }) 68 - |> Object.mem "id" string ~enc:(fun c -> c.id) 70 + |> Object.mem "id" string ~enc:id 69 71 |> Object.opt_mem "author" author_jsont ~enc:(fun _ -> None) 70 72 |> Object.mem "content" string ~dec_absent:"" ~enc:(fun c -> c.content) 71 73 |> Object.opt_mem "quotedFileContent" quoted_jsont ~enc:(fun _ -> None)
+5 -6
lib/store.ml
··· 12 12 type client = { client_id : string; client_secret : string } 13 13 14 14 let client_jsont = 15 - Json.Codec.Object.map ~kind:"gdocs_client" (fun client_id client_secret -> 15 + let open Json.Codec in 16 + Object.map ~kind:"gdocs_client" (fun client_id client_secret -> 16 17 { client_id; client_secret }) 17 - |> Json.Codec.Object.mem "client_id" Json.Codec.string ~enc:(fun c -> 18 - c.client_id) 19 - |> Json.Codec.Object.mem "client_secret" Json.Codec.string ~enc:(fun c -> 20 - c.client_secret) 21 - |> Json.Codec.Object.skip_unknown |> Json.Codec.Object.finish 18 + |> Object.mem "client_id" string ~enc:(fun c -> c.client_id) 19 + |> Object.mem "client_secret" string ~enc:(fun c -> c.client_secret) 20 + |> Object.skip_unknown |> Object.finish 22 21 23 22 let save_file path data = 24 23 Eio.Path.save ~create:(`Or_truncate 0o600) path data;