InsionInsion
Rust

Configuration

Configure Rust authentication, retries, timeouts, headers, and request overrides

Overview

Configuration is optional. The SDK's defaults are suitable for most integrations, so you only need this guide when you want fine-grained control over behavior such as retries, timeouts, headers, and per-request overrides.

use insion::{ApiClientBuilder, prelude::*};
use std::time::Duration;

let client = ApiClientBuilder::default()
    .token("<token>")
    .timeout(Duration::from_secs(30))
    .max_retries(2)
    .custom_header("X-Application", "community-api")
    .build()?;

Keep the API key on a trusted server. Never expose it in client applications, logs, or source control.

The default timeout is 60 seconds and the retry limit is three.

Per-request options

Every operation accepts Option<RequestOptions> as its final argument.

let options = RequestOptions::new()
    .timeout_seconds(10)
    .max_retries(0)
    .additional_header("X-Request-ID", "req-123");

let page = client.list_records(&ListRecordsQueryRequest::default(), Some(options)).await?;

How is this guide?

On this page

Latest Release

View the Rust SDK on crates.ioRust SDK versionRust SDK license