[WIP] Tool with a long name to generate code for accessing your WP REST API endpoints
I don't have an exact timeline on when this will be complete and working. I just poke at it once in a while. ¯_(ツ)_/¯
Pull requests welcome. See the purpose and roadmap below if you're interested in contributing!
This project is under initial development and is not intended for use in production yet! Consider contributing to finish things up :)
cp .env.example .env
- Update the values to reflect your own site and intended use
node src/index.js
- Copy
wordpress-service.js
from theoutput
directory into your project.
import * as wpApi from './wordpress-service';
const post = wpApi.getPostsById(5).then(({ result: { body } }) => {
console.log('response', body);
});
My plan is to have a tool that can do all the dirty work of generating functions to access your site's API for you.
- Fetch and parse WP REST API schema into an object with modified params, args, etc. that we can pipe into a code template
- Snapshot test the parser!
- Support for fetch using apicase
- Easily implement your own adapter <-- Implemented with apicase!
- Verify that the generated code actually works ^^;
- Remove generation of
PUT
,PATCH
,DELETE
,POST
requests they are fully supported.
- Task to transpile TypeScript to JavaScript
- TypeScript code template with type declarations
- Find or create a test adapter with mock data so we can automate testing of the generated code.
- Properly implement non-GET requests