Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

ArgMatches → HTTP request dispatch

Takes parsed clap matches and the matching ApiOperation, constructs an HTTP request, and returns the response.

§Three-phase dispatch

  1. PreparePreparedRequest::from_operation resolves URL, parameters, headers, and authentication from an ApiOperation and clap matches. build_body resolves the request body from --json / --field arguments.
  2. SendPreparedRequest::send transmits the request and returns a SendResponse containing full response metadata (status, headers, body, elapsed time).
  3. ConsumeSendResponse::into_json checks the status code and parses the body as JSON.

The convenience function dispatch chains all three steps for callers that don’t need the intermediate representations.

Structs§

PreparedRequest
A fully resolved HTTP request ready to be sent or inspected.
SendResponse
HTTP response from PreparedRequest::send.

Enums§

Auth
Authentication method for API requests.
ResolvedAuth
Owned authentication resolved from Auth.

Functions§

build_body
Resolve the request body from --json / --field clap arguments.
dispatch
Execute an API operation based on clap matches.