So yeah, integrating the API itself is not a complex task, but I have a question here. Would it not be better to make the API return data in a way that is as close as possible to how WP is currently doing it?
I mean, why change the returned structure and then adapt the core to that new structure?
Why not make the API return data in a way that is as close as possible (if not the same) as WP is currently doing it?
Changing the api at this point is suboptimal
While nothing is yet really implemented… amongst other things there’s a request to create shields for GitHub that is already sent to the folks making those, and while they don’t seem to have started on it, it would be bad changing this at such late point
I’m also not so sure that’d be without a considerable effort to redo the directory api at this point.
However Wade is the only who can really answer that particular detail, as Viktor mentioned
Perfect I just wonder why the API has been implemented in a different way than the WP one. Making it spit out the same structure would have been more straight to the point, especially because things like the following wouldn’t require any change:
As I’ve mentioned in other places, there is good reason to have the API the same (although a bit improved for versions) as WP, because there was a small change put into WP that is easily backported, that checks for Update URI in the plugin header. That means WP is already set to update a plugin from wherever it specifies, as long as it uses the same responses.
(This meta ticket is where they check that the header does not exist for the WP repo: #5747 (Block plugins using invalid `Update URI` headers) – Making WordPress.org)
I think it might be good to reuse code/design when adding the CP plugin and theme directory.
If you go into the Customizer and click on Change Theme, you get a screen like below. This provides the ability to choose which repository you want on the left and the list from that repository on the right. (I never used it on a phone, so I don’t know how that looks.)
This same design could be used for the plugin page and theme page outside of the Customizer, although it might make more sense to reduce the size of the list of repositories. They could be submenu items or part of the page.
If we have an example of the way the API is returning the data we can change it, I think we had an issue somewhere to do that but I don’t think anyone ever got around to adding an example for me to use as a reference.