AllowanceCheckURLBuilder

Struct AllowanceCheckURLBuilder 

Source
pub struct AllowanceCheckURLBuilder {}
Expand description

Builder for AllowanceCheckURL.

Implementations§

Source§

impl AllowanceCheckURLBuilder

Source

pub fn build(&self) -> Result<AllowanceCheckURL, AllowanceCheckURLBuilderError>

Builds a new AllowanceCheckURL.

§Errors

If a required field has not been initialized.

Examples found in repository?
examples/normal.rs (line 9)
8fn main() {
9  let api = AllowanceCheckURLBuilder::default().build().unwrap();
10  // Need to import the Endpoint trait
11  let response = ureq::request(api.method(), api.url().unwrap().as_str())
12    .set(TOKEN_KEY, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13    .call();
14  match handle_ureq_response::<AllowanceCheck>(response) {
15    Ok(allowance) => {
16      println!(
17        "You have made {} API calls today",
18        allowance.allowance.count
19      );
20    }
21    Err(e) => {
22      eprintln!("Error: {}", e);
23    }
24  }
25}
More examples
Hide additional examples
examples/custom_env.rs (line 12)
9fn main() {
10  match get_token_from_env(Some("MY_CUSTOM_KEY")) {
11    Ok(val) => {
12      let api = AllowanceCheckURLBuilder::default().build().unwrap();
13      // Need to import the Endpoint trait
14      let response = ureq::request(api.method(), api.url().unwrap().as_str())
15        .set(TOKEN_KEY, &val)
16        .call();
17      match handle_ureq_response::<AllowanceCheck>(response) {
18        Ok(status) => {
19          println!("{:?}", status);
20        }
21        Err(e) => {
22          eprintln!("Error: {}", e);
23        }
24      }
25    }
26    Err(e) => panic!("Environment variable error: {}", e),
27  }
28}
examples/normal_reqwest.rs (line 10)
9fn main() {
10  let api = AllowanceCheckURLBuilder::default().build().unwrap();
11  // Need to import the Endpoint trait
12  let mut headers = header::HeaderMap::new();
13  headers.insert(
14    TOKEN_KEY,
15    header::HeaderValue::from_str("XXXXXXXXXXXXXXXXXXXXXXX").unwrap(),
16  );
17  let client = reqwest::blocking::ClientBuilder::new()
18    .default_headers(headers)
19    .build()
20    .unwrap();
21  let response = client.get(api.url().unwrap().as_str()).send();
22  match handle_reqwest_response_blocking::<AllowanceCheck>(response) {
23    Ok(allowance) => {
24      println!(
25        "You have made {} API calls today",
26        allowance.allowance.count
27      );
28    }
29    Err(e) => {
30      eprintln!("Error: {}", e);
31    }
32  }
33}

Trait Implementations§

Source§

impl Clone for AllowanceCheckURLBuilder

Source§

fn clone(&self) -> AllowanceCheckURLBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for AllowanceCheckURLBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,