Add Tags
This commit is contained in:
parent
29a8865bd5
commit
9c20dc09ec
@ -10,5 +10,5 @@ async fn main() {
|
||||
sensitive::WORKSPACE_ID,
|
||||
);
|
||||
|
||||
dbg!(api.get_clients().await);
|
||||
dbg!(api.get_tags().await);
|
||||
}
|
||||
|
||||
@ -121,6 +121,18 @@ impl TogglApi {
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub async fn get_tags(&self) -> Result<Vec<types::Tag>, TogglError> {
|
||||
let url = format!(
|
||||
"{base_url}/workspaces/{workspace_id}/tags",
|
||||
base_url = BASE_URL,
|
||||
workspace_id = self.workspace_id
|
||||
);
|
||||
|
||||
Self::parse(self.client.get(&url)
|
||||
.headers(self.headers.clone())
|
||||
.send().await?).await
|
||||
}
|
||||
}
|
||||
|
||||
mod types {
|
||||
@ -201,6 +213,7 @@ mod types {
|
||||
actual_hours: Option<i64>,
|
||||
actual_seconds: Option<i64>,
|
||||
can_track_time: bool,
|
||||
permissions: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@ -237,6 +250,19 @@ mod types {
|
||||
/// The Workspace ID associated with the client.
|
||||
#[serde(rename = "wid")]
|
||||
pub workspace_id: i32,
|
||||
|
||||
permissions: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Tag {
|
||||
id: u64,
|
||||
name: String,
|
||||
workspace_id: u64,
|
||||
creator_id: u64,
|
||||
at: DateTime<Utc>,
|
||||
deleted_at: Option<DateTime<Utc>>,
|
||||
permissions: Option<String>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user