Skip to content

Instantly share code, notes, and snippets.

@zupzup
Created December 2, 2020 12:25
Show Gist options
  • Save zupzup/c6b1f055fd2b5bb1d1c413b4427a100c to your computer and use it in GitHub Desktop.
Save zupzup/c6b1f055fd2b5bb1d1c413b4427a100c to your computer and use it in GitHub Desktop.
Timeular Webhooks Types
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TrackingStartedPayload {
user_id: String,
event_type: String,
data: TrackingStartedData,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TrackingStartedData {
current_tracking: Tracking,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct Tracking {
id: i64,
activity: Activity,
started_at: String,
note: Note,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct Note {
text: Option<String>,
tags: Vec<TagOrMention>,
mentions: Vec<TagOrMention>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct TagOrMention {
id: i64,
key: String,
label: String,
scope: String,
space_id: String,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct Activity {
id: String,
name: String,
color: String,
integration: String,
space_id: String,
device_side: Option<i64>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TrackingStoppedPayload {
user_id: String,
event_type: String,
data: TrackingStoppedData,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TrackingStoppedData {
new_time_entry: Option<TimeEntry>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct TimeEntry {
id: String,
activity: Activity,
duration: Duration,
note: Note,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct Duration {
started_at: String,
stopped_at: String,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment