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