I have been working on a fork of the popular shields library to add a shield/badge for displaying the number of downloads/installs a particle library has. In theory, this is quite simple: call the API (libraries/ endpoint) and grab the number of installs and display on a cute little badge to embed within your Readme file or anywhere else. I have implemented/tested it with my own projects and it works great. However, as of now, all Particle API endpoints are protected and thus you must have an access token. This complicates things since including an access_token within the shields library is a bit of a no-no for security reasons. After speaking with the folks that moderate the shields library, they have basically said that they won’t accept a PR unless I can prove the access_tokens are very tight in scope (only providing read access to specific endpoints).
As far as I can tell, there are a few options:
- Particle can make a publicly available (unprotected) libraries endpoint that provides only public information (name, downloads, version, author?)
- New scope capabilities will be needed on the API side of things so that shields will allow me to send a PR for the existing code.
Can anyone at Particle comment on these/other possibilities? While not terribly important, I think it would be a cool little feature that is already mostly complete. The fork of the shields repository I am working on can be found here if anyone else wants to look/help.