Skip to main content

Module api

Module api 

Source
Expand description

A typed client for the service’s public and management HTTP API (WP-21 R-21.1).

Every operation is generated from the service’s OpenAPI contract (sdk/auth/tools/generate_clients.py reads backends/rust/auth_service/api/v1/openapi.json), so paths, parameters, bodies and result types cannot drift from the server. The hand-written part is the transport (transport: credentials, encoding, errors) and the small support types in runtime. Token verification and PKCE helpers stay in the crate root.

ⓘ
use beyondigital_auth_sdk::api::{ApiClientOptions, ApiCredentials, AuthApiClient};
use beyondigital_auth_sdk::api::generated::types::ConnectionsListPath;

let api = AuthApiClient::new(
    ApiClientOptions::new("https://auth.example.com").with_credentials(ApiCredentials::bearer("token")),
)?;
let connections = api
    .connections()
    .list(&ConnectionsListPath { account_id, directory_id })
    .await?;

Methods are grouped by the service handler module that answers them (api.connections(), api.oauth()). Each takes the parameter groups the operation declares (path, query, headers, body) as references to the structs in generated::types. The generated items are hidden from the rendered reference because there are hundreds of them; generated::operations::OPERATIONS lists every operation by key.

Re-exports§

pub use runtime::Maybe;
pub use runtime::NdjsonPage;
pub use transport::ApiClientOptions;
pub use transport::ApiCredentials;
pub use transport::ApiError;
pub use transport::ApiResponseError;
pub use transport::CallOptions;
pub use transport::ClientBasicCredential;
pub use transport::ClientBasicSource;
pub use transport::ClientErrorCode;
pub use transport::OperationDescriptor;
pub use transport::TokenSource;
pub use transport::Transport;

Modules§

runtime
Support types the generated models are written with (WP-21 R-21.1).
transport
The one hand-written part of the generated API client: it turns an OperationDescriptor plus typed input into an HTTP request, and the response back into a result (WP-21 R-21.1).

Structs§

AuthApiClient
The generated client. Methods are grouped by the service handler module that answers them: api.connections().list(..).