up_api/v1/
mod.rs

1#[macro_use]
2mod macros;
3
4/// Error types and trait implementations.
5pub mod error;
6/// Types for modelling and interacting with
7/// [accounts](https://developer.up.com.au/#accounts).
8pub mod accounts;
9/// Types for modelling and interacting with
10/// [categories](https://developer.up.com.au/#categories).
11pub mod categories;
12/// Types for modelling and interacting with
13/// [tags](https://developer.up.com.au/#tags).
14pub mod tags;
15/// Types for modelling and interacting with
16/// [transactions](https://developer.up.com.au/#transactions).
17pub mod transactions;
18/// Types for modelling and interacting with
19/// [utilities](https://developer.up.com.au/#utility_endpoints).
20pub mod utilities;
21/// Types for modelling and interacting with
22/// [webhooks](https://developer.up.com.au/#webhooks).
23pub mod webhooks;
24/// Types which are stardized (and named) across many resources.
25pub mod standard;
26
27
28static BASE_URL: &str = "https://api.up.com.au/api/v1";
29
30/// A client for interacting with the Up API.
31pub struct Client {
32    access_token: String,
33}
34
35impl Client {
36    /// Creates an instance of the `Client` from the access token. Visit
37    /// [this page](https://api.up.com.au/getting_started) to get such a token.
38    pub fn new(access_token: String) -> Self {
39        Client {
40            access_token
41        }
42    }
43
44    fn auth_header(&self) -> String {
45        format!("Bearer {}", self.access_token)
46    }
47}