Expand description
§mesa-dev
Rust SDK for the mesa.dev API.
Note: A large part of this documentation was generated with the assistance of an LLM. If you spot inaccuracies, please open an issue.
This crate provides a typed, async-first client for managing repositories, branches, commits, content, diffs, and API keys on the Mesa platform.
§Quick Start
With the default reqwest-client feature enabled:
use mesa_dev::{Mesa, MesaError, models::CreateRepoRequest};
let client = Mesa::new("my-api-key");
let repo = client
.repos("my-org")
.create(&CreateRepoRequest {
name: "my-repo".to_owned(),
default_branch: None,
})
.await?;
// Auto-paginate through all branches
let branches = client
.branches("my-org", "my-repo")
.list_all()
.collect()
.await?;§Client Configuration
Use ClientBuilder for fine-grained control over timeouts, retries, and
base URL:
use std::time::Duration;
use mesa_dev::ClientBuilder;
let client = ClientBuilder::new("my-api-key")
.timeout(Duration::from_secs(60))
.max_retries(5)
.build();§Custom HTTP Backends
The SDK is generic over its HTTP transport. Implement HttpClient to use
any HTTP library, add middleware, or mock requests in tests:
use mesa_dev::{ClientBuilder, HttpClient, HttpRequest, HttpResponse, error::HttpClientError};
struct MyClient;
impl HttpClient for MyClient {
async fn send(
&self,
request: HttpRequest,
) -> Result<HttpResponse, HttpClientError> {
todo!("implement your HTTP transport here")
}
}
let client = ClientBuilder::new("my-api-key").build_with(MyClient);See the HttpClient trait documentation for a detailed guide on
implementing custom backends, including how to map errors for correct retry
behavior.
§Feature Flags
| Feature | Description | Default |
|---|---|---|
reqwest-client | Async HTTP backend via reqwest | Yes |
ureq-client | Blocking HTTP backend via ureq | No |
To disable all built-in backends (for custom implementations only), use:
mesa-dev = { version = "0.1", default-features = false }Re-exports§
pub use error::ApiErrorCode;pub use error::HttpClientError;pub use error::MesaError;pub use backends::ReqwestClient;
Modules§
- backends
- Built-in HTTP client backend implementations.
- error
- Error types for the Mesa SDK.
- models
- API model types.
- resources
- Resource namespaces for the Mesa API.
Structs§
- Client
Builder - Builder for constructing a
MesaClientwith custom configuration. - Client
Config - Configuration for a
MesaClient. - Http
Request - An HTTP request to be sent by an
HttpClientimplementation. - Http
Response - An HTTP response returned by an
HttpClientimplementation. - Mesa
Client - The Mesa API client, generic over an HTTP backend
C. - Page
Stream - An async page stream that lazily fetches pages from a paginated endpoint.
Traits§
- Http
Client - Trait for pluggable HTTP client backends.
Type Aliases§
- Mesa
- Convenience type alias when using the default reqwest backend.