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