Skip to content

⚠️ !Breaking Change! Extend the generated models in the wrappers, remove getData() - #21

Merged
pavog merged 4 commits into
mainfrom
extend-models
Oct 20, 2026
Merged

pavog merged 4 commits into
mainfrom
extend-models

Conversation

@pavog

@pavog pavog commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

The wrappers Project, Version and Author now extend the generated models instead of wrapping them. All getters of the models can be called on the wrappers directly, so getData() is no longer needed:

// before
$title = $project->getData()->getTitle();

// after
$title = $project->getTitle();
Wrapper extends
Client\Project Model\Resource
Client\Version Model\ResourceUpdate
Client\Author Model\Author

Breaking changes

Project had two methods with the same name as getters of the model. The model getters take precedence now:

Method before after
getCategory() Client\Category enum Model\ResourceCategory (id, title, description)
getAuthor() Client\Author, fetched from the API Model\ResourceAuthor (id, username), no request

The previous behaviour is available under new names:

  • getCategoryType() returns the Client\Category enum.
  • fetchAuthor() fetches the full author from the API. Methods that send a request are prefixed with fetch to distinguish them from the model getters.

Removed

getData() is removed. Call the getters on the wrapper directly instead, e.g. $project->getTitle() instead of $project->getData()->getTitle().

Tests and README

  • All uses of getData() are removed from the tests and the README.
  • New unit tests check that the wrappers are instances of the models and that getAuthor() and getCategory() do not send requests.
  • The integration test for author projects no longer fetches the author of every project, which saves requests against the rate-limited API.

@pavog pavog added this to the 3.0.0 milestone Oct 16, 2026
@pavog pavog changed the title ⚠️ !Breaking Change! Extend the generated models in the wrappers ⚠️ !Breaking Change! Extend the generated models in the wrappers, remove getData() Oct 20, 2026
# Conflicts:
#	tests/Unit/Client/VersionTest.php
@pavog
pavog merged commit 7d877dc into main Oct 20, 2026
4 checks passed
@pavog
pavog deleted the extend-models branch October 20, 2026 10:42
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