objective categorical abstract machine language personal data server
65
fork

Configure Feed

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

xrpc describeRepo

millipds parity achieved

futurGH 4c1489ea da5feaed

+40 -3
+4 -3
bin/main.ml
··· 14 14 ; ( get 15 15 , "/xrpc/com.atproto.identity.resolveHandle" 16 16 , Api.Identity.ResolveHandle.handler ) 17 - ; ( get 18 - , "/xrpc/com.atproto.sync.subscribeRepos" 19 - , Api.Server.SubscribeRepos.handler ) 20 17 ; ( post 21 18 , "/xrpc/com.atproto.server.createSession" 22 19 , Api.Server.CreateSession.handler ) 23 20 ; (get, "/xrpc/com.atproto.repo.getRecord", Api.Repo.GetRecord.handler) 24 21 ; (get, "/xrpc/com.atproto.repo.listRecords", Api.Repo.ListRecords.handler) 22 + ; (get, "/xrpc/com.atproto.repo.describeRepo", Api.Repo.DescribeRepo.handler) 25 23 ; (* account *) 26 24 (get, "/xrpc/com.atproto.server.getSession", Api.Server.GetSession.handler) 27 25 ; ( post ··· 50 48 ; (get, "/xrpc/com.atproto.sync.getBlocks", Api.Sync.GetBlocks.handler) 51 49 ; (get, "/xrpc/com.atproto.sync.getBlob", Api.Sync.GetBlob.handler) 52 50 ; (get, "/xrpc/com.atproto.sync.listBlobs", Api.Sync.ListBlobs.handler) 51 + ; ( get 52 + , "/xrpc/com.atproto.sync.subscribeRepos" 53 + , Api.Server.SubscribeRepos.handler ) 53 54 ; (* preferences *) 54 55 ( get 55 56 , "/xrpc/com.atproto.actor.getPreferences"
+36
pegasus/lib/api/repo/describeRepo.ml
··· 1 + type query = {repo: string} [@@deriving yojson] 2 + 3 + type response = 4 + { handle: string 5 + ; did: string 6 + ; did_doc: Id_resolver.Did.Document.t [@key "didDoc"] 7 + ; collections: string list 8 + ; handle_is_correct: bool [@key "handleIsCorrect"] } 9 + [@@deriving yojson] 10 + 11 + let handler = 12 + Xrpc.handler (fun ctx -> 13 + let input = Xrpc.parse_query ctx.req query_of_yojson in 14 + let%lwt did = Xrpc.resolve_repo_did ctx input.repo in 15 + let%lwt did_doc = 16 + match%lwt Id_resolver.Did.resolve did with 17 + | Ok did_doc -> 18 + Lwt.return did_doc 19 + | Error err -> 20 + failwith err 21 + in 22 + let handle = 23 + Scanf.sscanf 24 + (did_doc.also_known_as |> Option.get |> List.hd) 25 + "at://%s" 26 + (fun h -> h) 27 + in 28 + let%lwt repo = Repository.load ~write:false did in 29 + let%lwt collections = Repository.list_collections repo in 30 + Dream.json @@ Yojson.Safe.to_string 31 + @@ response_to_yojson 32 + { handle 33 + ; did 34 + ; did_doc 35 + ; collections 36 + ; handle_is_correct= true (* what am I, a cop? *) } )