Skip to content

Enumerate Generic Packages via API #35762

@imgurbot12

Description

@imgurbot12

Feature Description

Gitea has the ability to view and access all packages in your organization via the web-ui, but there is no way to do this programatically via the API. Other package variants have their own manifests to support the specific technologies toolsets but this does not exist for the generic package registry.

I intend to use this resource for automated asynchronous deployments for the latest versions of code packages published to the generic package registry, and I believe it would useful for others making use of the generic package registry as well.

Something like /api/packages/<ownerId>/generic/<packagename>/list would work well I believe.

A simple JSON api would work well enough containing just the basic information about the relevant packages. I've built a prototype model of what might be returned for example:

// PackageFileInfo represents information about an existing package file
type PackageFileInfo struct {
	Name        string             `json:"name"`
	CreatedUnix timeutil.TimeStamp `json:"created"`
}

// PackageInfo represents information about an existing package file
type PackageInfo struct {
	Version       string            `json:"version"`
	DownloadCount int64             `json:"downloads"`
	Files         []PackageFileInfo `json:"files"`
}
curl http://localhost:3000/api/packages/TestOrg/generic/examplePackage/list

returns:

[{"version":"v0.1.0","downloads":0,"files":[{"name":"example.tar.gz","created":1761612511}]}]

I already have a prototype PR that matches this design, but would appreciate feedback before posting. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions