Skip to content

Add Project DTO and expand it to cover the detail endpoint - #5

Merged
jhhazelaar merged 3 commits into
mainfrom
feature/project-dto
May 20, 2026
Merged

Add Project DTO and expand it to cover the detail endpoint#5
jhhazelaar merged 3 commits into
mainfrom
feature/project-dto

Conversation

@jhhazelaar

Copy link
Copy Markdown
Member

Summary

  • Introduces the Project DTO and wires it through GetProjectRequest and GetProjectsRequest, so the resource methods now return typed objects instead of raw response arrays.
  • Expands the DTO to cover all ~60 attributes returned by the detail endpoint as nullable, typed properties (ints, floats, bools where appropriate; raw strings for text/HTML/URLs).
  • Adds nesbot/carbon as a runtime dependency and parses all date and timestamp fields (including created_at / updated_at) into CarbonImmutable instances.
  • Breaking change: Project::$created_at and Project::$updated_at change from string to CarbonImmutable. Downstream consumers will need to update.

Test plan

  • composer install to pick up nesbot/carbon ^3.0.
  • vendor/bin/pest — full suite is green locally (19 passed, 137 assertions).
  • Hit a real detail endpoint via the SDK and confirm presale_date, created_at, etc. come back as CarbonImmutable and that integer / float / bool fields are properly typed.
  • Confirm the list endpoint still works (detail-only properties fall back to null).

🤖 Generated with Claude Code

jhhazelaar and others added 3 commits May 20, 2026 09:44
The detail endpoint returns ~60 attributes per project, but the DTO
only exposed seven of them; everything else was silently dropped.
Map the full payload into typed, nullable properties so callers of
the detail endpoint get the data they need, and parse date and
timestamp fields into CarbonImmutable for ergonomic downstream use.

Changelog: added

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the redundant numeric Project_Id mapping (the uuid already
identifies a project) and convert the free-form internal status
string into a typed ProjectStatus enum so callers can branch on
known states instead of comparing Dutch labels.

Changelog: changed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The API response is always string-or-null, so the int/self handling
in parse() was dead weight. Use ProjectStatus::tryFrom() directly
in the DTO mapping, guarded by isset() for the null case.

Changelog: changed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jhhazelaar
jhhazelaar merged commit e77bc77 into main May 20, 2026
18 checks passed
@jhhazelaar
jhhazelaar deleted the feature/project-dto branch May 20, 2026 09:00
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