···88//// general account management interfaces such as the OAuth login screen.
99//// PDSes actively sync their data repos with Relays.
1010////
1111+//// ## Lexicon
1212+////
1313+//// Lexicon is a schema language. It's used in the Atmosphere to describe data
1414+//// records and HTTP APIs. It's very similar to JSON-Schema and OpenAPI.
1515+//// Lexicon's sole purpose is to help developers build compatible software.
1616+////
1117//// ## Record Keys
1218////
1319//// A record key (sometimes shortened to "rkey") is used to name and reference an individual
···4551/// Documentation: [xrpc/com.atproto.sync](https://endpoints.bsky.app/#bluesky-app/tag/comatprotosync)
4652const com_atproto_sync = "xrpc/com.atproto.sync"
47534848-/// Get current PLC Data for the indicated DID,
5454+/// Get current [PLC](https://web.plc.directory/) Data for the indicated DID,
4955/// this returns information about a Decentralized Identifier (DID),
5050-/// including their handle and service endpoint.
5656+/// including their **handle** and **PDS endpoint**.
5157///
5258/// PLC is a persistent global identifier system, stands for
5359/// "Public Ledger of Credentials".
···5561/// ## Examples
5662///
5763/// ```gleam
5858-/// import gleam/http/request
5964/// import possum/did
6065/// import possum
6166///
···6368/// let request = possum.get_plc_data(did)
6469///
6570/// // You can use this decoder to extract the server endpoint
6666-/// let decoder = decode.at(["services", "atproto_pds", "endpoint"], decode.string)
7171+/// let decoder =
7272+/// decode.at(
7373+/// ["services", "atproto_pds", "endpoint"],
7474+/// decode.string
7575+/// )
6776/// ```
6877///
6978/// ## Response
···8897/// }
8998/// }
9099/// ```
9191-///
9292-/// Documentation: [DID PLC Directory](https://web.plc.directory/)
9393-///
9494-/// See also: [did](possum/did.html), [did.parse](possum/did.html#parse)
95100pub fn get_plc_data(did: did.Did) -> request.Request(String) {
96101 request.Request(
97102 method: http.Get,
···162167///
163168/// Endpoint Docs: [/xrpc/com.atproto.identity.resolveHandle](https://endpoints.bsky.app/#bluesky-app/tag/comatprotoidentity/GET/xrpc/com.atproto.identity.resolveHandle)
164169///
165165-/// See also: [did](possum/did.html), [did.parse](possum/did.html#parse)
170170+/// See also: [Did](possum/did.html#Did), [handle.parse](possum/handle.html#parse)
166171pub fn resolve_handle(
167172 handle: handle.Handle,
168173 pds host: String,
+12-10
src/possum/at_uri.gleam
···11-//// The AT URI scheme (at://) makes it easy to reference individual records in
22-//// a specific repository, identified by either DID or handle.
33-////
44-//// AT URIs are not content-addressed, so the contents of the record they
55-//// refer to may also change over time.
66-////
77-//// Documentation: [AT URI Scheme](https://atproto.com/specs/at-uri-scheme)
88-91import gleam/result
102import gleam/string
113import possum/did
···3931 Did(value: did.Did)
4032}
41334242-/// A URI scheme for addressing atproto repository data.
3434+/// The AT URI scheme (at://) makes it easy to reference individual records in
3535+/// a specific repository, identified by either DID or handle.
4336///
4444-/// See also: [parse](#parse)
3737+/// ```
3838+/// at://did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g
3939+/// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ
4040+/// authority colection rkey
4141+/// ```
4242+///
4343+/// AT URIs are not content-addressed, so the contents of the record they
4444+/// refer to may also change over time.
4545+///
4646+/// Documentation: [AT URI Scheme](https://atproto.com/specs/at-uri-scheme)
4547pub opaque type AtUri {
4648 AtUri(
4749 /// Identifier, can be a DID or a Handle
+10-28
src/possum/did.gleam
···11-//// ## DID (Decentralized ID)
22-////
33-//// DIDs, or Decentralized IDentifiers, are universally-unique identifiers which
44-//// represent data repos. They are permanent and non-human-readable.
55-//// DIDs are a W3C specification. The AT Protocol currently supports
66-//// did:web and did:plc, two different DID methods.
77-////
88-//// DIDs resolve to documents which contain metadata about a repo,
99-//// including the address of the repo's PDS, the repo's handles,
1010-//// and the public signing keys.
1111-121import gleam/dynamic/decode
132import gleam/regexp
143import gleam/result
···2615 InvalidDidMethod(value: String)
2716}
28172929-/// AT Protocol uses Decentralized Identifiers (DIDs) as persistent account
3030-/// identifiers. An example DID is `did:plc:ewvi7nxzyoun6zhxrhs64oiz`.
1818+/// AT Protocol uses Decentralized Identifiers (DIDs) universally-unique
1919+/// identifiers which represent data repos. For example:
2020+///
2121+/// ```
2222+/// did:plc:k5vecqzf4d5mdvkcu3mx6l5g
2323+/// โโโ โโโโโโโโโโโโโโโโโโโโโโโโ
2424+/// method identifier
2525+/// ```
3126///
3227/// Documentation: [Decentralized Identifiers](https://atproto.com/specs/did)
3328///
···4843///
4944/// assert method == did.Plc
5045/// ```
5151-///
5252-/// See also: [Did](#Did)
5346pub fn method(self: Did) -> Method {
5447 self.method
5548}
···5750/// Return the DID identifier.
5851///
5952/// This function **does not** convert the value into a valid DID format,
6060-/// for that use `to_string`.
5353+/// for that use [to_string](#to_string).
6154///
6255/// ## Examples
6356///
···6962///
7063/// assert identifier == "k5vecqzf4d5mdvkcu3mx6l5g"
7164/// ```
7272-///
7373-/// See also: [Did](#Did)
7465pub fn indentifer(self: Did) -> String {
7566 self.identifier
7667}
···112103/// Documentation: [Blessed DID Methods](https://atproto.com/specs/did#blessed-did-methods)
113104pub type Method {
114105 /// Self-authenticating DID method developed specifically for use with atproto.
115115- /// See the DID PLC [website](https://web.plc.directory/) for more details.
116106 Plc
117107 /// [W3C community](https://w3c-ccg.github.io/did-method-web/) draft based
118118- /// on HTTPS (and DNS). The identifier section is a hostname.
119119- /// This method is supported in atproto to provide an independent
120120- /// alternative to `did:plc`.
121121- ///
122122- /// The special localhost hostname is allowed, but only in testing and development
123123- /// environments. Port numbers (with separating colon hex-encoded) are only
124124- /// allowed for localhost, and only in testing and development.
125125- ///
126126- /// Documentation: [did:web](https://atproto.com/specs/did#did-web-in-at-protocol)
108108+ /// on HTTPS (and DNS). The identifier section is a _hostname_.
127109 Web
128110}
129111
+13-17
src/possum/nsid.gleam
···11-//// Namespaced Identifiers (NSIDs) are used to reference Lexicon schemas for
22-//// records, XRPC endpoints, and more. For example, `com.atproto.sync.getRecord`.
33-////
44-//// The basic structure and semantics of an NSID are a fully-qualified hostname
55-//// in reverse domain-name order, followed by an additional name segment.
66-//// The hostname part is the **domain authority**, and the final segment is the **name**.
77-////
88-//// ## Lexicon
99-////
1010-//// Lexicon is a schema language. It's used in the Atmosphere to describe data
1111-//// records and HTTP APIs. Functionally it's very similar to JSON-Schema and OpenAPI.
1212-//// Lexicon's sole purpose is to help developers build compatible software.
1313-////
1414-//// Documentation: [Namespaced Identifiers](https://atproto.com/specs/nsid)
1515-161import gleam/regexp
172import gleam/result
183···2611 InvalidSyntax(value: String)
2712}
28132929-/// A specification for global semantic IDs.
1414+/// Namespaced Identifiers (NSIDs) are used to reference Lexicon schemas for
1515+/// records, endpoints, and more. For example:
1616+///
1717+/// ```
1818+/// sh.tangled.repo.pull
1919+/// โโโโโโโโโโโโโโโ โโโโ
2020+/// authority name
2121+/// ````
2222+///
2323+/// The basic structure of an NSID are a hostname in reverse domain-name order,
2424+/// followed by an additional name segment. The hostname part is called the
2525+/// **domain authority**, and the final segment is the **name**.
3026///
3131-/// See also: [parse](#parse)
2727+/// Documentation: [Namespaced Identifiers](https://atproto.com/specs/nsid)
3228pub opaque type Nsid {
3329 Nsid(value: String)
3430}