Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern API: Add curation parameter #583

Merged
merged 1 commit into from
Jun 9, 2023
Merged

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Jun 5, 2023

Add a new curation parameter to the API, which can be one of all, core, or community. It defaults to all in the API so that requests continue to work as expected.

See #580.

This parameter is also supported by the api.w.org endpoint, which will be used by the pattern explorer some time in the future (see WordPress/gutenberg#44611)

How to test the changes in this Pull Request:

This is an example request that will show "community" patterns.

http://localhost:8888/wp-json/wp/v2/wporg-pattern?locale=en_US&curation=community

Try the request with different curation values:

  • core should return only patterns with the core keyword
  • community should return only patterns without the core keyword (check keyword_slugs if you're not sure)
  • all should return all patterns, no filtering
  • any other value should trigger a validation error

You can also test on a sandbox, https://api.wordpress.org/patterns/1.0/?locale=en_US&curation=core

@ryelle ryelle added the [Component] Pattern Directory API The pattern API on WordPress.org, and/or the CPT endpoint label Jun 5, 2023
@ryelle ryelle self-assigned this Jun 5, 2023
Copy link
Contributor

@renintw renintw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a sandbox and LGTM 👍

@ryelle ryelle merged commit 1b14e53 into trunk Jun 9, 2023
@ryelle ryelle deleted the add/curation-parameter branch June 9, 2023 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Directory API The pattern API on WordPress.org, and/or the CPT endpoint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants