pub struct Client { /* private fields */ }
Expand description

Client for communicating with APIs through HTTP/HTTPS.

When making a HTTP request or starting a websocket connection with this client, a handler that implements RequestHandler is required.

Implementations§

Constructs a new Client.

Makes an HTTP request with the given RequestHandler and returns the response.

It is recommended to use methods like get() because this method takes many type parameters and parameters.

The request is passed to handler before being sent, and the response is passed to handler before being returned. Note, that as stated in the docs for RequestBuilder::query(), parameter query only accepts a sequence of key-value pairs.

Makes an GET request with the given RequestHandler.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Makes an GET request with the given RequestHandler, without queries.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Makes an POST request with the given RequestHandler.

This method just calls request(). It requires less typing for type parameters and parameters.

For more information, see request().

Makes an POST request with the given RequestHandler, without a body.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Makes an PUT request with the given RequestHandler.

This method just calls request(). It requires less typing for type parameters and parameters.

For more information, see request().

Makes an PUT request with the given RequestHandler, without a body.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Makes an DELETE request with the given RequestHandler.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Makes an DELETE request with the given RequestHandler, without queries.

This method just calls request(). It requires less typing for type parameters and parameters. This method requires that handler can handle a request with a body of type (). The actual body passed will be None.

For more information, see request().

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more