ApiCaller

Derive Macro ApiCaller 

Source
#[derive(ApiCaller)]
{
    // Attributes available to this derive:
    #[api_req]
}
Expand description

Derive the Api trait

ยงExample

use api_req_derive::ApiCaller;
use reqwest::header;

#[derive(ApiCaller)]
#[api_req(
    base_url = "http://example.com",
    default_headers = [("k1", "v1"), (header::ORIGIN, "v2")],
    default_headers_env = [("k3", "API_KEY")],
    default_headers_env_or_omit = [("k4", "BALABALA")],
)]
struct ExampleApi;