Crate prima_bridge

source ·
Expand description

This crate gives an high level API to execute external HTTP requests.

It is supposed to give the basics building blocks for building bridges to other services while abstracting the low level stuff like adding custom headers and request tracing.

It supports both REST and GraphQL requests.

You should start by creating a Bridge instance. This instance should live for all the application lifetime.

Do not create a new bridge on every request!

You should use something like once_cell or lazy_static, or some sort of inversion of control container to pass around.

The bridge implement a type state pattern to build the external request.

Modules

auth0auth0
Stuff used to provide JWT authentication via Auth0

Structs

A request body.
A Bridge instance which can be used to issue HTTP requests to an external service.
A builder for creating Bridge instances.
A struct representing a GraphQL error according to the GraphQL specification.
The GraphQLRequest is a struct that represent a GraphQL request to be done with a Bridge.
A multipart-form file, containing the file’s desired name, its MIME type, and its contents as an in-memory buffer or stream.
A named multipart-form field which contains a file.
A utility type to construct requests more easily.
A server response.
The RestRequest is a struct that represent a REST request to be done with a Bridge.

Enums

A GraphQLRequest multipart body as according to this specification.
An error type to represent all possible outcomes of a GraphQL response deserialization.
Determines how to handle HTTP redirects (3xx responses).
A RestRequest multipart form body.

Traits

Represents a request that is ready to be delivered to the server.

Type Definitions

A type returned from parse_graphql_response function useful for getting full control of a GraphQL response.