Skip to content

Conversation

@ashfame
Copy link
Member

@ashfame ashfame commented Jan 3, 2025

closes #187

@ashfame ashfame self-assigned this Jan 3, 2025
@ashfame ashfame marked this pull request as ready for review January 3, 2025 18:29
@ashfame ashfame linked an issue Jan 3, 2025 that may be closed by this pull request
Base automatically changed from devex_api_wp to trunk January 7, 2025 11:03
@ashfame ashfame requested a review from psrpinto January 7, 2025 11:04
@ashfame
Copy link
Member Author

ashfame commented Jan 7, 2025

Removing the non-WP API from documentation, so that we are only advertising WP-y API.

For future reference, this is the non WP API:

\DotOrg\TryWordPress\Ops::handle(
	SubjectType::PRODUCT->value,
	array(
		'slug'        => 'myplugin_unique_slug',
		'description' => 'myplugin handling products',
	),
	'myplugin_unique_slug_product_handler'
);

But currently we only advertise WP-y API as you can see in file diff of this PR.

Later in future, when we start offering read-only view of data (i.e. observe) or access at a later date, that's when Ops class would surface again with Ops::observe() and Ops::loop(). But for now, they are not used.

Only downside with WP-y API is that we can't specify a slug or description for the handler in the same call.

It would also be an option to not have the Ops class since the idea is to only have folks use/interact with a single class that's a wrapper to multiple components. We can offer just explicit functions under our namespace like \DotOrg\TryWordPress\register_handler() vs \DotOrg\TryWordPress\Ops::handle()

@ashfame ashfame merged commit f175c90 into trunk Jan 7, 2025
3 checks passed
@ashfame ashfame deleted the devex_docs_update branch January 7, 2025 13: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.

Update documentation

3 participants