Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@rachelbaker
Copy link
Member

Initial Controller routes and methods:

  • get all posts
  • get a post
  • get revisions for a post
  • create a post
  • update a post
  • delete a post

Test coverage routes and methods:

  • get all posts
  • get single post
  • get revisions for a post
  • create a post
  • update a post
  • delete a post

- Included new class-wp-json-posts-controller.php file in plugin.
- Added GET posts and posts/id routes to initial registered routes.
- Migrated logic from old WP_JSON_Posts class for get_items.
- Migrated logic from old WP_JSON_Posts class for get_item.
- Migrated logic from old WP_JSON_Posts class to prepare response.
- Added sanitization for request parameters.
- Extracted logic for processing author and status params into separate methods.
- Use get_params() to actually check and process request parameters.
Copy link
Member

Choose a reason for hiding this comment

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

Why return null instead of an empty string?

@rachelbaker
Copy link
Member Author

Still needs:

  • Abstraction in the Base class where json_url() is used. Any suggestions here of how we can dynamically get the correct route path?
  • Discussion on what to do with prepare_item_response(). Should this method be included in the Base class with a bunch of post_type_supports() conditions? Or abstracted out per endpoint Controller?
  • Confirmation that we don't need the embed context at all. Previously we have used this for "embedding" post_parents into a response.
  • Discussion on @danielbachhuber's suggestion of using get_item() instead of get_post(). I don't understand how this DRY's up the code, or would be useful.
  • Review on the Base class. Anything else we want to add/remove here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants