Add [ClassicPress] badge - #12097
Conversation
|
|
Hello @KesleyDavid 👋🏻 Do you have any information on the API rate limits? Are these API endpoints intended for public use (turned out that some of the WordPress equivalents were not)? |
|
Hi @PyvesB — thanks for the heads-up, and for the pointer to #7356. That WordPress situation is exactly the kind of thing I wanted to double-check before this moved further. I went through the ClassicPress side of things: Public use: These endpoints are covered in their official developer guide (ClassicPress Directory API), including a walkthrough for consuming them with Rate limits: I couldn’t find any documented quotas, and the live responses don’t send rate-limit headers either. So there’s no hard number I can point at — just the assumption that we should be careful with how often we hit them. With that in mind I pushed a small follow-up on this branch:
Tests still pass ( If you’d rather we get an explicit okay from ClassicPress on third-party use before merging, I’m happy to open that conversation. Otherwise this should be in better shape on the load side. |
Bump cache to 1h for slow-moving platform metadata, request only meta fields, and document the public Directory API in OpenAPI descriptions.
6ad7efe to
b710f00
Compare
I think it's fine to keep the default cache until we hypothetically run into a problem. Can you please revert those changes back? The "Requests only ask for meta" change does seem useful, let's keep that one. |
Follow maintainer feedback: drop the 1h _cacheLength override and OpenAPI description about longer caching so platform-support defaults apply. Keep _fields=meta to reduce Directory API payload size.
|
Hi @PyvesB — thanks for the guidance, really appreciate the careful review (and the call to keep things simple until there's a real load problem). I applied your feedback:
Also merged latest Happy to adjust further if anything else stands out. |
| message: 'not set for this plugin', | ||
| }) | ||
|
|
||
| t.create('Plugin Required CP Version | Not Found') |
There was a problem hiding this comment.
Could you please switch all not found tests to live ones?
Fixes #6814
Adds ClassicPress badges, following the existing WordPress badge pattern:
/classicpress/plugin/cp-version/:slug/classicpress/theme/cp-version/:slug/classicpress/plugin/required-php/:slug/classicpress/theme/required-php/:slugAPI used
The endpoint originally proposed in the issue (
https://directory.classicpress.net/api/plugins/) no longer exists. These badges use the current, documented ClassicPress Directory API:https://directory.classicpress.net/wp-json/wp/v2/plugins/?byslug={slug}https://directory.classicpress.net/wp-json/wp/v2/themes/?byslug={slug}Docs: https://docs.classicpress.net/developer-guides/classicpress-directory-api/
The response is an array (empty for unknown slugs) whose items carry a
metaobject withcurrent_version,requires_cpandrequires_php.Note: the issue also requested
/classicpress/plugin/tested/:slug, but the directory API does not expose a "tested up to" field, so that badge is not included.How tested
npm run test:services -- --only=classicpress— 9 passing (live tests against the real directory API + nock-mocked tests for not-found / not-set cases)npx eslint services/classicpress/**/*.js— cleannpm run badge -- /classicpress/plugin/cp-version/switch-to-classicpress→classicpress | v1.7Drafted with AI assistance; reviewed by me (KesleyDavid).