http-request-derive-client 0.3.0

Use derive to create HTTP requests - client interface
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
//
// SPDX-License-Identifier: MIT OR Apache-2.0

use http_request_derive::HttpRequest;

/// A client that can execute [`http_request_derive::HttpRequest`]s.
#[async_trait::async_trait(?Send)]
pub trait Client {
    /// An error that can be returned during request execution by the [`Client`].
    type ClientError: std::error::Error;

    /// Execute a [`http_request_derive::HttpRequest`], and read the typed response.
    async fn execute<R: HttpRequest + Send>(
        &self,
        request: R,
    ) -> Result<R::Response, Self::ClientError>;
}