Struct heroku_rs::framework::HttpApiClient [−][src]
pub struct HttpApiClient { /* fields omitted */ }
Expand description
The client used to make requests to Heroku.
This struct contains the synchronous client.
Implementations
impl HttpApiClient
[src]
impl HttpApiClient
[src]pub fn create(token: &str) -> Fallible<HttpApiClient>
[src]
pub fn create(token: &str) -> Fallible<HttpApiClient>
[src]Example 1:
Creating a simple client with the defaults. This has the production Heroku endpoint, 30 seconds timeout and the standard api key authentication.
use heroku_rs::prelude::*; fn main() -> Result<(), Box<dyn std::error::Error>> { let api_client = HttpApiClient::create("API_KEY")?; // you can start making requests here Ok(()) }
pub fn new(
credentials: Credentials,
config: HttpApiClientConfig,
environment: ApiEnvironment
) -> Fallible<HttpApiClient>
[src]
pub fn new(
credentials: Credentials,
config: HttpApiClientConfig,
environment: ApiEnvironment
) -> Fallible<HttpApiClient>
[src]Example 2:
Creating a custom client in which you can specify the custom endpoint, timeouts and custom credentials.
This example is using a API key to authenticate, 10 second timeouts, and https://api.custom-somewhere.com/
base endpoint.
This is primarily used for testing / developement.
use heroku_rs::prelude::*; use std::time::Duration; fn main() -> Result<(), Box<dyn std::error::Error>> { let credentials = Credentials::UserAuthToken { token: String::from("API_KEY"), }; let api_client = HttpApiClient::new( credentials, HttpApiClientConfig { http_timeout: Duration::from_secs(10), default_headers: http::HeaderMap::default(), }, ApiEnvironment::Custom(url::Url::parse("https://api.custom-somewhere.com/").unwrap()))?; // you can start making requests here with api_client Ok(()) }
Trait Implementations
impl<'a> HerokuApiClient for HttpApiClient
[src]
impl<'a> HerokuApiClient for HttpApiClient
[src]fn request<ResultType, QueryType, BodyType>(
&self,
endpoint: &dyn HerokuEndpoint<ResultType, QueryType, BodyType>
) -> ApiResponse<ResultType> where
ResultType: ApiResult,
QueryType: Serialize,
BodyType: Serialize,
[src]
fn request<ResultType, QueryType, BodyType>(
&self,
endpoint: &dyn HerokuEndpoint<ResultType, QueryType, BodyType>
) -> ApiResponse<ResultType> where
ResultType: ApiResult,
QueryType: Serialize,
BodyType: Serialize,
[src]Synchronously send a request to the Heroku API.
fn request_raw<ResultType, QueryType, BodyType>(
&self,
endpoint: &dyn HerokuEndpoint<ResultType, QueryType, BodyType>
) -> ApiResponse<Response> where
ResultType: ApiResult,
QueryType: Serialize,
BodyType: Serialize,
[src]
fn request_raw<ResultType, QueryType, BodyType>(
&self,
endpoint: &dyn HerokuEndpoint<ResultType, QueryType, BodyType>
) -> ApiResponse<Response> where
ResultType: ApiResult,
QueryType: Serialize,
BodyType: Serialize,
[src]This returns a Result<reqwest::blocking::Response, heroku_rs::framework::response::error::HerokuApiFailure> Read more
Auto Trait Implementations
impl !RefUnwindSafe for HttpApiClient
impl Send for HttpApiClient
impl Sync for HttpApiClient
impl Unpin for HttpApiClient
impl !UnwindSafe for HttpApiClient
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]