-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
catalog.go
86 lines (78 loc) · 3.47 KB
/
catalog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
import (
"time"
)
// CatalogEntry represents a repository's metadata of a tag or default branch as an entry of the catalog
type CatalogEntry struct {
ID int64 `json:"id"`
Self string `json:"url"`
Name string `json:"name"`
Owner string `json:"owner"`
FullName string `json:"full_name"`
Repo *Repository `json:"repo"`
Release *Release `json:"release"`
TarballURL string `json:"tarbar_url"`
ZipballURL string `json:"zipball_url"`
GitTreesURL string `json:"git_trees_url"`
ContentsURL string `json:"contents_url"`
Language string `json:"language"`
LanguageTitle string `json:"language_title"`
LanguageDir string `json:"language_direction"`
LanguageIsGL bool `json:"language_is_gl"`
Subject string `json:"subject"`
Resource string `json:"resource"`
Title string `json:"title"`
Ref string `json:"branch_or_tag_name"`
RefType string `json:"ref_type"`
CommitSHA string `json:"commit_sha"`
Stage string `json:"stage"`
MetadataURL string `json:"metadata_url"`
MetadataJSONURL string `json:"metadata_json_url"`
MetadataAPIContentsURL string `json:"metadata_api_contents_url"`
MetadataVersion string `json:"metadata_version"`
MetadataType string `json:"metadata_type"`
ContentFormat string `json:"content_format"`
Released time.Time `json:"released"`
Ingredients []*Ingredient `json:"ingredients,omitempty"`
Books []string `json:"books,omitempty"`
}
// Ingredient is a single project of a resource
type Ingredient struct {
Categories []string `json:"categories"`
Identifier string `json:"identifier"`
Path string `json:"path"`
Sort int `json:"sort"`
Title string `json:"title"`
Versification string `json:"versification"`
AlignmentCount *int `json:"alignment_count,omitempty"`
}
// CatalogSearchResults results of a successful catalog search
type CatalogSearchResults struct {
OK bool `json:"ok"`
Data []*CatalogEntry `json:"data"`
LastUpdated time.Time `json:"last_updated"`
}
// CatalogVersionEndpoints Info on the versions of the catalog
type CatalogVersionEndpoints struct {
Latest string `json:"latest"`
Versions map[string]string `json:"versions"`
}
// CatalogStages a repo's catalog stages
type CatalogStages struct {
Production *CatalogStage `json:"prod"`
PreProduction *CatalogStage `json:"preprod"`
Latest *CatalogStage `json:"latest"`
}
// CatalogStage a repo's catalog stage metadata
type CatalogStage struct {
Ref string `json:"branch_or_tag_name"`
ReleaseURL *string `json:"release_url"`
CommitSHA string `json:"commit_sha"`
Released time.Time `json:"released"`
ZipballURL string `json:"zipball_url"`
TarballURL string `json:"tarball_url"`
GitTreesURL string `json:"git_trees_url"`
ContentsURL string `json:"contents_url"`
}