···55 let nsid = "app.bsky.contact.startPhoneVerification"
6677 type params = unit
88-98 let params_to_yojson () = `Assoc []
1091111- type input = {phone: string} [@@deriving yojson {strict= false}]
1010+ type input =
1111+ {
1212+ phone: string;
1313+ }
1414+ [@@deriving yojson {strict= false}]
12151316 type output = unit
1717+let output_of_yojson _ = Ok ()
1818+let output_to_yojson () = `Assoc []
14191515- let output_of_yojson _ = Ok ()
1616-1717- let output_to_yojson () = `Assoc []
1818-1919- let call ~phone (client : Hermes.client) : output Lwt.t =
2020+ let call
2121+ ~phone
2222+ (client : Hermes.client) : output Lwt.t =
2023 let params = () in
2124 let input = Some ({phone} |> input_to_yojson) in
2222- Hermes.procedure client nsid (params_to_yojson params) input
2323- output_of_yojson
2525+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2426end
2727+
+17-6
pegasus/lexicons/app_bsky_contact_verifyPhone.ml
···55 let nsid = "app.bsky.contact.verifyPhone"
6677 type params = unit
88-98 let params_to_yojson () = `Assoc []
1091111- type input = {phone: string; code: string} [@@deriving yojson {strict= false}]
1010+ type input =
1111+ {
1212+ phone: string;
1313+ code: string;
1414+ }
1515+ [@@deriving yojson {strict= false}]
12161313- type output = {token: string} [@@deriving yojson {strict= false}]
1717+ type output =
1818+ {
1919+ token: string;
2020+ }
2121+[@@deriving yojson {strict= false}]
14221515- let call ~phone ~code (client : Hermes.client) : output Lwt.t =
2323+ let call
2424+ ~phone
2525+ ~code
2626+ (client : Hermes.client) : output Lwt.t =
1627 let params = () in
1728 let input = Some ({phone; code} |> input_to_yojson) in
1818- Hermes.procedure client nsid (params_to_yojson params) input
1919- output_of_yojson
2929+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2030end
3131+
+29
pegasus/lexicons/app_bsky_draft_createDraft.ml
···11+(* generated from app.bsky.draft.createDraft *)
22+33+(** Inserts a draft using private storage (stash). An upper limit of drafts might be enforced. Requires authentication. *)
44+module Main = struct
55+ let nsid = "app.bsky.draft.createDraft"
66+77+ type params = unit
88+ let params_to_yojson () = `Assoc []
99+1010+ type input =
1111+ {
1212+ draft: App_bsky_draft_defs.draft;
1313+ }
1414+ [@@deriving yojson {strict= false}]
1515+1616+ type output =
1717+ {
1818+ id: string;
1919+ }
2020+[@@deriving yojson {strict= false}]
2121+2222+ let call
2323+ ~draft
2424+ (client : Hermes.client) : output Lwt.t =
2525+ let params = () in
2626+ let input = Some ({draft} |> input_to_yojson) in
2727+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2828+end
2929+
+173
pegasus/lexicons/app_bsky_draft_defs.ml
···11+(* generated from app.bsky.draft.defs *)
22+33+type draft_embed_record =
44+ {
55+ record: Com_atproto_repo_strongRef.main;
66+ }
77+[@@deriving yojson {strict= false}]
88+99+type draft_embed_external =
1010+ {
1111+ uri: string;
1212+ }
1313+[@@deriving yojson {strict= false}]
1414+1515+type draft_embed_caption =
1616+ {
1717+ lang: string;
1818+ content: string;
1919+ }
2020+[@@deriving yojson {strict= false}]
2121+2222+type draft_embed_local_ref =
2323+ {
2424+ path: string;
2525+ }
2626+[@@deriving yojson {strict= false}]
2727+2828+type draft_embed_video =
2929+ {
3030+ local_ref: draft_embed_local_ref [@key "localRef"];
3131+ alt: string option [@default None];
3232+ captions: draft_embed_caption list option [@default None];
3333+ }
3434+[@@deriving yojson {strict= false}]
3535+3636+type draft_embed_image =
3737+ {
3838+ local_ref: draft_embed_local_ref [@key "localRef"];
3939+ alt: string option [@default None];
4040+ }
4141+[@@deriving yojson {strict= false}]
4242+4343+type labels =
4444+ | SelfLabels of Com_atproto_label_defs.self_labels
4545+ | Unknown of Yojson.Safe.t
4646+4747+let labels_of_yojson json =
4848+ let open Yojson.Safe.Util in
4949+ try
5050+ match json |> member "$type" |> to_string with
5151+ | "com.atproto.label.defs#selfLabels" ->
5252+ (match Com_atproto_label_defs.self_labels_of_yojson json with
5353+ | Ok v -> Ok (SelfLabels v)
5454+ | Error e -> Error e)
5555+ | _ -> Ok (Unknown json)
5656+ with _ -> Error "failed to parse union"
5757+5858+let labels_to_yojson = function
5959+ | SelfLabels v ->
6060+ (match Com_atproto_label_defs.self_labels_to_yojson v with
6161+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.label.defs#selfLabels") :: fields)
6262+ | other -> other)
6363+ | Unknown j -> j
6464+6565+type draft_post =
6666+ {
6767+ text: string;
6868+ labels: labels option [@default None];
6969+ embed_images: draft_embed_image list option [@key "embedImages"] [@default None];
7070+ embed_videos: draft_embed_video list option [@key "embedVideos"] [@default None];
7171+ embed_externals: draft_embed_external list option [@key "embedExternals"] [@default None];
7272+ embed_records: draft_embed_record list option [@key "embedRecords"] [@default None];
7373+ }
7474+[@@deriving yojson {strict= false}]
7575+7676+type threadgate_allow_item =
7777+ | MentionRule of App_bsky_feed_threadgate.mention_rule
7878+ | FollowerRule of App_bsky_feed_threadgate.follower_rule
7979+ | FollowingRule of App_bsky_feed_threadgate.following_rule
8080+ | ListRule of App_bsky_feed_threadgate.list_rule
8181+ | Unknown of Yojson.Safe.t
8282+8383+let threadgate_allow_item_of_yojson json =
8484+ let open Yojson.Safe.Util in
8585+ try
8686+ match json |> member "$type" |> to_string with
8787+ | "app.bsky.feed.threadgate#mentionRule" ->
8888+ (match App_bsky_feed_threadgate.mention_rule_of_yojson json with
8989+ | Ok v -> Ok (MentionRule v)
9090+ | Error e -> Error e)
9191+ | "app.bsky.feed.threadgate#followerRule" ->
9292+ (match App_bsky_feed_threadgate.follower_rule_of_yojson json with
9393+ | Ok v -> Ok (FollowerRule v)
9494+ | Error e -> Error e)
9595+ | "app.bsky.feed.threadgate#followingRule" ->
9696+ (match App_bsky_feed_threadgate.following_rule_of_yojson json with
9797+ | Ok v -> Ok (FollowingRule v)
9898+ | Error e -> Error e)
9999+ | "app.bsky.feed.threadgate#listRule" ->
100100+ (match App_bsky_feed_threadgate.list_rule_of_yojson json with
101101+ | Ok v -> Ok (ListRule v)
102102+ | Error e -> Error e)
103103+ | _ -> Ok (Unknown json)
104104+ with _ -> Error "failed to parse union"
105105+106106+let threadgate_allow_item_to_yojson = function
107107+ | MentionRule v ->
108108+ (match App_bsky_feed_threadgate.mention_rule_to_yojson v with
109109+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.feed.threadgate#mentionRule") :: fields)
110110+ | other -> other)
111111+ | FollowerRule v ->
112112+ (match App_bsky_feed_threadgate.follower_rule_to_yojson v with
113113+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.feed.threadgate#followerRule") :: fields)
114114+ | other -> other)
115115+ | FollowingRule v ->
116116+ (match App_bsky_feed_threadgate.following_rule_to_yojson v with
117117+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.feed.threadgate#followingRule") :: fields)
118118+ | other -> other)
119119+ | ListRule v ->
120120+ (match App_bsky_feed_threadgate.list_rule_to_yojson v with
121121+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.feed.threadgate#listRule") :: fields)
122122+ | other -> other)
123123+ | Unknown j -> j
124124+125125+type postgate_embedding_rules_item =
126126+ | DisableRule of App_bsky_feed_postgate.disable_rule
127127+ | Unknown of Yojson.Safe.t
128128+129129+let postgate_embedding_rules_item_of_yojson json =
130130+ let open Yojson.Safe.Util in
131131+ try
132132+ match json |> member "$type" |> to_string with
133133+ | "app.bsky.feed.postgate#disableRule" ->
134134+ (match App_bsky_feed_postgate.disable_rule_of_yojson json with
135135+ | Ok v -> Ok (DisableRule v)
136136+ | Error e -> Error e)
137137+ | _ -> Ok (Unknown json)
138138+ with _ -> Error "failed to parse union"
139139+140140+let postgate_embedding_rules_item_to_yojson = function
141141+ | DisableRule v ->
142142+ (match App_bsky_feed_postgate.disable_rule_to_yojson v with
143143+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.feed.postgate#disableRule") :: fields)
144144+ | other -> other)
145145+ | Unknown j -> j
146146+147147+type draft =
148148+ {
149149+ device_id: string option [@key "deviceId"] [@default None];
150150+ device_name: string option [@key "deviceName"] [@default None];
151151+ posts: draft_post list;
152152+ langs: string list option [@default None];
153153+ postgate_embedding_rules: postgate_embedding_rules_item list option [@key "postgateEmbeddingRules"] [@default None];
154154+ threadgate_allow: threadgate_allow_item list option [@key "threadgateAllow"] [@default None];
155155+ }
156156+[@@deriving yojson {strict= false}]
157157+158158+type draft_with_id =
159159+ {
160160+ id: string;
161161+ draft: draft;
162162+ }
163163+[@@deriving yojson {strict= false}]
164164+165165+type draft_view =
166166+ {
167167+ id: string;
168168+ draft: draft;
169169+ created_at: string [@key "createdAt"];
170170+ updated_at: string [@key "updatedAt"];
171171+ }
172172+[@@deriving yojson {strict= false}]
173173+
+26
pegasus/lexicons/app_bsky_draft_deleteDraft.ml
···11+(* generated from app.bsky.draft.deleteDraft *)
22+33+(** Deletes a draft by ID. Requires authentication. *)
44+module Main = struct
55+ let nsid = "app.bsky.draft.deleteDraft"
66+77+ type params = unit
88+ let params_to_yojson () = `Assoc []
99+1010+ type input =
1111+ {
1212+ id: string;
1313+ }
1414+ [@@deriving yojson {strict= false}]
1515+1616+ type output = unit
1717+ let output_of_yojson _ = Ok ()
1818+1919+ let call
2020+ ~id
2121+ (client : Hermes.client) : output Lwt.t =
2222+ let params = () in
2323+ let input = Some ({id} |> input_to_yojson) in
2424+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2525+end
2626+
+28
pegasus/lexicons/app_bsky_draft_getDrafts.ml
···11+(* generated from app.bsky.draft.getDrafts *)
22+33+(** Gets views of user drafts. Requires authentication. *)
44+module Main = struct
55+ let nsid = "app.bsky.draft.getDrafts"
66+77+ type params =
88+ {
99+ limit: int option [@default None];
1010+ cursor: string option [@default None];
1111+ }
1212+[@@xrpc_query]
1313+1414+ type output =
1515+ {
1616+ cursor: string option [@default None];
1717+ drafts: App_bsky_draft_defs.draft_view list;
1818+ }
1919+[@@deriving yojson {strict= false}]
2020+2121+ let call
2222+ ?limit
2323+ ?cursor
2424+ (client : Hermes.client) : output Lwt.t =
2525+ let params : params = {limit; cursor} in
2626+ Hermes.query client nsid (params_to_yojson params) output_of_yojson
2727+end
2828+
+26
pegasus/lexicons/app_bsky_draft_updateDraft.ml
···11+(* generated from app.bsky.draft.updateDraft *)
22+33+(** Updates a draft using private storage (stash). If the draft ID points to a non-existing ID, the update will be silently ignored. This is done because updates don't enforce draft limit, so it accepts all writes, but will ignore invalid ones. Requires authentication. *)
44+module Main = struct
55+ let nsid = "app.bsky.draft.updateDraft"
66+77+ type params = unit
88+ let params_to_yojson () = `Assoc []
99+1010+ type input =
1111+ {
1212+ draft: App_bsky_draft_defs.draft_with_id;
1313+ }
1414+ [@@deriving yojson {strict= false}]
1515+1616+ type output = unit
1717+ let output_of_yojson _ = Ok ()
1818+1919+ let call
2020+ ~draft
2121+ (client : Hermes.client) : output Lwt.t =
2222+ let params = () in
2323+ let input = Some ({draft} |> input_to_yojson) in
2424+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2525+end
2626+
···88 let open Yojson.Safe.Util in
99 try
1010 match json |> member "$type" |> to_string with
1111- | "app.bsky.unspecced.defs#threadItemPost" -> (
1212- match App_bsky_unspecced_defs.thread_item_post_of_yojson json with
1313- | Ok v ->
1414- Ok (ThreadItemPost v)
1515- | Error e ->
1616- Error e )
1717- | _ ->
1818- Ok (Unknown json)
1111+ | "app.bsky.unspecced.defs#threadItemPost" ->
1212+ (match App_bsky_unspecced_defs.thread_item_post_of_yojson json with
1313+ | Ok v -> Ok (ThreadItemPost v)
1414+ | Error e -> Error e)
1515+ | _ -> Ok (Unknown json)
1916 with _ -> Error "failed to parse union"
20172118let value_to_yojson = function
2222- | ThreadItemPost v -> (
2323- match App_bsky_unspecced_defs.thread_item_post_to_yojson v with
2424- | `Assoc fields ->
2525- `Assoc
2626- (("$type", `String "app.bsky.unspecced.defs#threadItemPost") :: fields)
2727- | other ->
2828- other )
2929- | Unknown j ->
3030- j
1919+ | ThreadItemPost v ->
2020+ (match App_bsky_unspecced_defs.thread_item_post_to_yojson v with
2121+ | `Assoc fields -> `Assoc (("$type", `String "app.bsky.unspecced.defs#threadItemPost") :: fields)
2222+ | other -> other)
2323+ | Unknown j -> j
31243232-type thread_item = {uri: string; depth: int; value: value}
2525+type thread_item =
2626+ {
2727+ uri: string;
2828+ depth: int;
2929+ value: value;
3030+ }
3331[@@deriving yojson {strict= false}]
34323533(** (NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get additional posts under a thread e.g. replies hidden by threadgate. Based on an anchor post at any depth of the tree, returns top-level replies below that anchor. It does not include ancestors nor the anchor itself. This should be called after exhausting `app.bsky.unspecced.getPostThreadV2`. Does not require auth, but additional metadata and filtering will be applied for authed requests. *)
···3735 let nsid = "app.bsky.unspecced.getPostThreadOtherV2"
38363937 type params =
4040- { anchor: string
4141- ; prioritize_followed_users: bool option
4242- [@key "prioritizeFollowedUsers"] [@default None] }
4343- [@@deriving yojson {strict= false}]
3838+ {
3939+ anchor: string;
4040+ }
4141+[@@xrpc_query]
44424545- type output = {thread: thread_item list} [@@deriving yojson {strict= false}]
4343+ type output =
4444+ {
4545+ thread: thread_item list;
4646+ }
4747+[@@deriving yojson {strict= false}]
46484747- let call ~anchor ?prioritize_followed_users (client : Hermes.client) :
4848- output Lwt.t =
4949- let params : params = {anchor; prioritize_followed_users} in
4949+ let call
5050+ ~anchor
5151+ (client : Hermes.client) : output Lwt.t =
5252+ let params : params = {anchor} in
5053 Hermes.query client nsid (params_to_yojson params) output_of_yojson
5154end
5555+
···11(* generated from com.atproto.moderation.createReport *)
2233-type mod_tool = {name: string; meta: Yojson.Safe.t option [@default None]}
33+type mod_tool =
44+ {
55+ name: string;
66+ meta: Yojson.Safe.t option [@default None];
77+ }
48[@@deriving yojson {strict= false}]
59610(** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. *)
···812 let nsid = "com.atproto.moderation.createReport"
9131014 type params = unit
1111-1215 let params_to_yojson () = `Assoc []
13161417 type subject =
1515- | RepoRef of Com_atproto_admin_defs.repo_ref
1616- | StrongRef of Com_atproto_repo_strongRef.main
1717- | Unknown of Yojson.Safe.t
1818+ | RepoRef of Com_atproto_admin_defs.repo_ref
1919+ | StrongRef of Com_atproto_repo_strongRef.main
2020+ | Unknown of Yojson.Safe.t
18211919- let subject_of_yojson json =
2020- let open Yojson.Safe.Util in
2121- try
2222- match json |> member "$type" |> to_string with
2323- | "com.atproto.admin.defs#repoRef" -> (
2424- match Com_atproto_admin_defs.repo_ref_of_yojson json with
2525- | Ok v ->
2626- Ok (RepoRef v)
2727- | Error e ->
2828- Error e )
2929- | "com.atproto.repo.strongRef" -> (
3030- match Com_atproto_repo_strongRef.main_of_yojson json with
3131- | Ok v ->
3232- Ok (StrongRef v)
3333- | Error e ->
3434- Error e )
3535- | _ ->
3636- Ok (Unknown json)
3737- with _ -> Error "failed to parse union"
2222+let subject_of_yojson json =
2323+ let open Yojson.Safe.Util in
2424+ try
2525+ match json |> member "$type" |> to_string with
2626+ | "com.atproto.admin.defs#repoRef" ->
2727+ (match Com_atproto_admin_defs.repo_ref_of_yojson json with
2828+ | Ok v -> Ok (RepoRef v)
2929+ | Error e -> Error e)
3030+ | "com.atproto.repo.strongRef" ->
3131+ (match Com_atproto_repo_strongRef.main_of_yojson json with
3232+ | Ok v -> Ok (StrongRef v)
3333+ | Error e -> Error e)
3434+ | _ -> Ok (Unknown json)
3535+ with _ -> Error "failed to parse union"
38363939- let subject_to_yojson = function
4040- | RepoRef v -> (
4141- match Com_atproto_admin_defs.repo_ref_to_yojson v with
4242- | `Assoc fields ->
4343- `Assoc (("$type", `String "com.atproto.admin.defs#repoRef") :: fields)
4444- | other ->
4545- other )
4646- | StrongRef v -> (
4747- match Com_atproto_repo_strongRef.main_to_yojson v with
4848- | `Assoc fields ->
4949- `Assoc (("$type", `String "com.atproto.repo.strongRef") :: fields)
5050- | other ->
5151- other )
5252- | Unknown j ->
5353- j
3737+let subject_to_yojson = function
3838+ | RepoRef v ->
3939+ (match Com_atproto_admin_defs.repo_ref_to_yojson v with
4040+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.admin.defs#repoRef") :: fields)
4141+ | other -> other)
4242+ | StrongRef v ->
4343+ (match Com_atproto_repo_strongRef.main_to_yojson v with
4444+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.strongRef") :: fields)
4545+ | other -> other)
4646+ | Unknown j -> j
54475555- type input =
5656- { reason_type: Com_atproto_moderation_defs.reason_type [@key "reasonType"]
5757- ; reason: string option [@default None]
5858- ; subject: subject
5959- ; mod_tool: mod_tool option [@key "modTool"] [@default None] }
4848+type input =
4949+ {
5050+ reason_type: Com_atproto_moderation_defs.reason_type [@key "reasonType"];
5151+ reason: string option [@default None];
5252+ subject: subject;
5353+ mod_tool: mod_tool option [@key "modTool"] [@default None];
5454+ }
6055 [@@deriving yojson {strict= false}]
61566257 type output =
6363- { id: int
6464- ; reason_type: Com_atproto_moderation_defs.reason_type [@key "reasonType"]
6565- ; reason: string option [@default None]
6666- ; subject: subject
6767- ; reported_by: string [@key "reportedBy"]
6868- ; created_at: string [@key "createdAt"] }
6969- [@@deriving yojson {strict= false}]
5858+ {
5959+ id: int;
6060+ reason_type: Com_atproto_moderation_defs.reason_type [@key "reasonType"];
6161+ reason: string option [@default None];
6262+ subject: subject;
6363+ reported_by: string [@key "reportedBy"];
6464+ created_at: string [@key "createdAt"];
6565+ }
6666+[@@deriving yojson {strict= false}]
70677171- let call ~reason_type ?reason ~subject ?mod_tool (client : Hermes.client) :
7272- output Lwt.t =
6868+ let call
6969+ ~reason_type
7070+ ?reason
7171+ ~subject
7272+ ?mod_tool
7373+ (client : Hermes.client) : output Lwt.t =
7374 let params = () in
7474- let input =
7575- Some ({reason_type; reason; subject; mod_tool} |> input_to_yojson)
7676- in
7777- Hermes.procedure client nsid (params_to_yojson params) input
7878- output_of_yojson
7575+ let input = Some ({reason_type; reason; subject; mod_tool} |> input_to_yojson) in
7676+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
7977end
7878+
+12-19
pegasus/lexicons/com_atproto_moderation_defs.ml
···2233(** string type with known values *)
44type reason_type = string
55-65let reason_type_of_yojson = function
77- | `String s ->
88- Ok s
99- | _ ->
1010- Error "reason_type: expected string"
1111-66+ | `String s -> Ok s
77+ | _ -> Error "reason_type: expected string"
128let reason_type_to_yojson s = `String s
1391414-(** Spam: frequent unwanted promotion, replies, mentions *)
1010+(** Spam: frequent unwanted promotion, replies, mentions. Prefer new lexicon definition `tools.ozone.report.defs#reasonMisleadingSpam`. *)
1511let reason_spam = "com.atproto.moderation.defs#reasonSpam"
16121717-(** Direct violation of server rules, laws, terms of service *)
1313+(** Direct violation of server rules, laws, terms of service. Prefer new lexicon definition `tools.ozone.report.defs#reasonRuleOther`. *)
1814let reason_violation = "com.atproto.moderation.defs#reasonViolation"
19152020-(** Misleading identity, affiliation, or content *)
1616+(** Misleading identity, affiliation, or content. Prefer new lexicon definition `tools.ozone.report.defs#reasonMisleadingOther`. *)
2117let reason_misleading = "com.atproto.moderation.defs#reasonMisleading"
22182323-(** Unwanted or mislabeled sexual content *)
1919+(** Unwanted or mislabeled sexual content. Prefer new lexicon definition `tools.ozone.report.defs#reasonSexualUnlabeled`. *)
2420let reason_sexual = "com.atproto.moderation.defs#reasonSexual"
25212626-(** Rude, harassing, explicit, or otherwise unwelcoming behavior *)
2222+(** Rude, harassing, explicit, or otherwise unwelcoming behavior. Prefer new lexicon definition `tools.ozone.report.defs#reasonHarassmentOther`. *)
2723let reason_rude = "com.atproto.moderation.defs#reasonRude"
28242929-(** Other: reports not falling under another report category *)
2525+(** Reports not falling under another report category. Prefer new lexicon definition `tools.ozone.report.defs#reasonOther`. *)
3026let reason_other = "com.atproto.moderation.defs#reasonOther"
31273232-(** Appeal: appeal a previously taken moderation action *)
2828+(** Appeal a previously taken moderation action *)
3329let reason_appeal = "com.atproto.moderation.defs#reasonAppeal"
34303531(** string type with known values: Tag describing a type of subject that might be reported. *)
3632type subject_type = string
3737-3833let subject_type_of_yojson = function
3939- | `String s ->
4040- Ok s
4141- | _ ->
4242- Error "subject_type: expected string"
3434+ | `String s -> Ok s
3535+ | _ -> Error "subject_type: expected string"
3636+let subject_type_to_yojson s = `String s
43374444-let subject_type_to_yojson s = `String s
+115-129
pegasus/lexicons/com_atproto_repo_applyWrites.ml
···11(* generated from com.atproto.repo.applyWrites *)
2233type delete_result = unit
44-54let delete_result_of_yojson _ = Ok ()
66-75let delete_result_to_yojson () = `Assoc []
8697type update_result =
1010- { uri: string
1111- ; cid: string
1212- ; validation_status: string option [@key "validationStatus"] [@default None]
88+ {
99+ uri: string;
1010+ cid: string;
1111+ validation_status: string option [@key "validationStatus"] [@default None];
1312 }
1413[@@deriving yojson {strict= false}]
15141615type create_result =
1717- { uri: string
1818- ; cid: string
1919- ; validation_status: string option [@key "validationStatus"] [@default None]
1616+ {
1717+ uri: string;
1818+ cid: string;
1919+ validation_status: string option [@key "validationStatus"] [@default None];
2020 }
2121[@@deriving yojson {strict= false}]
22222323-type delete = {collection: string; rkey: string}
2323+type delete =
2424+ {
2525+ collection: string;
2626+ rkey: string;
2727+ }
2428[@@deriving yojson {strict= false}]
25292626-type update = {collection: string; rkey: string; value: Yojson.Safe.t}
3030+type update =
3131+ {
3232+ collection: string;
3333+ rkey: string;
3434+ value: Yojson.Safe.t;
3535+ }
2736[@@deriving yojson {strict= false}]
28372938type create =
3030- {collection: string; rkey: string option [@default None]; value: Yojson.Safe.t}
3939+ {
4040+ collection: string;
4141+ rkey: string option [@default None];
4242+ value: Yojson.Safe.t;
4343+ }
3144[@@deriving yojson {strict= false}]
32453346(** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. *)
···3548 let nsid = "com.atproto.repo.applyWrites"
36493750 type params = unit
3838-3951 let params_to_yojson () = `Assoc []
40524141- type writes_item = Create of create | Update of update | Delete of delete
5353+ type writes_item =
5454+ | Create of create
5555+ | Update of update
5656+ | Delete of delete
42574343- let writes_item_of_yojson json =
4444- let open Yojson.Safe.Util in
4545- try
4646- match json |> member "$type" |> to_string with
4747- | "com.atproto.repo.applyWrites#create" -> (
4848- match create_of_yojson json with
4949- | Ok v ->
5050- Ok (Create v)
5151- | Error e ->
5252- Error e )
5353- | "com.atproto.repo.applyWrites#update" -> (
5454- match update_of_yojson json with
5555- | Ok v ->
5656- Ok (Update v)
5757- | Error e ->
5858- Error e )
5959- | "com.atproto.repo.applyWrites#delete" -> (
6060- match delete_of_yojson json with
6161- | Ok v ->
6262- Ok (Delete v)
6363- | Error e ->
6464- Error e )
6565- | t ->
6666- Error ("unknown union type: " ^ t)
6767- with _ -> Error "failed to parse union"
5858+let writes_item_of_yojson json =
5959+ let open Yojson.Safe.Util in
6060+ try
6161+ match json |> member "$type" |> to_string with
6262+ | "com.atproto.repo.applyWrites#create" ->
6363+ (match create_of_yojson json with
6464+ | Ok v -> Ok (Create v)
6565+ | Error e -> Error e)
6666+ | "com.atproto.repo.applyWrites#update" ->
6767+ (match update_of_yojson json with
6868+ | Ok v -> Ok (Update v)
6969+ | Error e -> Error e)
7070+ | "com.atproto.repo.applyWrites#delete" ->
7171+ (match delete_of_yojson json with
7272+ | Ok v -> Ok (Delete v)
7373+ | Error e -> Error e)
7474+ | t -> Error ("unknown union type: " ^ t)
7575+ with _ -> Error "failed to parse union"
68766969- let writes_item_to_yojson = function
7070- | Create v -> (
7171- match create_to_yojson v with
7272- | `Assoc fields ->
7373- `Assoc
7474- (("$type", `String "com.atproto.repo.applyWrites#create") :: fields)
7575- | other ->
7676- other )
7777- | Update v -> (
7878- match update_to_yojson v with
7979- | `Assoc fields ->
8080- `Assoc
8181- (("$type", `String "com.atproto.repo.applyWrites#update") :: fields)
8282- | other ->
8383- other )
8484- | Delete v -> (
8585- match delete_to_yojson v with
8686- | `Assoc fields ->
8787- `Assoc
8888- (("$type", `String "com.atproto.repo.applyWrites#delete") :: fields)
8989- | other ->
9090- other )
7777+let writes_item_to_yojson = function
7878+ | Create v ->
7979+ (match create_to_yojson v with
8080+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#create") :: fields)
8181+ | other -> other)
8282+ | Update v ->
8383+ (match update_to_yojson v with
8484+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#update") :: fields)
8585+ | other -> other)
8686+ | Delete v ->
8787+ (match delete_to_yojson v with
8888+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#delete") :: fields)
8989+ | other -> other)
91909292- type input =
9393- { repo: string
9494- ; validate: bool option [@default None]
9595- ; writes: writes_item list
9696- ; swap_commit: string option [@key "swapCommit"] [@default None] }
9191+type input =
9292+ {
9393+ repo: string;
9494+ validate: bool option [@default None];
9595+ writes: writes_item list;
9696+ swap_commit: string option [@key "swapCommit"] [@default None];
9797+ }
9798 [@@deriving yojson {strict= false}]
989999100 type results_item =
100100- | CreateResult of create_result
101101- | UpdateResult of update_result
102102- | DeleteResult of delete_result
101101+ | CreateResult of create_result
102102+ | UpdateResult of update_result
103103+ | DeleteResult of delete_result
103104104104- let results_item_of_yojson json =
105105- let open Yojson.Safe.Util in
106106- try
107107- match json |> member "$type" |> to_string with
108108- | "com.atproto.repo.applyWrites#createResult" -> (
109109- match create_result_of_yojson json with
110110- | Ok v ->
111111- Ok (CreateResult v)
112112- | Error e ->
113113- Error e )
114114- | "com.atproto.repo.applyWrites#updateResult" -> (
115115- match update_result_of_yojson json with
116116- | Ok v ->
117117- Ok (UpdateResult v)
118118- | Error e ->
119119- Error e )
120120- | "com.atproto.repo.applyWrites#deleteResult" -> (
121121- match delete_result_of_yojson json with
122122- | Ok v ->
123123- Ok (DeleteResult v)
124124- | Error e ->
125125- Error e )
126126- | t ->
127127- Error ("unknown union type: " ^ t)
128128- with _ -> Error "failed to parse union"
105105+let results_item_of_yojson json =
106106+ let open Yojson.Safe.Util in
107107+ try
108108+ match json |> member "$type" |> to_string with
109109+ | "com.atproto.repo.applyWrites#createResult" ->
110110+ (match create_result_of_yojson json with
111111+ | Ok v -> Ok (CreateResult v)
112112+ | Error e -> Error e)
113113+ | "com.atproto.repo.applyWrites#updateResult" ->
114114+ (match update_result_of_yojson json with
115115+ | Ok v -> Ok (UpdateResult v)
116116+ | Error e -> Error e)
117117+ | "com.atproto.repo.applyWrites#deleteResult" ->
118118+ (match delete_result_of_yojson json with
119119+ | Ok v -> Ok (DeleteResult v)
120120+ | Error e -> Error e)
121121+ | t -> Error ("unknown union type: " ^ t)
122122+ with _ -> Error "failed to parse union"
129123130130- let results_item_to_yojson = function
131131- | CreateResult v -> (
132132- match create_result_to_yojson v with
133133- | `Assoc fields ->
134134- `Assoc
135135- ( ("$type", `String "com.atproto.repo.applyWrites#createResult")
136136- :: fields )
137137- | other ->
138138- other )
139139- | UpdateResult v -> (
140140- match update_result_to_yojson v with
141141- | `Assoc fields ->
142142- `Assoc
143143- ( ("$type", `String "com.atproto.repo.applyWrites#updateResult")
144144- :: fields )
145145- | other ->
146146- other )
147147- | DeleteResult v -> (
148148- match delete_result_to_yojson v with
149149- | `Assoc fields ->
150150- `Assoc
151151- ( ("$type", `String "com.atproto.repo.applyWrites#deleteResult")
152152- :: fields )
153153- | other ->
154154- other )
124124+let results_item_to_yojson = function
125125+ | CreateResult v ->
126126+ (match create_result_to_yojson v with
127127+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#createResult") :: fields)
128128+ | other -> other)
129129+ | UpdateResult v ->
130130+ (match update_result_to_yojson v with
131131+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#updateResult") :: fields)
132132+ | other -> other)
133133+ | DeleteResult v ->
134134+ (match delete_result_to_yojson v with
135135+ | `Assoc fields -> `Assoc (("$type", `String "com.atproto.repo.applyWrites#deleteResult") :: fields)
136136+ | other -> other)
155137156156- type output =
157157- { commit: Com_atproto_repo_defs.commit_meta option [@default None]
158158- ; results: results_item list option [@default None] }
159159- [@@deriving yojson {strict= false}]
138138+type output =
139139+ {
140140+ commit: Com_atproto_repo_defs.commit_meta option [@default None];
141141+ results: results_item list option [@default None];
142142+ }
143143+[@@deriving yojson {strict= false}]
160144161161- let call ~repo ?validate ~writes ?swap_commit (client : Hermes.client) :
162162- output Lwt.t =
145145+ let call
146146+ ~repo
147147+ ?validate
148148+ ~writes
149149+ ?swap_commit
150150+ (client : Hermes.client) : output Lwt.t =
163151 let params = () in
164164- let input =
165165- Some ({repo; validate; writes; swap_commit} |> input_to_yojson)
166166- in
167167- Hermes.procedure client nsid (params_to_yojson params) input
168168- output_of_yojson
152152+ let input = Some ({repo; validate; writes; swap_commit} |> input_to_yojson) in
153153+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
169154end
155155+
···11(* generated from com.atproto.server.deleteSession *)
2233-(** Delete the current session. Requires auth. *)
33+(** Delete the current session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). *)
44module Main = struct
55 let nsid = "com.atproto.server.deleteSession"
6677 type params = unit
88-98 let params_to_yojson () = `Assoc []
1091110 type output = unit
1212-1311 let output_of_yojson _ = Ok ()
14121515- let call (client : Hermes.client) : output Lwt.t =
1313+ let call
1414+ (client : Hermes.client) : output Lwt.t =
1615 let params = () in
1716 let input = None in
1818- Hermes.procedure client nsid (params_to_yojson params) input
1919- output_of_yojson
1717+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2018end
1919+
···55 let nsid = "com.atproto.server.updateEmail"
6677 type params = unit
88-98 let params_to_yojson () = `Assoc []
1091110 type input =
1212- { email: string
1313- ; email_auth_factor: bool option [@key "emailAuthFactor"] [@default None]
1414- ; token: string option [@default None] }
1111+ {
1212+ email: string;
1313+ email_auth_factor: bool option [@key "emailAuthFactor"] [@default None];
1414+ token: string option [@default None];
1515+ }
1516 [@@deriving yojson {strict= false}]
16171718 type output = unit
1818-1919 let output_of_yojson _ = Ok ()
20202121- let call ~email ?email_auth_factor ?token (client : Hermes.client) :
2222- output Lwt.t =
2121+ let call
2222+ ~email
2323+ ?email_auth_factor
2424+ ?token
2525+ (client : Hermes.client) : output Lwt.t =
2326 let params = () in
2427 let input = Some ({email; email_auth_factor; token} |> input_to_yojson) in
2525- Hermes.procedure client nsid (params_to_yojson params) input
2626- output_of_yojson
2828+ Hermes.procedure client nsid (params_to_yojson params) input output_of_yojson
2729end
3030+
+3-6
pegasus/lexicons/com_atproto_sync_defs.ml
···2233(** string type with known values *)
44type host_status = string
55-65let host_status_of_yojson = function
77- | `String s ->
88- Ok s
99- | _ ->
1010- Error "host_status: expected string"
66+ | `String s -> Ok s
77+ | _ -> Error "host_status: expected string"
88+let host_status_to_yojson s = `String s
1191212-let host_status_to_yojson s = `String s
+11-2
pegasus/lexicons/com_atproto_sync_getBlob.ml
···44module Main = struct
55 let nsid = "com.atproto.sync.getBlob"
6677- type params = {did: string; cid: string} [@@deriving yojson {strict= false}]
77+ type params =
88+ {
99+ did: string;
1010+ cid: string;
1111+ }
1212+[@@xrpc_query]
813914 (** raw bytes output with content type *)
1015 type output = bytes * string
11161212- let call ~did ~cid (client : Hermes.client) : output Lwt.t =
1717+ let call
1818+ ~did
1919+ ~cid
2020+ (client : Hermes.client) : output Lwt.t =
1321 let params : params = {did; cid} in
1422 Hermes.query_bytes client nsid (params_to_yojson params)
1523end
2424+
+10-6
pegasus/lexicons/com_atproto_sync_getBlocks.ml
···55 let nsid = "com.atproto.sync.getBlocks"
6677 type params =
88- { did: string
99- ; cids: string list
1010- [@of_yojson Hermes_util.query_string_list_of_yojson]
1111- [@to_yojson Hermes_util.query_string_list_to_yojson] }
1212- [@@deriving yojson {strict= false}]
88+ {
99+ did: string;
1010+ cids: string list;
1111+ }
1212+[@@xrpc_query]
13131414 (** raw bytes output with content type *)
1515 type output = bytes * string
16161717- let call ~did ~cids (client : Hermes.client) : output Lwt.t =
1717+ let call
1818+ ~did
1919+ ~cids
2020+ (client : Hermes.client) : output Lwt.t =
1821 let params : params = {did; cids} in
1922 Hermes.query_bytes client nsid (params_to_yojson params)
2023end
2424+
+9-2
pegasus/lexicons/com_atproto_sync_getCheckout.ml
···44module Main = struct
55 let nsid = "com.atproto.sync.getCheckout"
6677- type params = {did: string} [@@deriving yojson {strict= false}]
77+ type params =
88+ {
99+ did: string;
1010+ }
1111+[@@xrpc_query]
812913 (** raw bytes output with content type *)
1014 type output = bytes * string
11151212- let call ~did (client : Hermes.client) : output Lwt.t =
1616+ let call
1717+ ~did
1818+ (client : Hermes.client) : output Lwt.t =
1319 let params : params = {did} in
1420 Hermes.query_bytes client nsid (params_to_yojson params)
1521end
2222+
+14-3
pegasus/lexicons/com_atproto_sync_getHead.ml
···44module Main = struct
55 let nsid = "com.atproto.sync.getHead"
6677- type params = {did: string} [@@deriving yojson {strict= false}]
77+ type params =
88+ {
99+ did: string;
1010+ }
1111+[@@xrpc_query]
81299- type output = {root: string} [@@deriving yojson {strict= false}]
1313+ type output =
1414+ {
1515+ root: string;
1616+ }
1717+[@@deriving yojson {strict= false}]
10181111- let call ~did (client : Hermes.client) : output Lwt.t =
1919+ let call
2020+ ~did
2121+ (client : Hermes.client) : output Lwt.t =
1222 let params : params = {did} in
1323 Hermes.query client nsid (params_to_yojson params) output_of_yojson
1424end
2525+
···8989 List.filter_map
9090 (fun filename ->
9191 match parse_migration_filename filename with
9292- | Some (id, name) when not (List.mem id applied) -> begin
9393- match read_migration filename with
9292+ | Some (id, name) when not (List.mem id applied) ->
9393+ begin match read_migration filename with
9494 | Some sql ->
9595 Some (id, name, sql)
9696 | None ->