Crate atrium_api

source ·
Expand description

ATrium API: Rust library for Bluesky’s atproto services

Rust

ATrium API is a Rust library that includes the definitions of XRPC requests and their associated input/output model types. These codes are generated from the Lexicon schema on atproto.com.

Usage

Any HTTP client that implements atrium_xrpc::HttpClient can be used to handle XRPC requests. Since atrium_xrpc_client provides several implementations, it is recommended to use one of them that fits your project requirements.

use atrium_api::client::AtpServiceClient;
use atrium_api::com::atproto::server::create_session::Input;
use atrium_xrpc_client::reqwest::ReqwestClient;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = AtpServiceClient::new(ReqwestClient::new("https://bsky.social"));
    let result = client
        .service
        .com
        .atproto
        .server
        .create_session(Input {
            identifier: "alice@mail.com".into(),
            password: "hunter2".into(),
        })
        .await;
    println!("{:?}", result);
    Ok(())
}

Re-exports

Modules

  • agentagent
    An ATP “Agent”. Manages session token lifecycles and provides all XRPC methods.
  • Definitions for the app namespace.
  • Definitions for Blob types.
  • Structs for ATP client, implements all HTTP APIs of XRPC.
  • Definitions for the com namespace.
  • Definitions for DID document types.
  • A collection of ATP repository record types.