-
Notifications
You must be signed in to change notification settings - Fork 58
/
resources.go
100 lines (82 loc) · 2.34 KB
/
resources.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package resource
import (
"time"
)
type Source struct {
Owner string `json:"owner"`
Repository string `json:"repository"`
// Deprecated; use Owner instead
User string `json:"user"`
GitHubAPIURL string `json:"github_api_url"`
GitHubV4APIURL string `json:"github_v4_api_url"`
GitHubUploadsURL string `json:"github_uploads_url"`
AccessToken string `json:"access_token"`
Drafts bool `json:"drafts"`
PreRelease bool `json:"pre_release"`
Release bool `json:"release"`
Insecure bool `json:"insecure"`
TagFilter string `json:"tag_filter"`
OrderBy string `json:"order_by"`
SemverConstraint string `json:"semver_constraint"`
}
type CheckRequest struct {
Source Source `json:"source"`
Version Version `json:"version"`
}
func NewCheckRequest() CheckRequest {
res := CheckRequest{}
res.Source.Release = true
return res
}
func NewOutRequest() OutRequest {
res := OutRequest{}
res.Source.Release = true
return res
}
func NewInRequest() InRequest {
res := InRequest{}
res.Source.Release = true
return res
}
type InRequest struct {
Source Source `json:"source"`
Version *Version `json:"version"`
Params InParams `json:"params"`
}
type InParams struct {
Globs []string `json:"globs"`
IncludeSourceTarball bool `json:"include_source_tarball"`
IncludeSourceZip bool `json:"include_source_zip"`
}
type InResponse struct {
Version Version `json:"version"`
Metadata []MetadataPair `json:"metadata"`
}
type OutRequest struct {
Source Source `json:"source"`
Params OutParams `json:"params"`
}
type OutParams struct {
NamePath string `json:"name"`
BodyPath string `json:"body"`
TagPath string `json:"tag"`
CommitishPath string `json:"commitish"`
TagPrefix string `json:"tag_prefix"`
GenerateReleaseNotes bool `json:"generate_release_notes"`
Globs []string `json:"globs"`
}
type OutResponse struct {
Version Version `json:"version"`
Metadata []MetadataPair `json:"metadata"`
}
type Version struct {
Tag string `json:"tag,omitempty"`
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
}
type MetadataPair struct {
Name string `json:"name"`
Value string `json:"value"`
URL string `json:"url"`
Markdown bool `json:"markdown"`
}