Python client for the Zendesk API
Project description
Libzapi - The Official BCR.CX API Client for Zendesk
LibZapi is a powerful and easy-to-use API client designed specifically for interacting with the Zendesk. It simplifies the process of managing customer support tickets, automating workflows, and retrieving data from Zendesk, making it an essential tool for developers and support teams.
📐 Architectural Layers
LibZapi follows a lightweight Domain-Driven Design (DDD) structure with inspiration from CQRS (Command-Query Responsibility Segregation). Even though it’s an SDK, this separation keeps models clear, testable, and easy to extend.
| Layer | Concern / Responsibility | Example Classes / Modules |
|---|---|---|
| SDK Interface | Public entry point for consumers. Exposes simple, zendesk APIs (e.g., Ticketing, HelpCenter, Messaging). Converts inputs into commands. |
libzapi.Ticketing, libzapi.HelpCenter |
| Application | Coordinates use cases. Contains Commands and Services that implement the SDK’s operations. Responsible for mapping inputs to payloads and orchestrating infra calls. | CreateUserFieldCmd, UpdateGroupCmd, UserFieldsService, GroupsService |
| Domain | Defines core business concepts and rules, independent of Zendesk’s API format. Contains entities, value objects, and domain services that enforce invariants. | libzapi.domain.models.ticketing.brand.py, libzapi.domain.errors.py |
| Infrastructure | Handles all external integration logic. Encapsulates API clients, request signing, and serialization details. | UserFieldsApiClient, HttpClient, Mappers |
🔄 Example Flow
User calls libzapi.Ticketing(...).groups.list_all()
↓
SDK Interface: forwards call to GroupsService
↓
Application: GroupsService invokes GroupsApiClient to fetch data
↓
Infrastructure: GroupsApiClient executes HTTP GET to Zendesk API
↓
Domain: maps JSON into Group domain entities
↓
Returns List[Group] to the SDK user
Getting Started
Clone the repository and install the dependencies:
git clone https://github.com/BCR-CX/zapi.git
cd libzapi
Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
Install Python version 3.12
uv python install 3.12
Check that uv is installed
uv --version
As a smoke test run
uv run pytest tests/unit
If you get the green light, you are ready to go!
Steps to add a new API endpoint
- Identify the Endpoint: Determine the Zendesk API endpoint you want to add support for. Refer to the Zendesk API documentation for details.
- Start on domain/models: Create a new model class that represents the data structure returned by the API endpoint. Use existing models as references for naming conventions and structure.
- Go to infrastructure/mappers: Implement a mapper class that converts the raw API responses into the model classes you created earlier. This class should handle any necessary data transformations.
- Go to infrastructure/api_clients: Create a new API client class that implements the service contract interface. This class should handle the actual HTTP requests to the Zendesk API, using the appropriate HTTP methods and endpoints. Important. If your request has pagination, make sure to implement the pagination "yield_items" function.
- Go to application/services: Implement a service class that uses the API client to perform operations related to the new endpoint. This class should contain easy to read methods that encapsulate the logic for interacting with the API.
- Write Tests: Create unit tests for your new models, mappers, API clients, and services. Ensure that all tests pass before proceeding.
- Update Documentation: Update the README.md file to include information about the new endpoint, including usage examples and any relevant details.
- Commit and Push: Commit your changes to the repository and push them to the appropriate branch. Create a pull request for review.
- Review and Merge: Have your code reviewed by a team member. Once approved, merge the changes into the main branch.
Why go through all these steps?
Following these steps ensures that the new API endpoint is integrated into libzapi in a consistent and maintainable manner. It helps maintain code quality, promotes reusability, and ensures that the new functionality is well-tested and documented for future reference.
Testing
Testing uses pytest. There's also a cool package called hypothesis that does property based testing. As some Zendesk objects has a lot of fields, this makes testing easier.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libzapi-0.3.3.tar.gz.
File metadata
- Download URL: libzapi-0.3.3.tar.gz
- Upload date:
- Size: 425.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64a563ee27bc5004f87acbbde31c945fc4cddf0c8f326850ce512e85ce5fd803
|
|
| MD5 |
2c363851a2edbd021feb9ff939d6ed43
|
|
| BLAKE2b-256 |
77a10f49c922a6279d56c39e84cfea4ed612a95385b0b21a147e67b2c25e5b20
|
Provenance
The following attestation bundles were made for libzapi-0.3.3.tar.gz:
Publisher:
pypi-publish.yml on BCR-CX/libzapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libzapi-0.3.3.tar.gz -
Subject digest:
64a563ee27bc5004f87acbbde31c945fc4cddf0c8f326850ce512e85ce5fd803 - Sigstore transparency entry: 779857477
- Sigstore integration time:
-
Permalink:
BCR-CX/libzapi@2d5dece907640fc1be507891773542ab4010bf2b -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/BCR-CX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@2d5dece907640fc1be507891773542ab4010bf2b -
Trigger Event:
release
-
Statement type:
File details
Details for the file libzapi-0.3.3-py3-none-any.whl.
File metadata
- Download URL: libzapi-0.3.3-py3-none-any.whl
- Upload date:
- Size: 107.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83416863b755253fa4523beaf51137157203383c2a252eed4ccb0012f875f024
|
|
| MD5 |
34d1e10d239bfa7837575115eafe725f
|
|
| BLAKE2b-256 |
e81dba609b4ba5d5a88e1da72e05a2732433ea72ba0064ee0599e12840b6d591
|
Provenance
The following attestation bundles were made for libzapi-0.3.3-py3-none-any.whl:
Publisher:
pypi-publish.yml on BCR-CX/libzapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libzapi-0.3.3-py3-none-any.whl -
Subject digest:
83416863b755253fa4523beaf51137157203383c2a252eed4ccb0012f875f024 - Sigstore transparency entry: 779857478
- Sigstore integration time:
-
Permalink:
BCR-CX/libzapi@2d5dece907640fc1be507891773542ab4010bf2b -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/BCR-CX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@2d5dece907640fc1be507891773542ab4010bf2b -
Trigger Event:
release
-
Statement type: