zammad_api/api/
priorities.rs1use reqwest::Method;
2
3use crate::client::Client;
4use crate::error::Result;
5use crate::models::TicketPriority;
6
7const PATH: &str = "api/v1/ticket_priorities";
8
9#[derive(Debug)]
11pub struct PrioritiesApi<'a> {
12 client: &'a Client,
13}
14
15impl<'a> PrioritiesApi<'a> {
16 pub(crate) fn new(client: &'a Client) -> Self {
17 Self { client }
18 }
19
20 pub async fn list(&self) -> Result<Vec<TicketPriority>> {
22 let req = self.client.request(Method::GET, PATH);
23 self.client.send_json(req).await
24 }
25
26 pub async fn get(&self, id: u64) -> Result<TicketPriority> {
28 let req = self.client.request(Method::GET, &format!("{PATH}/{id}"));
29 self.client.send_json(req).await
30 }
31}