๐Ÿ€ ATproto XRPC client for gleam possum.hexdocs.pm
gleam atproto xrpc-client library
40

Configure Feed

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

possum/did: rename "new" to "parse"

kacaii.dev (Jun 30, 2026, 6:45 PM -0300) c664c10f ca7b054a

+11 -6
+7 -2
README.md
··· 17 17 ``` 18 18 19 19 ```toml 20 + # gleam.toml 20 21 possum = { git = "https://tangled.org/kacaii.dev/possum", ref = "commit-hash" } 21 22 ``` 22 23 ··· 24 25 25 26 ```gleam 26 27 // Resolve an atproto handle (hostname) to a DID. 28 + // 27 29 // You can consult your identifier by sending a request directly to your PDS, 28 30 // or you can use projects like [Slingshot](https://slingshot.microcosm.blue) 29 31 // for easy access to cached data when resolving a handle. ··· 35 37 // Your server can then respond with the DID value as plain text. 36 38 request.new() 37 39 |> possum.resolve_well_known_did("gleam.run") 40 + 41 + // Use `did.parse` to turn strings into valid DID format 42 + let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") 38 43 ``` 39 44 40 45 ### Querying Public Data 41 46 42 47 ```gleam 43 - // Reading public data from a repository. 48 + // Reading public data from repositories. 44 49 // No authorization needed. 45 50 request.new() 46 51 |> request.set_host("personal.data-server.pds") 47 52 |> possum.list_records( 48 - repository: did, 53 + did: did, 49 54 collection: "site.standard.document", 50 55 limit: option.Some(3), 51 56 cursor: option.None,
+1 -1
src/possum.gleam
··· 450 450 /// request.new() 451 451 /// |> request.set_host("personal.data-server.pds") 452 452 /// |> possum.list_records( 453 - /// repository: did, 453 + /// did: did, 454 454 /// collection: "site.standard.document", 455 455 /// limit: option.Some(3), 456 456 /// cursor: option.None,
+2 -2
src/possum/did.gleam
··· 83 83 pub fn decoder() -> decode.Decoder(Did) { 84 84 use value <- decode.then(decode.string) 85 85 86 - case new(value) { 86 + case parse(value) { 87 87 Ok(did) -> decode.success(did) 88 88 Error(_) -> decode.failure(Did(Plc, "wibblewobble"), "DID") 89 89 } ··· 111 111 Web 112 112 } 113 113 114 - pub fn new(content: String) -> Result(Did, DidError) { 114 + pub fn parse(content: String) -> Result(Did, DidError) { 115 115 use with <- result.try( 116 116 regexp.from_string(pattern) 117 117 |> result.replace_error(InvalidRegexPattern(pattern:)),
+1 -1
test/possum_test.gleam
··· 83 83 let decoder = decode.at(["did"], decode.string) 84 84 85 85 let assert Ok(value) = json.parse(response.body, decoder) 86 - let assert Ok(_did) = did.new(value) 86 + let assert Ok(_did) = did.parse(value) 87 87 Nil 88 88 } 89 89