pub struct TicketsApi<'a> { /* private fields */ }Expand description
Ticket endpoints.
Implementations§
Source§impl<'a> TicketsApi<'a>
impl<'a> TicketsApi<'a>
Sourcepub async fn get(&self, id: u64) -> Result<Ticket>
pub async fn get(&self, id: u64) -> Result<Ticket>
GET /api/v1/tickets/:id - return the compact Ticket shape.
Sourcepub async fn get_expanded(&self, id: u64) -> Result<TicketExpanded>
pub async fn get_expanded(&self, id: u64) -> Result<TicketExpanded>
GET /api/v1/tickets/:id?expand=true - return the TicketExpanded
shape with human-readable group/state/priority/customer/owner/organization names.
Sourcepub fn list(&self) -> ListTickets<'a, Ticket>
pub fn list(&self) -> ListTickets<'a, Ticket>
GET /api/v1/tickets - paginated list of compact tickets.
Sourcepub fn list_expanded(&self) -> ListTickets<'a, TicketExpanded>
pub fn list_expanded(&self) -> ListTickets<'a, TicketExpanded>
GET /api/v1/tickets?expand=true - paginated list of expanded tickets.
Sourcepub fn search(&self, query: impl Into<String>) -> SearchTickets<'a, Ticket>
pub fn search(&self, query: impl Into<String>) -> SearchTickets<'a, Ticket>
GET /api/v1/tickets/search?query=… - Zammad query DSL, compact shape.
Sourcepub fn search_expanded(
&self,
query: impl Into<String>,
) -> SearchTickets<'a, TicketExpanded>
pub fn search_expanded( &self, query: impl Into<String>, ) -> SearchTickets<'a, TicketExpanded>
GET /api/v1/tickets/search?query=…&expand=true - expanded shape.
Sourcepub fn create(&self) -> CreateTicket<'a>
pub fn create(&self) -> CreateTicket<'a>
POST /api/v1/tickets - build the ticket via the returned builder.
Sourcepub async fn update<P: Serialize + ?Sized>(
&self,
id: u64,
patch: &P,
) -> Result<Ticket>
pub async fn update<P: Serialize + ?Sized>( &self, id: u64, patch: &P, ) -> Result<Ticket>
PUT /api/v1/tickets/:id - accepts any Serialize patch.
The whole request body is replaced by the serialized patch, so pass
either a &serde_json::Value for ad-hoc updates or a typed struct
you’ve defined yourself.
Sourcepub async fn set_field(
&self,
id: u64,
field: &str,
value: impl Into<Value>,
) -> Result<Ticket>
pub async fn set_field( &self, id: u64, field: &str, value: impl Into<Value>, ) -> Result<Ticket>
Set a single field (typically a custom field) and verify the value was actually persisted server-side.
Zammad’s API will happily return 200 OK with the unchanged ticket if
you write to a field that doesn’t exist on the Ticket object. This
helper re-reads the field from the response body and surfaces
Error::WriteVerificationFailed when the round-trip didn’t stick.
value accepts anything convertible to a Value - strings,
numbers, booleans, arrays, …