๐Ÿ€ ATproto library for gleam
atproto library gleam
34

Configure Feed

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

possum: resolve_well_known_did takes a String for hostname

kacaii.dev (Jul 11, 2026, 1:26 PM -0300) d8ee28ad d01ae2b2

+32 -8
+1 -2
CHANGELOG.md
··· 22 22 23 23 - [possum/did] Renamed `did.DidError` to `did.ParseError`. 24 24 - [possum/did] Rename `did.InvalidFormat` to `did.InvalidSyntax`. 25 - - [possuum] Functions now use `prepend_header` instead of `set_header`. 26 - - [possum] `resolve_well_known_did` now take a `handle.Handle` as parameter. 25 + - [possum] Functions now use `prepend_header` instead of `set_header`. 27 26 - [possum] `resolve_handle` now takes a `handle.Handle` as parameter. 28 27 - [possum] Functions now take a parsed `nsid.Nsid` as the "collection" parameter.
+10 -3
README.md
··· 24 24 25 25 ```gleam 26 26 import gleam/http/request 27 + import possum/did 28 + import possum/handle 27 29 import possum 30 + 31 + let assert Ok(handle) = handle.parse("gleam.run") 28 32 29 33 // Resolve an atproto handle (hostname) to a DID. 30 34 // ··· 33 37 // for easy access to cached data when resolving a handle. 34 38 request.new() 35 39 |> request.set_host("slingshot.microcosm.blue") 36 - |> possum.resolve_handle("gleam.run") 40 + |> possum.resolve_handle(handle) 37 41 38 42 // Use `did.parse` to turn strings into valid DID format 39 43 let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") ··· 43 47 44 48 ```gleam 45 49 import gleam/http/request 50 + import possum/did 51 + import possum/nsid 46 52 import possum 47 - import possum/did 48 53 49 54 let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") 55 + let assert Ok(collection) = nsid.parse("sh.tangled.repo") 50 56 51 57 // Reading public data from repositories. 52 58 // No authorization needed. ··· 54 60 |> request.set_host("personal.data-server.pds") 55 61 |> possum.list_records( 56 62 did, 57 - collection: "sh.tangled.repo", 63 + collection:, 58 64 limit: option.Some(3), 59 65 cursor: option.None, 60 66 reverse: option.None, ··· 65 71 66 72 ```gleam 67 73 import gleam/http/request 74 + import possum/did 68 75 import possum 69 76 70 77 let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz")
+3 -1
pages/consulting-your-did.md
··· 17 17 don't usually need to implement resolution directly themselves. 18 18 19 19 ```gleam 20 + let assert Ok(handle) = handle.parse("gleam.run") 21 + 20 22 // You can consult your identifier by sending a request directly to your PDS, 21 23 // or you can use projects like [Slingshot](https://slingshot.microcosm.blue) 22 24 // for easy access to cached data when resolving a handle. 23 25 request.new() 24 26 |> request.set_host("slingshot.microcosm.blue") 25 - |> possum.resolve_handle("gleam.run") 27 + |> possum.resolve_handle(handle) 26 28 ``` 27 29 28 30 ## HTTPS well-known Method
+18 -2
src/possum.gleam
··· 59 59 /// 60 60 /// ```gleam 61 61 /// import gleam/http/request 62 + /// import possum/did 62 63 /// import possum 63 64 /// 64 65 /// let assert Ok(did) = did.parse("did:plc:z72i7hdynmk6r22z27h6tvur") ··· 131 132 /// Documentation: [HTTPS well-known Method](https://atproto.com/specs/handle#https-well-known-method) 132 133 pub fn resolve_well_known_did( 133 134 request: request.Request(_), 134 - handle: handle.Handle, 135 + host: String, 135 136 ) -> request.Request(_) { 136 137 request 137 - |> request.set_host(handle.to_string(handle)) 138 + |> request.set_host(host) 138 139 |> request.set_method(http.Get) 139 140 |> request.set_path(".well-known/atproto-did") 140 141 } ··· 195 196 /// 196 197 /// ```gleam 197 198 /// import gleam/http/request 199 + /// import possum/did 198 200 /// import possum 201 + /// 202 + /// let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") 199 203 /// 200 204 /// let request = 201 205 /// request.new() ··· 367 371 /// 368 372 /// ```gleam 369 373 /// import gleam/http/request 374 + /// import possum/did 370 375 /// import possum 371 376 /// 377 + /// let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") 378 + /// 372 379 /// let request = 373 380 /// request.new() 374 381 /// |> request.set_host("personal.data-server.pds") ··· 502 509 /// 503 510 /// ```gleam 504 511 /// import gleam/http/request 512 + /// import possum/did 513 + /// import possum/nsid 505 514 /// import possum 506 515 /// 507 516 /// let assert Ok(did) = did.parse("did:plc:k5vecqzf4d5mdvkcu3mx6l5g") ··· 562 571 /// 563 572 /// ```gleam 564 573 /// import gleam/http/request 574 + /// import possum/did 575 + /// import possum/nsid 565 576 /// import possum 566 577 /// 578 + /// let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz") 567 579 /// let assert Ok(collection) = nsid.parse("site.standard.document") 568 580 /// 569 581 /// let request = ··· 642 654 /// 643 655 /// ```gleam 644 656 /// import gleam/http/request 657 + /// import possum/did 658 + /// import possum/nsid 645 659 /// import possum 646 660 /// 647 661 /// let assert Ok(did) = did.parse("did:plc:k5vecqzf4d5mdvkcu3mx6l5g") ··· 724 738 /// 725 739 /// ```gleam 726 740 /// import gleam/http/request 741 + /// import possum/did 742 + /// import possum/nsid 727 743 /// import possum 728 744 /// 729 745 /// let assert Ok(did) = did.parse("did:plc:k5vecqzf4d5mdvkcu3mx6l5g")