Repository navigation
Add pending reason operations: catalogue read and per-ticket get, set and clear - #53
Merged
Merged
Conversation
…read and the v1 per-ticket item get, set and clear, with their models and docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on its own line instead of continuing the previous bullet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…item on a never-pending ticket, and the v1 session requirement in the setup guidance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 98.13% 98.14% +0.01%
==========================================
Files 97 99 +2
Lines 3908 3985 +77
==========================================
+ Hits 3835 3911 +76
- Misses 73 74 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Nov 23, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A GLPI ticket set to Pending (status 4) can carry a pending reason from the instance's catalogue, and the client had no way to read or set it. The v2 API lists the catalogue (
/Assistance/PendingReason). But its ticket-item schema omits the catalogue id, and no v2 route writes an item. So the per-ticket part has to go through the legacy v1 API (PendingReason_Item).Fix
A new
PendingReasonMixinon both clients:list_pending_reasonsanditer_pending_reasonsread the catalogue through v2.get_ticket_pending_reason,set_ticket_pending_reasonandclear_ticket_pending_reasonhandle a ticket's item through v1, so they need the v1 session and raiseRuntimeErrorwithout one.set_ticket_pending_reasonreads the item first, creates it (POST) or updates it (PUT), and returns it read back.clear_ticket_pending_reasonreturns whether an item was deleted.PendingReasonandPendingReasonItem, exported from the package root and fromglpi_python_client.models.Tests
Unit tests on both trees cover:
The methods were also checked by hand against a live GLPI instance (v2 and legacy v1 APIs), on a throwaway ticket, 16 checks passed:
False;Locally,
ruff check,mypy glpi_python_client,unasync_build.py --checkand the sphinx-Wbuild pass, and so do the test files this branch touches (32 passed). The full suite and the coverage gate run in CI.Overlaps with other open PRs
This PR only conflicts with the other open PRs (#50, #51, #52) in
CHANGELOG.md: keep both entries.Suggested merge order: #50, #51, #52, #53. After each merge I rebase the next branch: the conflicts are the
CHANGELOG.mdentries, plus one import line in_v1_session.pyfor #51.🤖 Generated with Claude Code