Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapcraft #9103

Closed
slaclau opened this issue Apr 21, 2023 · 6 comments · Fixed by #9976
Closed

Snapcraft #9103

slaclau opened this issue Apr 21, 2023 · 6 comments · Fixed by #9976
Labels
service-badge New or updated service badge

Comments

@slaclau
Copy link

slaclau commented Apr 21, 2023

📋 Description

It would be great to be able to publish a badge showing the version of a a package in the snap store for the various channels

🔗 Data

api.snapcraft.io

🎤 Motivation

Lots of packages are published as snaps

@slaclau slaclau added the service-badge New or updated service badge label Apr 21, 2023
@chris48s
Copy link
Member

chris48s commented May 1, 2023

Is this a public API? There used to be some docs at https://dashboard.snapcraft.io/docs/api/snap.html#obtaining-information-about-a-snap (refs #2544 ) but that link is dead now and I'm not able to find a link to public api docs for snapcraft.

@slaclau
Copy link
Author

slaclau commented May 1, 2023

Hi, yes - it is a public API - the docs are at http://api.snapcraft.io/docs/

@jcs090218
Copy link

It would be great if this is implemented. :D

@jNullj
Copy link
Contributor

jNullj commented Feb 17, 2024

I can add this one.
This requires Macaroon auth

edit: not sure about that, I'm getting responses without authentication for some unknown reason

jNullj added a commit to jNullj/shields-fun-fork that referenced this issue Feb 17, 2024
@jNullj
Copy link
Contributor

jNullj commented Feb 17, 2024

This is a small try at it at #9976
Example render for redis:
image

@jcs090218
Copy link

Wow, this is awesome! You rock! 😍

github-merge-queue bot pushed a commit that referenced this issue Mar 10, 2024
* Add snapstore version badge

Fixes #9103

* Add basic test for Snapcraft version

* Handle snapstore-version - package not found

* Add test for invalid snapcraft package

* Remove redundent SnapstoreBase class

not needed as there is no auth

* Remove logo from default

The project convention is using namedLogo by default only for social badges.
This commit removes the default logo usage as this badge is not in the social category.

* Rename snapstore to snapcraft

Keep 1 convention for the snapcraft badge, use only snapcraft and ditch snapstore.

* Fix SnapcraftVersion schema

* Use renderVersionBadge

Replace the costume render in SnapcraftVersion with renderVersionBadge

* Rename folder from snapstore to snapcraft

* Add track & risk path parameters for SnapcraftVersion

enhancing control and clarity

* Add architecture query parameter to SnapcraftVersion

Added architecture query parameter: The snapcraft-version.service.js file now accepts an optional arch query parameter to specify the desired architecture for the Snap package. This defaults to amd64 if not provided.

If an unsupported architecture is specified in the query parameter, a NotFound error is thrown with a specific message indicating that the requested architecture is not found.

The snapcraft-version.tester.js file is updated to include a new test case that verifies the behavior when using the arch query parameter and also includes a test case for handling an invalid architecture.

* move filter logic into a transform function

* Fix filter logic

The goal here was to filter by all conditions with logic and.
Before this fix the only the logic of the last filter is used.

* Add tests for SnapcraftVersion.transform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants