Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 4, 2025

This PR implements the changes from PR #127 to add a proper IODataResponse interface and correct return type annotations throughout the codebase.

Changes Made

1. Added IODataResponse Interface

Created a new IODataResponse interface that defines the contract for response objects with methods:

  • getBody() - Get decoded response body
  • getRawBody() - Get undecoded response body
  • getStatus() - Get HTTP status code
  • getHeaders() - Get response headers
  • getResponseAsObject($returnType) - Convert response to OData SDK objects
  • getSkipToken() - Get pagination skip token
  • getId() - Get response ID for inserts

2. Updated ODataResponse Implementation

Modified the existing ODataResponse class to implement the new IODataResponse interface, ensuring type safety and proper interface compliance.

3. Fixed Return Types in IODataClient Interface

Updated the IODataClient interface to:

  • Change return type from IODataRequest to IODataResponse for existing methods (get, getNextPage, cursor)
  • Add missing method signatures for post, patch, delete, and request methods with correct IODataResponse return types

4. Updated ODataClient Implementation

Fixed all return type annotations in the ODataClient class from IODataRequest to IODataResponse for HTTP methods:

  • get()
  • getNextPage()
  • post()
  • put()
  • patch()
  • delete()
  • request()

5. Query Builder Improvements

Updated Query\Builder class:

  • Removed unused IODataRequest import
  • Fixed return type annotations for internal methods (runGet, runPost, runPatch, runDelete)
  • Changed insert() method return type from bool to IODataResponse

6. Updated IProcessor Interface

Modified Query\IProcessor interface to use IODataResponse instead of IODataRequest for the processSelect() method.

Why This Change?

The previous codebase had inconsistent return type annotations where HTTP methods were documented to return IODataRequest but actually returned response objects. This created confusion about the API contract and made it unclear what type of object consumers should expect.

With this change:

  • Type Safety: Clear interface contracts make it obvious what methods return
  • Better Documentation: PHPDoc annotations now match actual return types
  • Consistency: All HTTP methods consistently return response objects implementing IODataResponse
  • Future Maintenance: Having a proper interface makes it easier to extend response functionality

Backward Compatibility

This change is backward compatible as it only affects type annotations and interface definitions. The actual runtime behavior and returned objects remain the same - they just now implement a proper interface contract.

Resolves the interface inconsistencies mentioned in #83 and implements the improvements from PR #127.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/CarbonPHP/carbon/zipball/76b5c07b8a9d2025ed1610e14cef1f3fd6ad2c24
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/doctrine/inflector/zipball/6d6c96277ea252fc1304627204c3d5e6e15faa3b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/illuminate/collections/zipball/2737a0477a3f4855a71bf8f3d0b8d32596ded628
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/illuminate/conditionable/zipball/ec677967c1f2faf90b8428919124d2184a4c9b49
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/illuminate/contracts/zipball/f1c4cf02c9ab81a9ce47940cf261fa2386ed6c5d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/illuminate/macroable/zipball/e862e5648ee34004fa56046b746f490dfa86c613
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/illuminate/support/zipball/487bbe527806615b818e87c364d93ba91f27db9b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/PqTYpM /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/clock/zipball/b81435fbd6648ea425d1ee96a2d8e68f4ceacd24
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/translation-contracts/zipball/df210c7a2573f1913b2d17cc95f90f53a73d8f7d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/symfony/translation/zipball/e0837b4cbcef63c754d89a4806575cada743a38d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)
  • https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/UmOHcU /usr/bin/composer install --no-dev --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@anderly anderly marked this pull request as ready for review September 4, 2025 05:37
Copilot AI changed the title [WIP] Add IODataResponse and Correct Interfaces and Return Types Add IODataResponse interface and fix return types across HTTP methods Sep 4, 2025
Copilot AI requested a review from anderly September 4, 2025 05:42
@anderly anderly merged commit af28a2d into master Sep 4, 2025
12 checks passed
@anderly anderly deleted the copilot/fix-718bc12c-966e-46be-8d07-123baa9fb2b2 branch September 5, 2025 21:48
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