This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println!("creating report..."); | |
generate_report(&token).await?; | |
println!("downloaded report to: {}", REPORT_FILE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Serialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct StopTrackingRequest { | |
stopped_at: String, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct TimeEntryResponse { | |
created_time_entry: TimeEntry, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Serialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct TrackingRequest { | |
started_at: String, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct TrackingResponse { | |
current_tracking: Tracking, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if !activities.is_empty() { | |
println!("starting to track..."); | |
let tracking = start_tracking(&activities.get(0).expect("exists").id, &token).await?; | |
println!("started tracking: {:?}", tracking); | |
let time_entry = stop_tracking(&token).await?; | |
println!("created time entry: {:?}", time_entry); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct ActivitiesResponse { | |
activities: Vec<Activity>, | |
inactive_activities: Vec<Activity>, | |
archived_activities: Vec<Activity>, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println!("fetching activities..."); | |
let activities = fetch_activities(&token).await?; | |
println!("activities: {:?}", activities); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Deserialize, Debug)] | |
struct SpacesResponse { | |
data: Vec<Space>, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct Space { | |
id: String, | |
name: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Deserialize, Debug)] | |
struct MeResponse { | |
data: Me, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct Me { | |
user_id: String, | |
name: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println!("fetching me and spaces..."); | |
let me = fetch_me(&token).await?; | |
let spaces = fetch_spaces(&token).await?; | |
println!("fetched spaces: {:?} for {:?}", spaces, me); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn url(path: &str) -> String { | |
format!("{}{}", BASE_URL, path) | |
} |