atrium-api 0.8.0

API library for AT Protocol (Bluesky)
Documentation

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

You can use any HTTP client that implements atrium_xrpc::HttpClient to make use of the XRPC requests. atrium_xrpc also includes a default implementation using reqwest.

use atrium_api::client::AtpServiceClient;
use atrium_api::com::atproto::server::create_session::Input;
use atrium_api::xrpc::client::reqwest::ReqwestClient;
use std::sync::Arc;

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