gen_models.go

  1// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
  2
  3package models
  4
  5import (
  6	"fmt"
  7	"io"
  8	"strconv"
  9
 10	"github.com/MichaelMure/git-bug/bug"
 11	"github.com/MichaelMure/git-bug/identity"
 12	"github.com/MichaelMure/git-bug/util/git"
 13)
 14
 15// An object that has an author.
 16type Authored interface {
 17	IsAuthored()
 18}
 19
 20type AddCommentInput struct {
 21	// A unique identifier for the client performing the mutation.
 22	ClientMutationID *string `json:"clientMutationId"`
 23	// "The name of the repository. If not set, the default repository is used.
 24	RepoRef *string `json:"repoRef"`
 25	// The bug ID's prefix.
 26	Prefix string `json:"prefix"`
 27	// The first message of the new bug.
 28	Message string `json:"message"`
 29	// The collection of file's hash required for the first message.
 30	Files []git.Hash `json:"files"`
 31}
 32
 33type AddCommentPayload struct {
 34	// A unique identifier for the client performing the mutation.
 35	ClientMutationID *string `json:"clientMutationId"`
 36	// The affected bug.
 37	Bug *bug.Snapshot `json:"bug"`
 38	// The resulting operation.
 39	Operation *bug.AddCommentOperation `json:"operation"`
 40}
 41
 42// The connection type for Bug.
 43type BugConnection struct {
 44	// A list of edges.
 45	Edges []*BugEdge      `json:"edges"`
 46	Nodes []*bug.Snapshot `json:"nodes"`
 47	// Information to aid in pagination.
 48	PageInfo *PageInfo `json:"pageInfo"`
 49	// Identifies the total count of items in the connection.
 50	TotalCount int `json:"totalCount"`
 51}
 52
 53// An edge in a connection.
 54type BugEdge struct {
 55	// A cursor for use in pagination.
 56	Cursor string `json:"cursor"`
 57	// The item at the end of the edge.
 58	Node *bug.Snapshot `json:"node"`
 59}
 60
 61type ChangeLabelInput struct {
 62	// A unique identifier for the client performing the mutation.
 63	ClientMutationID *string `json:"clientMutationId"`
 64	// "The name of the repository. If not set, the default repository is used.
 65	RepoRef *string `json:"repoRef"`
 66	// The bug ID's prefix.
 67	Prefix string `json:"prefix"`
 68	// The list of label to add.
 69	Added []string `json:"added"`
 70	// The list of label to remove.
 71	Removed []string `json:"Removed"`
 72}
 73
 74type ChangeLabelPayload struct {
 75	// A unique identifier for the client performing the mutation.
 76	ClientMutationID *string `json:"clientMutationId"`
 77	// The affected bug.
 78	Bug *bug.Snapshot `json:"bug"`
 79	// The resulting operation.
 80	Operation *bug.LabelChangeOperation `json:"operation"`
 81	// The effect each source label had.
 82	Results []*bug.LabelChangeResult `json:"results"`
 83}
 84
 85type CloseBugInput struct {
 86	// A unique identifier for the client performing the mutation.
 87	ClientMutationID *string `json:"clientMutationId"`
 88	// "The name of the repository. If not set, the default repository is used.
 89	RepoRef *string `json:"repoRef"`
 90	// The bug ID's prefix.
 91	Prefix string `json:"prefix"`
 92}
 93
 94type CloseBugPayload struct {
 95	// A unique identifier for the client performing the mutation.
 96	ClientMutationID *string `json:"clientMutationId"`
 97	// The affected bug.
 98	Bug *bug.Snapshot `json:"bug"`
 99	// The resulting operation.
100	Operation *bug.SetStatusOperation `json:"operation"`
101}
102
103type CommentConnection struct {
104	Edges      []*CommentEdge `json:"edges"`
105	Nodes      []*bug.Comment `json:"nodes"`
106	PageInfo   *PageInfo      `json:"pageInfo"`
107	TotalCount int            `json:"totalCount"`
108}
109
110type CommentEdge struct {
111	Cursor string       `json:"cursor"`
112	Node   *bug.Comment `json:"node"`
113}
114
115type CommitAsNeededInput struct {
116	// A unique identifier for the client performing the mutation.
117	ClientMutationID *string `json:"clientMutationId"`
118	// "The name of the repository. If not set, the default repository is used.
119	RepoRef *string `json:"repoRef"`
120	// The bug ID's prefix.
121	Prefix string `json:"prefix"`
122}
123
124type CommitAsNeededPayload struct {
125	// A unique identifier for the client performing the mutation.
126	ClientMutationID *string `json:"clientMutationId"`
127	// The affected bug.
128	Bug *bug.Snapshot `json:"bug"`
129}
130
131type CommitInput struct {
132	// A unique identifier for the client performing the mutation.
133	ClientMutationID *string `json:"clientMutationId"`
134	// "The name of the repository. If not set, the default repository is used.
135	RepoRef *string `json:"repoRef"`
136	// The bug ID's prefix.
137	Prefix string `json:"prefix"`
138}
139
140type CommitPayload struct {
141	// A unique identifier for the client performing the mutation.
142	ClientMutationID *string `json:"clientMutationId"`
143	// The affected bug.
144	Bug *bug.Snapshot `json:"bug"`
145}
146
147type IdentityConnection struct {
148	Edges      []*IdentityEdge      `json:"edges"`
149	Nodes      []identity.Interface `json:"nodes"`
150	PageInfo   *PageInfo            `json:"pageInfo"`
151	TotalCount int                  `json:"totalCount"`
152}
153
154type IdentityEdge struct {
155	Cursor string             `json:"cursor"`
156	Node   identity.Interface `json:"node"`
157}
158
159type LabelConnection struct {
160	Edges      []*LabelEdge `json:"edges"`
161	Nodes      []bug.Label  `json:"nodes"`
162	PageInfo   *PageInfo    `json:"pageInfo"`
163	TotalCount int          `json:"totalCount"`
164}
165
166type LabelEdge struct {
167	Cursor string    `json:"cursor"`
168	Node   bug.Label `json:"node"`
169}
170
171type NewBugInput struct {
172	// A unique identifier for the client performing the mutation.
173	ClientMutationID *string `json:"clientMutationId"`
174	// "The name of the repository. If not set, the default repository is used.
175	RepoRef *string `json:"repoRef"`
176	// The title of the new bug.
177	Title string `json:"title"`
178	// The first message of the new bug.
179	Message string `json:"message"`
180	// The collection of file's hash required for the first message.
181	Files []git.Hash `json:"files"`
182}
183
184type NewBugPayload struct {
185	// A unique identifier for the client performing the mutation.
186	ClientMutationID *string `json:"clientMutationId"`
187	// The created bug.
188	Bug *bug.Snapshot `json:"bug"`
189	// The resulting operation.
190	Operation *bug.CreateOperation `json:"operation"`
191}
192
193type OpenBugInput struct {
194	// A unique identifier for the client performing the mutation.
195	ClientMutationID *string `json:"clientMutationId"`
196	// "The name of the repository. If not set, the default repository is used.
197	RepoRef *string `json:"repoRef"`
198	// The bug ID's prefix.
199	Prefix string `json:"prefix"`
200}
201
202type OpenBugPayload struct {
203	// A unique identifier for the client performing the mutation.
204	ClientMutationID *string `json:"clientMutationId"`
205	// The affected bug.
206	Bug *bug.Snapshot `json:"bug"`
207	// The resulting operation.
208	Operation *bug.SetStatusOperation `json:"operation"`
209}
210
211// The connection type for an Operation
212type OperationConnection struct {
213	Edges      []*OperationEdge `json:"edges"`
214	Nodes      []bug.Operation  `json:"nodes"`
215	PageInfo   *PageInfo        `json:"pageInfo"`
216	TotalCount int              `json:"totalCount"`
217}
218
219// Represent an Operation
220type OperationEdge struct {
221	Cursor string        `json:"cursor"`
222	Node   bug.Operation `json:"node"`
223}
224
225// Information about pagination in a connection.
226type PageInfo struct {
227	// When paginating forwards, are there more items?
228	HasNextPage bool `json:"hasNextPage"`
229	// When paginating backwards, are there more items?
230	HasPreviousPage bool `json:"hasPreviousPage"`
231	// When paginating backwards, the cursor to continue.
232	StartCursor string `json:"startCursor"`
233	// When paginating forwards, the cursor to continue.
234	EndCursor string `json:"endCursor"`
235}
236
237type SetTitleInput struct {
238	// A unique identifier for the client performing the mutation.
239	ClientMutationID *string `json:"clientMutationId"`
240	// "The name of the repository. If not set, the default repository is used.
241	RepoRef *string `json:"repoRef"`
242	// The bug ID's prefix.
243	Prefix string `json:"prefix"`
244	// The new title.
245	Title string `json:"title"`
246}
247
248type SetTitlePayload struct {
249	// A unique identifier for the client performing the mutation.
250	ClientMutationID *string `json:"clientMutationId"`
251	// The affected bug.
252	Bug *bug.Snapshot `json:"bug"`
253	// The resulting operation
254	Operation *bug.SetTitleOperation `json:"operation"`
255}
256
257// The connection type for TimelineItem
258type TimelineItemConnection struct {
259	Edges      []*TimelineItemEdge `json:"edges"`
260	Nodes      []bug.TimelineItem  `json:"nodes"`
261	PageInfo   *PageInfo           `json:"pageInfo"`
262	TotalCount int                 `json:"totalCount"`
263}
264
265// Represent a TimelineItem
266type TimelineItemEdge struct {
267	Cursor string           `json:"cursor"`
268	Node   bug.TimelineItem `json:"node"`
269}
270
271type LabelChangeStatus string
272
273const (
274	LabelChangeStatusAdded         LabelChangeStatus = "ADDED"
275	LabelChangeStatusRemoved       LabelChangeStatus = "REMOVED"
276	LabelChangeStatusDuplicateInOp LabelChangeStatus = "DUPLICATE_IN_OP"
277	LabelChangeStatusAlreadyExist  LabelChangeStatus = "ALREADY_EXIST"
278	LabelChangeStatusDoesntExist   LabelChangeStatus = "DOESNT_EXIST"
279)
280
281var AllLabelChangeStatus = []LabelChangeStatus{
282	LabelChangeStatusAdded,
283	LabelChangeStatusRemoved,
284	LabelChangeStatusDuplicateInOp,
285	LabelChangeStatusAlreadyExist,
286	LabelChangeStatusDoesntExist,
287}
288
289func (e LabelChangeStatus) IsValid() bool {
290	switch e {
291	case LabelChangeStatusAdded, LabelChangeStatusRemoved, LabelChangeStatusDuplicateInOp, LabelChangeStatusAlreadyExist, LabelChangeStatusDoesntExist:
292		return true
293	}
294	return false
295}
296
297func (e LabelChangeStatus) String() string {
298	return string(e)
299}
300
301func (e *LabelChangeStatus) UnmarshalGQL(v interface{}) error {
302	str, ok := v.(string)
303	if !ok {
304		return fmt.Errorf("enums must be strings")
305	}
306
307	*e = LabelChangeStatus(str)
308	if !e.IsValid() {
309		return fmt.Errorf("%s is not a valid LabelChangeStatus", str)
310	}
311	return nil
312}
313
314func (e LabelChangeStatus) MarshalGQL(w io.Writer) {
315	fmt.Fprint(w, strconv.Quote(e.String()))
316}
317
318type Status string
319
320const (
321	StatusOpen   Status = "OPEN"
322	StatusClosed Status = "CLOSED"
323)
324
325var AllStatus = []Status{
326	StatusOpen,
327	StatusClosed,
328}
329
330func (e Status) IsValid() bool {
331	switch e {
332	case StatusOpen, StatusClosed:
333		return true
334	}
335	return false
336}
337
338func (e Status) String() string {
339	return string(e)
340}
341
342func (e *Status) UnmarshalGQL(v interface{}) error {
343	str, ok := v.(string)
344	if !ok {
345		return fmt.Errorf("enums must be strings")
346	}
347
348	*e = Status(str)
349	if !e.IsValid() {
350		return fmt.Errorf("%s is not a valid Status", str)
351	}
352	return nil
353}
354
355func (e Status) MarshalGQL(w io.Writer) {
356	fmt.Fprint(w, strconv.Quote(e.String()))
357}