summaryrefslogtreecommitdiffstats
path: root/modules/packages
diff options
context:
space:
mode:
authorJack Vine <jackv24@users.noreply.github.com>2022-09-24 20:54:33 +0930
committerGitHub <noreply@github.com>2022-09-24 19:24:33 +0800
commit83680c97a7fd23d2a2953302771ed2b234c0689e (patch)
treeff0affb5ab524b24955a1793074150cac2572f2f /modules/packages
parentda0a9ec81132dabbec0d217d5f6a49550ce6793a (diff)
downloadgitea-83680c97a7fd23d2a2953302771ed2b234c0689e.tar.gz
gitea-83680c97a7fd23d2a2953302771ed2b234c0689e.zip
NPM Package Registry search API endpoint (#20280)
Close #20098, in the NPM registry API, implemented to match what's described by https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search Currently have only implemented the bare minimum to work with the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui.html). Co-authored-by: Jack Vine <jackv@jack-lemur-suse.cat-prometheus.ts.net> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/packages')
-rw-r--r--modules/packages/npm/creator.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/packages/npm/creator.go b/modules/packages/npm/creator.go
index 88ce55ecdb..2ed4d26248 100644
--- a/modules/packages/npm/creator.go
+++ b/modules/packages/npm/creator.go
@@ -96,6 +96,34 @@ type PackageDistribution struct {
NpmSignature string `json:"npm-signature,omitempty"`
}
+type PackageSearch struct {
+ Objects []*PackageSearchObject `json:"objects"`
+ Total int64 `json:"total"`
+}
+
+type PackageSearchObject struct {
+ Package *PackageSearchPackage `json:"package"`
+}
+
+type PackageSearchPackage struct {
+ Scope string `json:"scope"`
+ Name string `json:"name"`
+ Version string `json:"version"`
+ Date time.Time `json:"date"`
+ Description string `json:"description"`
+ Author User `json:"author"`
+ Publisher User `json:"publisher"`
+ Maintainers []User `json:"maintainers"`
+ Keywords []string `json:"keywords,omitempty"`
+ Links *PackageSearchPackageLinks `json:"links"`
+}
+
+type PackageSearchPackageLinks struct {
+ Registry string `json:"npm"`
+ Homepage string `json:"homepage,omitempty"`
+ Repository string `json:"repository,omitempty"`
+}
+
// User https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#package
type User struct {
Username string `json:"username,omitempty"`