Header menu logo FSharp.ATProto

AtUri Module

Functions for creating, validating, and extracting data from AtUri values.

Functions and values

Function or value Description

authority atUri

Full Usage: authority atUri

Parameters:
    atUri : AtUri - The AT-URI to extract the authority from.

Returns: string The authority string (e.g. "did:plc:z72i7hdynmk6r22z27h6tvur" or "my-handle.bsky.social").

Extract the authority segment (DID or handle) from an AT-URI.

atUri : AtUri

The AT-URI to extract the authority from.

Returns: string

The authority string (e.g. "did:plc:z72i7hdynmk6r22z27h6tvur" or "my-handle.bsky.social").

collection atUri

Full Usage: collection atUri

Parameters:
    atUri : AtUri - The AT-URI to extract the collection from.

Returns: string option Some with the collection NSID string (e.g. "app.bsky.feed.post"), or None if the AT-URI has no collection segment.

Extract the collection NSID segment from an AT-URI, if present.

atUri : AtUri

The AT-URI to extract the collection from.

Returns: string option

Some with the collection NSID string (e.g. "app.bsky.feed.post"), or None if the AT-URI has no collection segment.

parse s

Full Usage: parse s

Parameters:
    s : string - An AT-URI string starting with "at://" followed by an authority (DID or handle), and optionally a collection (NSID) and record key path segments. Query parameters and fragments are not allowed.

Returns: Result<AtUri, string> Ok with a validated AtUri, or Error with a message describing the validation failure. Validation failures include: null input, exceeding 8192 characters, missing at:// prefix, presence of query/fragment components, invalid authority (must be a valid DID or handle), invalid collection (must be a valid NSID), invalid record key, or trailing slash.

Parse and validate an AT-URI string.

s : string

An AT-URI string starting with "at://" followed by an authority (DID or handle), and optionally a collection (NSID) and record key path segments. Query parameters and fragments are not allowed.

Returns: Result<AtUri, string>

Ok with a validated AtUri, or Error with a message describing the validation failure. Validation failures include: null input, exceeding 8192 characters, missing at:// prefix, presence of query/fragment components, invalid authority (must be a valid DID or handle), invalid collection (must be a valid NSID), invalid record key, or trailing slash.

Example

 match AtUri.parse "at://my-handle.bsky.social/app.bsky.feed.post/3k2la3b" with
 | Ok uri -> printfn "Valid: %s" (AtUri.value uri)
 | Error e -> printfn "Invalid: %s" e
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
val uri: obj
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
union case Result.Error: ErrorValue: 'TError -> Result<'T,'TError>
val e: string

rkey atUri

Full Usage: rkey atUri

Parameters:
    atUri : AtUri - The AT-URI to extract the record key from.

Returns: string option Some with the record key string (e.g. "3k2la3b"), or None if the AT-URI has no record key segment.

Extract the record key segment from an AT-URI, if present.

atUri : AtUri

The AT-URI to extract the record key from.

Returns: string option

Some with the record key string (e.g. "3k2la3b"), or None if the AT-URI has no record key segment.

value arg1

Full Usage: value arg1

Parameters:
Returns: string The full AT-URI string (e.g. "at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3k2la3b").

Extract the string representation of an AT-URI.

arg0 : AtUri
Returns: string

The full AT-URI string (e.g. "at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3k2la3b").

Type something to start searching.