Skip to content

SDK-2793-php-task-response-recommandation added#404

Merged
mehmet-yoti merged 1 commit intodevelopmentfrom
SDK-2793-php-task-response-dont-preserve-the-recommendation
Apr 8, 2026
Merged

SDK-2793-php-task-response-recommandation added#404
mehmet-yoti merged 1 commit intodevelopmentfrom
SDK-2793-php-task-response-dont-preserve-the-recommendation

Conversation

@mehmet-yoti
Copy link
Copy Markdown
Contributor

SDK-2793: Preserve recommendation in TaskResponse

Problem

The TaskResponse class did not deserialize or preserve the recommendation field returned by the API. When a task response included a recommendation (e.g. MUST_TRY_AGAIN with a reason), this data was silently discarded

  • TaskRecommendationResponse — holds value (string) and reason (TaskRecommendationReasonResponse)
  • TaskRecommendationReasonResponse — holds value (string) and detail (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"
    }
  }
}

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TaskResponse to parse an optional recommendation payload and expose it via getRecommendation().
  • Introduce TaskRecommendationResponse and TaskRecommendationReasonResponse models to represent the nested recommendation structure.
  • Add/extend PHPUnit coverage for the new models and the new TaskResponse accessor.

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.

@nikhilPank nikhilPank assigned nikhilPank and unassigned nikhilPank Mar 13, 2026
@nikhilPank nikhilPank self-requested a review March 13, 2026 16:57
Copy link
Copy Markdown
Contributor

@nikhilPank nikhilPank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mehmet-yoti mehmet-yoti merged commit 648c999 into development Apr 8, 2026
16 checks passed
@mehmet-yoti mehmet-yoti mentioned this pull request Apr 8, 2026
@mehmet-yoti mehmet-yoti mentioned this pull request Apr 17, 2026
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.

3 participants