# babelforce-manager-sdk
Rust SDK for the babelforce **manager APIs** — auth, user & agent management, call reporting,
metrics, and task automations.
One client, configured once, exposes resource namespaces over the API. Authentication, typed
errors, and retries are handled for you.
📖 **Docs:** https://babelforce.github.io/manager-sdk/
## Install
```toml
[dependencies]
babelforce-manager-sdk = "0.44"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
## Usage
```rust,no_run
use babelforce_manager_sdk::{Auth, ManagerClient};
#[tokio::main]
async fn main() -> Result<(), babelforce_manager_sdk::ManagerError> {
let mgr = ManagerClient::connect(Auth::ClientCredentials {
client_id: "…".into(),
client_secret: "…".into(),
})
.await?; // base_url defaults to https://services.babelforce.com
for user in mgr.users.list_all().await? {
println!("{}", user.email);
}
Ok(())
}
```
Point at another host or tune retries with the builder:
```rust,no_run
# use babelforce_manager_sdk::{Auth, ManagerClient, RetryPolicy};
# async fn f() -> Result<(), babelforce_manager_sdk::ManagerError> {
let mgr = ManagerClient::builder(Auth::Bearer { token: "…".into() })
.base_url("https://acme.babelforce.com")
.retry(RetryPolicy::default())
.connect()
.await?;
# Ok(()) }
```
## Authentication
`Auth` selects how the client authenticates:
- `Auth::RefreshToken { refresh_token, client_id, client_secret }` — a refresh token from the
Authorization Code + PKCE flow (helpers: `pkce_challenge`, `build_authorize_url`, plus
`mgr.auth.token` for the code exchange). `client_secret` is `None` for public PKCE clients;
confidential clients set it.
- `Auth::ClientCredentials { client_id, client_secret }` — server-to-server (credential issuance is
in security review; see the guide).
- `Auth::Bearer { token }` — a token you already hold (used as-is; the SDK cannot renew it).
- `Auth::Password { user, pass, client_id }` — OAuth2 password grant (legacy); `client_id: None`
uses the default `"manager"` client.
The grant-based flavours resolve their token at connect (failing fast on bad credentials) and
transparently re-grant it shortly before it expires — refresh-token rotation included — so a
long-lived client keeps working without rebuilding.
See the [Authentication guide](https://babelforce.github.io/manager-sdk/guides/authentication) for
the full PKCE walkthrough and when to use each flow.
> This SDK is generated from the same OpenAPI specs as the TypeScript and Go SDKs and is at full
> parity with them — see the [coverage page](https://babelforce.github.io/manager-sdk/coverage).
## License
Apache-2.0.