coverage~bigbes/sr-ht-spec64cae3afgraph/model/models_gen.go

Coverage
0.0% 0/36 statements
Δ
+0.0
Blob
13c4390
1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
2
3 package model
4
5 import (
6 "fmt"
7 "io"
8 "strconv"
9 "time"
10
11 "sourcecraft.dev/bigbes/sr-ht-core/model"
12 )
13
14 // The payload delivered to a webhook: the event being dispatched, over which the
15 // subscription's `query` is evaluated.
16 type WebhookPayload interface {
17 IsWebhookPayload()
18 }
19
20 // A webhook subscription: a URL and a GraphQL query evaluated in the webhook
21 // context when one of `events` fires.
22 type WebhookSubscription interface {
23 IsWebhookSubscription()
24 }
25
26 type ProposalEvent struct {
27 UUID string `json:"uuid"`
28 Event WebhookEvent `json:"event"`
29 Date time.Time `json:"date"`
30 Proposal *Proposal `json:"proposal"`
31 }
32
33 func (ProposalEvent) IsWebhookPayload() {}
34
35 type UserWebhookInput struct {
36 URL string `json:"url"`
37 Events []WebhookEvent `json:"events"`
38 Query string `json:"query"`
39 }
40
41 // A cursor for enumerating a list of webhook deliveries.
42 //
43 // If there are additional results available, the cursor object may be passed
44 // back into the same endpoint to retrieve another page. If the cursor is null,
45 // there are no remaining results to return.
46 type WebhookDeliveryCursor struct {
47 Results []*WebhookDelivery `json:"results"`
48 Cursor *model.Cursor `json:"cursor,omitempty"`
49 }
50
51 // A cursor for enumerating a list of webhook subscriptions.
52 //
53 // If there are additional results available, the cursor object may be passed
54 // back into the same endpoint to retrieve another page. If the cursor is null,
55 // there are no remaining results to return.
56 type WebhookSubscriptionCursor struct {
57 Results []WebhookSubscription `json:"results"`
58 Cursor *model.Cursor `json:"cursor,omitempty"`
59 }
60
61 // How a merge was authorized. Auto-merged is not human-approved, and readers must
62 // be able to tell: a bot asking for the approved text of a spec should be able to
63 // require human approval and get a different answer than for a firehose note.
64 type Approval string
65
66 const (
67 ApprovalHuman Approval = "HUMAN"
68 ApprovalPolicy Approval = "POLICY"
69 )
70
71 var AllApproval = []Approval{
72 ApprovalHuman,
73 ApprovalPolicy,
74 }
75
76 0 func (e Approval) IsValid() bool {
77 0 switch e {
78 0 case ApprovalHuman, ApprovalPolicy:
79 0 return true
80 }
81 0 return false
82 }
83
84 0 func (e Approval) String() string {
85 0 return string(e)
86 0 }
87
88 0 func (e *Approval) UnmarshalGQL(v interface{}) error {
89 0 str, ok := v.(string)
90 0 if !ok {
91 0 return fmt.Errorf("enums must be strings")
92 0 }
93
94 0 *e = Approval(str)
95 0 if !e.IsValid() {
96 0 return fmt.Errorf("%s is not a valid Approval", str)
97 0 }
98 0 return nil
99 }
100
101 0 func (e Approval) MarshalGQL(w io.Writer) {
102 0 fmt.Fprint(w, strconv.Quote(e.String()))
103 0 }
104
105 // The lifecycle of a proposal. Collapsed from the usual five states because there
106 // is exactly one reviewer: "approve" is "merge now", and a proposal you dislike is
107 // rejected rather than sent back for changes.
108 type ProposalState string
109
110 const (
111 ProposalStateOpen ProposalState = "OPEN"
112 ProposalStateMerged ProposalState = "MERGED"
113 ProposalStateRejected ProposalState = "REJECTED"
114 )
115
116 var AllProposalState = []ProposalState{
117 ProposalStateOpen,
118 ProposalStateMerged,
119 ProposalStateRejected,
120 }
121
122 0 func (e ProposalState) IsValid() bool {
123 0 switch e {
124 0 case ProposalStateOpen, ProposalStateMerged, ProposalStateRejected:
125 0 return true
126 }
127 0 return false
128 }
129
130 0 func (e ProposalState) String() string {
131 0 return string(e)
132 0 }
133
134 0 func (e *ProposalState) UnmarshalGQL(v interface{}) error {
135 0 str, ok := v.(string)
136 0 if !ok {
137 0 return fmt.Errorf("enums must be strings")
138 0 }
139
140 0 *e = ProposalState(str)
141 0 if !e.IsValid() {
142 0 return fmt.Errorf("%s is not a valid ProposalState", str)
143 0 }
144 0 return nil
145 }
146
147 0 func (e ProposalState) MarshalGQL(w io.Writer) {
148 0 fmt.Fprint(w, strconv.Quote(e.String()))
149 0 }
150
151 // A proposal lifecycle event a webhook may subscribe to.
152 type WebhookEvent string
153
154 const (
155 WebhookEventProposalOpened WebhookEvent = "PROPOSAL_OPENED"
156 WebhookEventProposalMerged WebhookEvent = "PROPOSAL_MERGED"
157 WebhookEventProposalRejected WebhookEvent = "PROPOSAL_REJECTED"
158 )
159
160 var AllWebhookEvent = []WebhookEvent{
161 WebhookEventProposalOpened,
162 WebhookEventProposalMerged,
163 WebhookEventProposalRejected,
164 }
165
166 0 func (e WebhookEvent) IsValid() bool {
167 0 switch e {
168 0 case WebhookEventProposalOpened, WebhookEventProposalMerged, WebhookEventProposalRejected:
169 0 return true
170 }
171 0 return false
172 }
173
174 0 func (e WebhookEvent) String() string {
175 0 return string(e)
176 0 }
177
178 0 func (e *WebhookEvent) UnmarshalGQL(v interface{}) error {
179 0 str, ok := v.(string)
180 0 if !ok {
181 0 return fmt.Errorf("enums must be strings")
182 0 }
183
184 0 *e = WebhookEvent(str)
185 0 if !e.IsValid() {
186 0 return fmt.Errorf("%s is not a valid WebhookEvent", str)
187 0 }
188 0 return nil
189 }
190
191 0 func (e WebhookEvent) MarshalGQL(w io.Writer) {
192 0 fmt.Fprint(w, strconv.Quote(e.String()))
193 0 }