Skip to content

feat: migrate ticket editing endpoint to V2 API#824

Merged
raluik merged 9 commits into
masterfrom
feat/ticket-edit-v2
Mar 16, 2026
Merged

feat: migrate ticket editing endpoint to V2 API#824
raluik merged 9 commits into
masterfrom
feat/ticket-edit-v2

Conversation

@2ndalpha

@2ndalpha 2ndalpha commented Mar 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Migrate TicketService.edit() from V1 (POST /v1/tickets/{id}/edit, form-encoded) to V2 (PATCH /tickets/{id}, JSON body with X-Qminder-API-Version: 2020-09-01 header)
  • Fix ApiBase.request() to preserve PATCH method with body and handle empty response bodies
  • Update TicketEditingParameters: remove extra/user, add languageCode, allow null to clear fields

Test plan

  • All 287 existing tests pass
  • New tests for PATCH method preservation and empty response handling
  • Build succeeds with no type errors
  • Verify against running V2 server

Update TicketService.edit() from V1 (POST /v1/tickets/{id}/edit,
form-encoded) to V2 (PATCH /tickets/{id}, JSON body with
X-Qminder-API-Version header).

Changes:
- ApiBase: preserve PATCH method with body, handle empty response bodies
- edit(): use PATCH + JSON body + version header, return void
- TicketEditingParameters: remove extra/user, add languageCode, allow null
Add descriptive error message when response body is not valid JSON
instead of exposing a raw SyntaxError. Reject empty changes object in
ticket edit to prevent sending a no-op PATCH request.
@2ndalpha 2ndalpha requested a review from raluik March 12, 2026 08:48
Comment thread packages/javascript-api/src/lib/services/api-base/api-base.ts Outdated
Comment thread packages/javascript-api/src/lib/services/api-base/api-base.ts Outdated
Comment thread packages/javascript-api/src/lib/services/api-base/api-base.ts Outdated
Comment thread packages/javascript-api/src/lib/services/api-base/api-base.ts Outdated
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.service.spec.ts Outdated
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.ts Outdated
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.service.ts
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.ts Outdated
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.ts
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.ts
Comment thread packages/javascript-api/src/lib/services/ticket/ticket.ts
- Replace `any` with generic type `T` for parsedResponse in api-base
- Remove unnecessary truthiness check on response.text() result
- Remove response body truncation in JSON parse error message
- Make languageCode non-nullable in TicketEditingParameters
- Update test descriptions for clarity
…ing review feedback

- Restore empty body handling for successful responses (V2 PATCH returns empty body)
- Remove redundant optional chaining inside options?.body guard
- Replace any with TicketEditingParameters in test fixture
- Revert languageCode JSDoc parenthetical per reviewer request
@2ndalpha 2ndalpha requested a review from raluik March 16, 2026 07:16
@raluik raluik added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit b4876d5 Mar 16, 2026
10 checks passed
@raluik raluik deleted the feat/ticket-edit-v2 branch March 16, 2026 08:14
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.

2 participants