SDK-2793-php-task-response-recommandation added#404
Merged
mehmet-yoti merged 1 commit intodevelopmentfrom Apr 8, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for parsing and exposing task-level “recommendation” data in the DocScan session retrieve models, along with dedicated response objects and tests.
Changes:
- Extend
TaskResponseto parse an optionalrecommendationpayload and expose it viagetRecommendation(). - Introduce
TaskRecommendationResponseandTaskRecommendationReasonResponsemodels to represent the nested recommendation structure. - Add/extend PHPUnit coverage for the new models and the new
TaskResponseaccessor.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/DocScan/Session/Retrieve/TaskResponse.php | Parse recommendation and add getRecommendation() accessor. |
| src/DocScan/Session/Retrieve/TaskRecommendationResponse.php | New model for task recommendation (value + reason object). |
| src/DocScan/Session/Retrieve/TaskRecommendationReasonResponse.php | New model for recommendation reason (value + detail). |
| tests/DocScan/Session/Retrieve/TaskResponseTest.php | Extend existing task response tests to cover recommendation parsing/null behavior. |
| tests/DocScan/Session/Retrieve/TaskRecommendationResponseTest.php | New unit tests for TaskRecommendationResponse. |
| tests/DocScan/Session/Retrieve/TaskRecommendationReasonResponseTest.php | New unit tests for TaskRecommendationReasonResponse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
SDK-2793: Preserve recommendation in TaskResponse
Problem
The
TaskResponseclass did not deserialize or preserve therecommendationfield returned by the API. When a task response included a recommendation (e.g.MUST_TRY_AGAINwith a reason), this data was silently discardedTaskRecommendationResponse— holdsvalue(string) andreason(TaskRecommendationReasonResponse)TaskRecommendationReasonResponse— holdsvalue(string) anddetail(string)Example payload now supported
{ "type": "ID_DOCUMENT_TEXT_DATA_EXTRACTION", "id": "b54287a1-...", "state": "DONE", "recommendation": { "value": "MUST_TRY_AGAIN", "reason": { "value": "USER_ERROR", "detail": "NO_DOCUMENT" } } }