eskom_se_push_api/
allowance.rs

1use derive_builder::Builder;
2use serde::Deserialize;
3use serde::Serialize;
4
5use crate::traits::Endpoint;
6#[cfg(any(feature = "async", doc))]
7use crate::traits::EndpointAsync;
8
9/// The URL builder for the Allowance Check endpoint
10/// ```rust
11/// let t = AllowanceCheckURL::default()
12/// // returns the url for built the endpoint
13/// t.url().unwrap()
14/// ```
15#[derive(Default, Builder, Debug)]
16#[builder(setter(into))]
17pub struct AllowanceCheckURL {}
18
19impl Endpoint for AllowanceCheckURL {
20  type Output = AllowanceCheck;
21
22  fn endpoint(&self) -> std::borrow::Cow<'static, str> {
23    std::borrow::Cow::Borrowed("https://developer.sepush.co.za/business/2.0/api_allowance")
24  }
25
26  fn url(&self) -> Result<url::Url, crate::errors::HttpError> {
27    Ok(url::Url::parse(&self.endpoint()).unwrap())
28  }
29}
30#[cfg(any(feature = "async", doc))]
31impl EndpointAsync for AllowanceCheckURL {}
32
33#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34#[serde(rename_all = "camelCase")]
35pub struct AllowanceCheck {
36  /// What is the status of your allowance.
37  pub allowance: Allowance,
38}
39
40#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
41#[serde(rename_all = "camelCase")]
42pub struct Allowance {
43  /// How many API calls have already been made excluding the allowance API.
44  pub count: i64,
45  /// The max amount of allowed API calls.
46  pub limit: i64,
47  /// The account type.
48  #[serde(rename = "type")]
49  pub type_field: String,
50}