From ffe2f7d78349018a77cc1becd705f5371e1cc8bf Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 2 Feb 2026 17:03:26 -0500 Subject: [PATCH] add blue.microcosm xrpc aliases --- slingshot/src/record.rs | 2 +- slingshot/src/server.rs | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/slingshot/src/record.rs b/slingshot/src/record.rs index 8b11902..e01eaa0 100644 --- a/slingshot/src/record.rs +++ b/slingshot/src/record.rs @@ -83,7 +83,7 @@ impl Repo { pub fn new(identity: Identity) -> Self { let client = Client::builder() .user_agent(format!( - "microcosm slingshot v{} (dev: @bad-example.com)", + "microcosm slingshot v{} (contact: @bad-example.com)", env!("CARGO_PKG_VERSION") )) .no_proxy() diff --git a/slingshot/src/server.rs b/slingshot/src/server.rs index 26505cf..7ba28ee 100644 --- a/slingshot/src/server.rs +++ b/slingshot/src/server.rs @@ -288,6 +288,35 @@ impl Xrpc { self.get_record_impl(repo, collection, rkey, cid).await } + /// blue.microcosm.repo.getRecordByUri + /// + /// alias of `com.bad-example.repo.getUriRecord` with intention to stabilize under this name + #[oai( + path = "/blue.microcosm.repo.getRecordByUri", + method = "get", + tag = "ApiTags::Custom" + )] + async fn get_record_by_uri( + &self, + /// The at-uri of the record + /// + /// The identifier can be a DID or an atproto handle, and the collection + /// and rkey segments must be present. + #[oai(example = "example_uri")] + Query(at_uri): Query, + /// Optional: the CID of the version of the record. + /// + /// If not specified, then return the most recent version. + /// + /// > [!tip] + /// > If specified and a newer version of the record exists, returns 404 not + /// > found. That is: slingshot only retains the most recent version of a + /// > record. + Query(cid): Query>, + ) -> GetRecordResponse { + self.get_uri_record(Query(at_uri), Query(cid)).await + } + /// com.bad-example.repo.getUriRecord /// /// Ergonomic complement to [`com.atproto.repo.getRecord`](https://docs.bsky.app/docs/api/com-atproto-repo-get-record) @@ -413,6 +442,23 @@ impl Xrpc { })) } + /// blue.microcosm.identity.resolveMiniDoc + /// + /// alias of `com.bad-example.identity.resolveMiniDoc` with intention to stabilize under this name + #[oai( + path = "/blue.microcosm.identity.resolveMiniDoc", + method = "get", + tag = "ApiTags::Custom" + )] + async fn resolve_mini_doc( + &self, + /// Handle or DID to resolve + #[oai(example = "example_handle")] + Query(identifier): Query, + ) -> ResolveMiniIDResponse { + self.resolve_mini_id(Query(identifier)).await + } + /// com.bad-example.identity.resolveMiniDoc /// /// Like [com.atproto.identity.resolveIdentity](https://docs.bsky.app/docs/api/com-atproto-identity-resolve-identity) -- 2.51.2