Skip to content

Add readable endpoint to fetch a resource by ID#4

Merged
loevgaard merged 1 commit into
masterfrom
add-readable-endpoint
Jun 17, 2026
Merged

Add readable endpoint to fetch a resource by ID#4
loevgaard merged 1 commit into
masterfrom
add-readable-endpoint

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

  • Add a Readable endpoint capability following the existing trait-per-verb pattern (Creatable/Deletable): ReadableEndpointInterface + ReadableEndpointTrait expose getById(int $id) which does GET /{endpoint}/{id} and maps the response into the endpoint's DTO.
  • Wire the capability into the sales orders endpoint, so $client->salesOrders()->getById(123) now works.
  • Add Client::setDebug(bool) to switch the base URI between the production host (app.shipmondo.com) and the sandbox host (sandbox.shipmondo.com).
  • Clean up LiveClientTest: replace the scratch webhook tests with a getById smoke test that asserts the returned sales order id, and drop the now-unused imports.

Test plan

  • composer check-style — clean
  • composer analyse (Psalm) — no errors
  • composer phpunit — 25 tests pass (the live it_fetches_sales_order test is gated behind SHIPMONDO_LIVE)

Introduce ReadableEndpointInterface and ReadableEndpointTrait providing getById() (GET /{endpoint}/{id}), and wire it into the sales orders endpoint. Also add Client::setDebug() to target the sandbox API host.
@loevgaard loevgaard force-pushed the add-readable-endpoint branch from 716500b to e679010 Compare June 17, 2026 07:28
@loevgaard loevgaard merged commit c84fadb into master Jun 17, 2026
21 checks passed
@loevgaard loevgaard deleted the add-readable-endpoint branch June 17, 2026 07:51
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.

1 participant