Skip to main content

Crate assinafy

Crate assinafy 

Source
Expand description

§Assinafy Rust SDK

Idiomatic, async Rust client for the Assinafy electronic-signature API (https://api.assinafy.com.br/v1).

The SDK is organised around a single Client that exposes a resource module per API surface — signers, documents, assignments, templates, tags, activities, API keys, and authentication helpers. Every call is async, returns a strongly-typed Result, and uses the same response envelope the API itself uses ({ status, message, data }).

§Quick start

use assinafy::Client;

let client = Client::builder()
    .api_key("your-api-key")
    .build()?;

// List signers in an account.
let signers = client
    .signers("102d25a489f34a275d31a16045fd")
    .list()
    .send()
    .await?;

for s in &signers.data {
    println!("{} <{:?}>", s.full_name, s.email);
}

§Authentication

The SDK supports the three credential schemes the API accepts:

  • Auth::ApiKey — sent as the X-Api-Key header (recommended for server-to-server use).
  • Auth::Bearer — sent as Authorization: Bearer <token> (for tokens obtained from AuthApi::login).
  • Auth::AccessToken — sent as the documented ?access-token=... query parameter when that legacy form is required.
  • Auth::AccessCode — sent as the ?signer-access-code=... query parameter for signer-facing endpoints.

Switch credentials at runtime with Client::with_auth.

§Environments

Both production and sandbox base URLs are first-class:

use assinafy::Client;

let sandbox = Client::builder()
    .api_key("test-key")
    .sandbox()
    .build()
    .unwrap();

§Errors

All operations return Result<T, Error>. API failures preserve the HTTP status, the server-provided message and the raw data payload so callers can branch on specific error codes without losing fidelity.

§Cargo features

  • rustls-tls (default) — TLS via rustls.
  • native-tls — TLS via the operating system’s native stack.

Modules§

models
Strongly-typed representations of every resource the API returns.
resources
API resource handles, one per logical area of the Assinafy API.

Structs§

ApiError
Structured payload returned by the Assinafy API for non-2xx responses.
Client
The Assinafy API client.
ClientBuilder
Fluent builder for Client.
Envelope
Generic Assinafy response envelope: { status, message, data }.
Page
A page of results, combining the decoded items with pagination metadata extracted from the server’s X-Pagination-* headers.
PaginationMeta
Pagination metadata reported by the API via X-Pagination-* response headers.

Enums§

Auth
Credential used to authenticate API requests.
BaseUrl
Base URL used for API requests.
Error
The error type for all SDK operations.

Type Aliases§

Result
Convenience alias for results returned by this crate.