Skip to content

feat(ticketing): complete Tickets CUD + deleted tickets + tags + merge + spam#77

Merged
lmeilibr merged 2 commits into
mainfrom
feature/tickets-cud
Apr 21, 2026
Merged

feat(ticketing): complete Tickets CUD + deleted tickets + tags + merge + spam#77
lmeilibr merged 2 commits into
mainfrom
feature/tickets-cud

Conversation

@lmeilibr
Copy link
Copy Markdown
Contributor

Summary

First PR in the multi-PR effort to close the Zendesk Ticketing API coverage gap. Adds the missing write operations and related read endpoints on the Tickets resource.

New endpoints on `ticketing.tickets`:

method HTTP path
`delete(id)` DELETE `/tickets/{id}`
`destroy_many(ids)` DELETE `/tickets/destroy_many`
`update_many(ids, **fields)` PUT `/tickets/update_many?ids=…`
`update_many_individually(pairs)` PUT `/tickets/update_many`
`mark_as_spam(id)` PUT `/tickets/{id}/mark_as_spam`
`mark_many_as_spam(ids)` PUT `/tickets/mark_many_as_spam`
`merge(target, source_ids, …)` POST `/tickets/{id}/merge`
`list_related(id)` GET `/tickets/{id}/related`
`list_deleted()` GET `/deleted_tickets`
`restore(id)` / `restore_many(ids)` PUT `/deleted_tickets/{id}/restore`
`permanently_delete(id)` / `permanently_delete_many(ids)` DELETE `/deleted_tickets/…`
`problems_autocomplete(text)` POST `/problems/autocomplete`
`list_tags` / `set_tags` / `add_tags` / `remove_tags` GET/POST/PUT/DELETE `/tickets/{id}/tags`

Supporting changes:

  • `HttpClient.delete` now accepts an optional `json` body (required for `DELETE /tags`). All existing callers ignore the return value, so the change is backward-compatible.
  • New `MergeTicketsCmd` command, `TicketRelated` and `ProblemMatch` domain models.
  • `tickets_service.py` switched to `from future import annotations` so `list_tags() -> list[str]` doesn't collide with the class's `list()` method at class-body eval time.

Test plan

  • Unit tests pass: `1445 passed`
  • Integration tests collect (21 ticket tests in total)
  • Integration tests pass against a live Zendesk tenant (requires `ZENDESK_URL`, `ZENDESK_EMAIL`, `ZENDESK_TOKEN`)
  • `mark_as_spam` may return 422 if the default requester on created tickets is an agent — verify against tenant
  • `problems_autocomplete` soft-asserts because of indexing lag — verify the empty-match path doesn't mask a real failure

🤖 Generated with Claude Code

…s, tags

Covers the Zendesk Tickets endpoints that were missing write coverage:
delete, destroy_many, update_many (uniform + individual), mark_as_spam
(single + many), merge, list_related, list_deleted, restore (single +
many), permanently_delete (single + many), problems/autocomplete, and
ticket-scoped tags (list/set/add/remove).

HttpClient.delete now accepts an optional json body so DELETE /tags can
send {"tags": [...]}. New domain types: TicketRelated, ProblemMatch.
New command: MergeTicketsCmd. 18 new integration tests (live tenant)
cover every new endpoint with the create-exercise-verify pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds unit coverage for the new ticket endpoints and mappers:
- TickestService: update_many, update_many_individually, merge (comment
  visibility flags), delete/destroy_many, mark_as_spam/mark_many_as_spam,
  restore/restore_many, permanently_delete/_many, problems_autocomplete,
  list_tags/set_tags/add_tags/remove_tags, plus the new read-only list
  methods (list_related, list_deleted, etc.).
- TicketApiClient: create/update/create_many path + payload assertions,
  update_many ids query, update_many_individually id-embedded payload,
  delete/destroy_many, spam endpoints, restore/permanently_delete,
  merge (payload shape), list_related, list_deleted, problems_autocomplete,
  and all four tag helpers (including DELETE with json body).
- ticket_mapper: new test_ticket_mapper.py covering to_payload_create
  (all fields + empty custom_fields), to_payload_update (truthy-field
  filtering, empty/None skipping), and to_payload_merge (ids-only,
  with target/source comment visibility flags, iterable source_ids).

Coverage on the PR #1 modules goes from 57-70% to 100% across
ticket_api_client, tickets_service, ticket_mapper, ticket_cmds, and
the Ticket domain model.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@lmeilibr lmeilibr merged commit 0985e07 into main Apr 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant