API Reference

Api reference for pyznuny, here you can find all the classes and methods available in the library, with examples of how to use them.

class pyznuny.TicketClient(base_url=None, *, username=None, password=None, endpoints=None, timeout=None, headers=None, client=None)[source]

Bases: object

Represents a client for interacting with the Ticket API

Parameters:
  • base_url (str | None) – Base URL for the Ticket API which the client will connect to

  • username (str | None) – Username for authentication

  • password (str | None) – Password for authentication

  • endpoints (EndpointsRegistry | None) – Optional custom endpoints registry

  • timeout (float | None) – Request timeout

  • headers (Mapping[str, str] | None) – Optional custom headers

  • client (httpx.Client | None)

ticket: TicketRoutes

Ticket routes handler. See TicketClient.ticket.

set_endpoint: EndpointSetter

Endpoint setter helper. See TicketClient.set_endpoint.

TicketClient.ticket

The attribute TicketClient.ticket exposes the following methods. .

class pyznuny.ticket.routes.TicketRoutes(client)[source]

Bases: object

Object representing the routes for the Ticket API, this is abstracted by the TicketClient

Parameters:

client (TicketClient)

create(payload=None, **payload_kwargs)[source]

Creates a new ticket

Parameters:
  • payload (TicketCreatePayload | Mapping[str, Any] | None) – Ticket creation payload

  • payload_kwargs (Any) – Additional keyword arguments for the payload

Returns:

Response object

Return type:

httpx.Response

update(ticket_id, **payload)[source]

Updates an existing ticket

Parameters:
  • ticket_id (str | int) – ID of the ticket to update

  • payload (dict) – Map of the fields to update

Returns:

Response object

Return type:

httpx.Response

get(ticket_id, dynamic_fields=0, all_articles=0)[source]

Retrieves an existing ticket

Parameters:
  • ticket_id (str | int) – ID of the ticket to retrieve

  • dynamic_fields (int) – Number of dynamic fields to retrieve, defaults to 0

  • all_articles (int) – Whether to retrieve all articles, 1 for true 0 for false, defaults to 0

Returns:

Response object

Return type:

httpx.Response

TicketClient.set_endpoint

The attribute TicketClient.set_endpoint exposes the following methods.

class pyznuny.ticket.endpoints.EndpointSetter(client)[source]

Bases: object

Custom endpoint setter for the Ticket API

Parameters:
ticket_create(*, endpoint, method='POST')[source]

Sets a custom endpoint for creating tickets

Parameters:
  • endpoint (str) – Custom endpoint for creating tickets

  • method (HttpMethod) – HTTP method for creating tickets, defaults to POST

Returns:

Endpoint object

Return type:

Endpoint

ticket_get(*, endpoint, identifier='ticket_id', method='GET')[source]

Sets a custom endpoint for retrieving a ticket.

Parameters:
  • endpoint (str) – Custom endpoint path

  • identifier (str) – Identifier for the ticket ID in the endpoint path

  • method (HttpMethod) – HTTP method for the endpoint, defaults to GET

Returns:

Registered endpoint

Return type:

Endpoint

ticket_update(*, endpoint, identifier='ticket_id', method='POST')[source]

Sets a custom endpoint for updating a ticket.

Parameters:
  • endpoint (str) – Custom endpoint path

  • identifier (str) – Identifier for the ticket ID in the endpoint path

  • method (HttpMethod) – HTTP method for the endpoint, defaults to POST

Returns:

Registered endpoint

Return type:

Endpoint