Skip to main content

Crate vantage_api_client

Crate vantage_api_client 

Source
Expand description

Vantage adapters for HTTP-based API backends.

Two protocol adapters live side by side:

  • rest — generic REST API client. Maps Table<RestApi, E> to GET {base_url}/{table_name} with eq-conditions and pagination peeled into the URL query string.
  • graphql — GraphQL API client. Renders typed query documents with inline filters + variable-typed pagination, supports both Hasura and flat-argument (e.g. SpaceX) dialects, and bridges into Vista via a YAML schema map.

Every type a caller needs is re-exported here; see prelude for a one-stop import. Requests go through vantage-api-pool’s ResilientClient, whose types are re-exported too. The HTTP client is reqwest 0.12, which appears in the public API (RestApiBuilder::http_client, RestApi::http_request).

Re-exports§

pub use graphql::AnyGraphqlType;
pub use graphql::CountMode;
pub use graphql::FieldCondition;
pub use graphql::FilterDialect;
pub use graphql::GraphqlApi;
pub use graphql::GraphqlApiBuilder;
pub use graphql::GraphqlApiTableShell;
pub use graphql::GraphqlApiVistaFactory;
pub use graphql::GraphqlApiVistaSpec;
pub use graphql::GraphqlBlock;
pub use graphql::GraphqlColumnBlock;
pub use graphql::GraphqlColumnExtras;
pub use graphql::GraphqlCondition;
pub use graphql::GraphqlOp;
pub use graphql::GraphqlOperation;
pub use graphql::GraphqlSelect;
pub use graphql::GraphqlTableExtras;
pub use graphql::GraphqlType;
pub use graphql::GraphqlTypeVariants;
pub use graphql::RenderedQuery;
pub use graphql::Supports;
pub use rest::ApiColumnExtras;
pub use rest::ApiReferenceExtras;
pub use rest::ApiTableBlock;
pub use rest::ApiTableExtras;
pub use rest::FilterStrategy;
pub use rest::OrderingParams;
pub use rest::PaginationMode;
pub use rest::PaginationParams;
pub use rest::ResponseShape;
pub use rest::RestApi;
pub use rest::RestApiBuilder;
pub use rest::RestApiTableShell;
pub use rest::RestApiVistaFactory;
pub use rest::RestApiVistaSpec;
pub use rest::eq_condition;

Modules§

graphql
GraphQL adapter for Vantage.
prelude
Convenience prelude — use vantage_api_client::prelude::*; pulls in the public surface of both adapter modules in one shot.
rest
REST API adapter for Vantage.

Structs§

CallPolicy
The policy for one call.
ClientError
The failure of a call, once its retries (if any) are used up. The client produces these; ClientError::new exists for consumers that need to fabricate one, such as a test double for TransportEvent::Failed.
ResilientClient
A cheap-to-clone resilient HTTP client. Build via ResilientClient::builder.
ResilientClientBuilder
Builder for ResilientClient.
RetryPolicy
Bounded retry: exponential from base_backoff (doubling per attempt), capped at max_backoff, with jitter added before each sleep.

Enums§

BreakerMode
What an attempt does while the circuit breaker is open.
BreakerState
What a ResilientClient’s breaker is doing right now, for consumers that poll instead of tracking TransportEvents.
ErrorKind
Why a call failed. New kinds may be added; match with a wildcard arm.
Priority
Whether someone is waiting on the result of the request about to be sent. Transports choose their retry policy from it.
RetryMode
How many times, and how long apart, a failed attempt is repeated.
TransportEvent
One thing a client reports to its TransportObserver. New events may be added; match with a wildcard arm.

Traits§

TransportObserver
Receives a client’s TransportEvents.

Type Aliases§

AuthFuture
Future returned by the auth token refresher.
AuthRefresher
Acquire (or re-acquire) an auth token — called lazily and on 401.
BearerSource
Where a request’s bearer token comes from when it differs per caller: asked each time a request goes out, retries included, and answering the bare token (Bearer is prepended). None sends no Authorization header on that request.