Expand description
The one hand-written part of the generated API client: it turns an OperationDescriptor plus typed input into an
HTTP request, and the response back into a result (WP-21 R-21.1).
The generator (sdk/auth/tools/generate_clients.py) decides what exists and what it looks like; this module
decides how it travels. It mirrors the TypeScript and Python transports rule for rule, and the recorded exchanges in
sdk/auth/tester/fixtures/recorded-responses.json are replayed through all three:
- path parameters are percent-encoded one segment at a time, and
.or..is refused, because a URL parser would otherwise collapse it and aim the request at a different route; - credentials only go to https, or to a loopback host for local development;
- redirects are never followed, so a credential cannot be replayed to another origin;
- input the descriptor does not declare is an error, not silently dropped or sent;
- a credential goes only to an operation that lists that scheme;
- errors carry the status, the server’s error code and the request id, never the request, a header or a token.
Structs§
- ApiClient
Options - ApiCredentials
- One credential per security scheme named in the contract. The transport picks what an operation accepts.
- ApiResponse
Error - The service answered with a non-2xx status. It holds the status, the server’s error code and the request id, never the request, a header or a credential.
- Body
Spec - Call
Input - What a method hands the transport: each group as a JSON object (or absent). Every group is optional here; each descriptor declares which are required.
- Call
Options - Per-call settings. Build one and pass it with
AuthApiClient::with_options. - Client
Basic Credential - Excluded
Operation - A contract operation the client has no method for, with the coded reason.
- Operation
Descriptor - What the generator knows about one operation. The transport reads nothing else about the contract.
- Transport
- Executes descriptors over one
reqwest::Clientthat never follows a redirect.
Enums§
- ApiError
- Body
Kind - Client
Basic Source - Client
Error Code - Http
Method - Response
Kind - Surface
- Token
Source - A token, or a function that returns one on every call (so a refreshed token is picked up).
Functions§
- authorization
- Which Authorization header an operation gets, or none. Fails when it needs a credential that was not supplied.
- build_
path - The path of a call: the template with each parameter encoded.
.,..and an empty value are refused. - form_
quote application/x-www-form-urlencodedfor one component: a space is+,*-._and alphanumerics stay.- group
- Serialize one parameter group (or a body) for
CallInput.