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

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(())
}

Re-exports

Modules

  • Definitions for the app namespace.
  • Definitions for Blob types.
  • An ATP service client.
  • Structs for ATP client, implements all HTTP APIs of XRPC.
  • Definitions for the com namespace.
  • A collection of ATP repository record types.