AtpAgent Module
Functions for creating and authenticating AtpAgent instances.
Functions and values
| Function or value |
Description
|
Full Usage:
configureLabelers labelers agent
Parameters:
(string * bool) list
-
A list of labeler DIDs and optional redact flags. Each entry is a tuple of
(labeler DID string, redact flag). When redact=true, the labeler's labels
can cause content to be entirely removed from responses.
agent : AtpAgent
-
The agent to copy with labeler configuration.
Returns: AtpAgent
A new AtpAgent with the atproto-accept-labelers header.
|
Returns a copy of the agent configured with the
The header format follows IETF RFC-8941 Structured Field Values:
|
|
Creates a new unauthenticated agent pointing at the given PDS base URL. A new HttpClient is allocated internally.
Example
val agent: obj
|
Full Usage:
createWithClient httpClient baseUrl
Parameters:
HttpClient
-
The HTTP client to use for all requests.
baseUrl : string
-
The PDS base URL (e.g. "https://bsky.social"). A trailing slash is appended if not present.
Returns: AtpAgent
An unauthenticated AtpAgent using the provided HTTP client.
|
Creates a new unauthenticated agent with a caller-supplied HttpClient. Useful for testing with mock HTTP handlers or custom client configuration.
Example
val handler: obj
val client: obj
val agent: obj
|
Full Usage:
login identifier password agent
Parameters:
string
-
A handle (e.g. "my-handle.bsky.social") or DID (e.g. "did:plc:xyz123").
password : string
-
An app password (not the account password).
agent : AtpAgent
-
The agent to authenticate.
Returns: Task<Result<AtpSession, XrpcError>>
A Task resolving to Ok with the AtpSession on success,
or Error with an XrpcError on failure.
|
Logs in to a PDS with an identifier and app password. On success, stores the session on the agent for subsequent authenticated requests.
Calls the
Example
val agent: obj
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
union case Result.Error: ErrorValue: 'TError -> Result<'T,'TError>
|
Full Usage:
withChatProxy agent
Parameters:
AtpAgent
-
The agent to copy with chat proxy configuration.
Returns: AtpAgent
A new AtpAgent with the chat proxy header prepended to ExtraHeaders.
|
Returns a copy of the agent configured to proxy requests through the Bluesky Chat service.
Adds the The returned agent shares the same HttpClient as the original but has an independent Session field (it is a record copy). If you need chat functionality, prefer using the Chat module functions directly — they handle the proxy header automatically and always use the current session from the original agent.
|