Skip to main content

Module api

Module api 

Source
Expand description

§API

The api module provides the entry point to the public API. Requests are routed to the appropriate handler for processing, returning a response that can be serialized to a JSON object or directly to HTTP.

§Example Usage

use omnia_sdk::{Body, Client, Headers};

// Create a client (typestate builder)
let client = Client::new("alice").provider(provider);

// Simple request without headers
let response = client.request(my_request).await?;

// Request with headers
let response = client.request(my_request).headers(my_headers).await?;

Structs§

Client
Build an API client to execute the request.
Context
Request-scoped context passed to Handler::handle.
HttpError
Error type for HTTP requests.
NoOwner
Marker type indicating no owner has been set yet.
NoProvider
Marker type indicating no provider has been set yet.
NoRequest
Marker type indicating no request has been set yet.
OwnerSet
Marker type indicating the owner has been set.
ProviderSet
Marker type indicating the provider has been set.
Reply
Top-level response data structure common to all handlers.
RequestHandler
Request router.
RequestSet
Marker type wrapping a request that has been set.

Traits§

Body
The Body trait is used to restrict the types able to implement request body. It is implemented by all xxxRequest types.
Handler
Trait to provide a common interface for request handling.
IntoBody
Implemented by the Reply::body to convert itself into a format compatible with [IntoResponse].
Provider
Provider trait for request handlers.

Type Aliases§

HttpResult
Result type for HTTP requests.
Request
Type alias for a RequestHandler.