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 IdentityConnection struct {
188	Edges      []*IdentityEdge   `json:"edges"`
189	Nodes      []IdentityWrapper `json:"nodes"`
190	PageInfo   *PageInfo         `json:"pageInfo"`
191	TotalCount int               `json:"totalCount"`
192}
193
194type IdentityEdge struct {
195	Cursor string          `json:"cursor"`
196	Node   IdentityWrapper `json:"node"`
197}
198
199type LabelConnection struct {
200	Edges      []*LabelEdge `json:"edges"`
201	Nodes      []bug.Label  `json:"nodes"`
202	PageInfo   *PageInfo    `json:"pageInfo"`
203	TotalCount int          `json:"totalCount"`
204}
205
206type LabelEdge struct {
207	Cursor string    `json:"cursor"`
208	Node   bug.Label `json:"node"`
209}
210
211type NewBugInput struct {
212	// A unique identifier for the client performing the mutation.
213	ClientMutationID *string `json:"clientMutationId"`
214	// The name of the repository. If not set, the default repository is used.
215	RepoRef *string `json:"repoRef"`
216	// The title of the new bug.
217	Title string `json:"title"`
218	// The first message of the new bug.
219	Message string `json:"message"`
220	// The collection of file's hash required for the first message.
221	Files []repository.Hash `json:"files"`
222}
223
224type NewBugPayload struct {
225	// A unique identifier for the client performing the mutation.
226	ClientMutationID *string `json:"clientMutationId"`
227	// The created bug.
228	Bug BugWrapper `json:"bug"`
229	// The resulting operation.
230	Operation *bug.CreateOperation `json:"operation"`
231}
232
233type OpenBugInput struct {
234	// A unique identifier for the client performing the mutation.
235	ClientMutationID *string `json:"clientMutationId"`
236	// The name of the repository. If not set, the default repository is used.
237	RepoRef *string `json:"repoRef"`
238	// The bug ID's prefix.
239	Prefix string `json:"prefix"`
240}
241
242type OpenBugPayload struct {
243	// A unique identifier for the client performing the mutation.
244	ClientMutationID *string `json:"clientMutationId"`
245	// The affected bug.
246	Bug BugWrapper `json:"bug"`
247	// The resulting operation.
248	Operation *bug.SetStatusOperation `json:"operation"`
249}
250
251// The connection type for an Operation
252type OperationConnection struct {
253	Edges      []*OperationEdge `json:"edges"`
254	Nodes      []dag.Operation  `json:"nodes"`
255	PageInfo   *PageInfo        `json:"pageInfo"`
256	TotalCount int              `json:"totalCount"`
257}
258
259// Represent an Operation
260type OperationEdge struct {
261	Cursor string        `json:"cursor"`
262	Node   dag.Operation `json:"node"`
263}
264
265// Information about pagination in a connection.
266type PageInfo struct {
267	// When paginating forwards, are there more items?
268	HasNextPage bool `json:"hasNextPage"`
269	// When paginating backwards, are there more items?
270	HasPreviousPage bool `json:"hasPreviousPage"`
271	// When paginating backwards, the cursor to continue.
272	StartCursor string `json:"startCursor"`
273	// When paginating forwards, the cursor to continue.
274	EndCursor string `json:"endCursor"`
275}
276
277type SetTitleInput struct {
278	// A unique identifier for the client performing the mutation.
279	ClientMutationID *string `json:"clientMutationId"`
280	// The name of the repository. If not set, the default repository is used.
281	RepoRef *string `json:"repoRef"`
282	// The bug ID's prefix.
283	Prefix string `json:"prefix"`
284	// The new title.
285	Title string `json:"title"`
286}
287
288type SetTitlePayload struct {
289	// A unique identifier for the client performing the mutation.
290	ClientMutationID *string `json:"clientMutationId"`
291	// The affected bug.
292	Bug BugWrapper `json:"bug"`
293	// The resulting operation
294	Operation *bug.SetTitleOperation `json:"operation"`
295}
296
297// The connection type for TimelineItem
298type TimelineItemConnection struct {
299	Edges      []*TimelineItemEdge `json:"edges"`
300	Nodes      []bug.TimelineItem  `json:"nodes"`
301	PageInfo   *PageInfo           `json:"pageInfo"`
302	TotalCount int                 `json:"totalCount"`
303}
304
305// Represent a TimelineItem
306type TimelineItemEdge struct {
307	Cursor string           `json:"cursor"`
308	Node   bug.TimelineItem `json:"node"`
309}
310
311type LabelChangeStatus string
312
313const (
314	LabelChangeStatusAdded         LabelChangeStatus = "ADDED"
315	LabelChangeStatusRemoved       LabelChangeStatus = "REMOVED"
316	LabelChangeStatusDuplicateInOp LabelChangeStatus = "DUPLICATE_IN_OP"
317	LabelChangeStatusAlreadyExist  LabelChangeStatus = "ALREADY_EXIST"
318	LabelChangeStatusDoesntExist   LabelChangeStatus = "DOESNT_EXIST"
319)
320
321var AllLabelChangeStatus = []LabelChangeStatus{
322	LabelChangeStatusAdded,
323	LabelChangeStatusRemoved,
324	LabelChangeStatusDuplicateInOp,
325	LabelChangeStatusAlreadyExist,
326	LabelChangeStatusDoesntExist,
327}
328
329func (e LabelChangeStatus) IsValid() bool {
330	switch e {
331	case LabelChangeStatusAdded, LabelChangeStatusRemoved, LabelChangeStatusDuplicateInOp, LabelChangeStatusAlreadyExist, LabelChangeStatusDoesntExist:
332		return true
333	}
334	return false
335}
336
337func (e LabelChangeStatus) String() string {
338	return string(e)
339}
340
341func (e *LabelChangeStatus) UnmarshalGQL(v interface{}) error {
342	str, ok := v.(string)
343	if !ok {
344		return fmt.Errorf("enums must be strings")
345	}
346
347	*e = LabelChangeStatus(str)
348	if !e.IsValid() {
349		return fmt.Errorf("%s is not a valid LabelChangeStatus", str)
350	}
351	return nil
352}
353
354func (e LabelChangeStatus) MarshalGQL(w io.Writer) {
355	fmt.Fprint(w, strconv.Quote(e.String()))
356}
357
358type Status string
359
360const (
361	StatusOpen   Status = "OPEN"
362	StatusClosed Status = "CLOSED"
363)
364
365var AllStatus = []Status{
366	StatusOpen,
367	StatusClosed,
368}
369
370func (e Status) IsValid() bool {
371	switch e {
372	case StatusOpen, StatusClosed:
373		return true
374	}
375	return false
376}
377
378func (e Status) String() string {
379	return string(e)
380}
381
382func (e *Status) UnmarshalGQL(v interface{}) error {
383	str, ok := v.(string)
384	if !ok {
385		return fmt.Errorf("enums must be strings")
386	}
387
388	*e = Status(str)
389	if !e.IsValid() {
390		return fmt.Errorf("%s is not a valid Status", str)
391	}
392	return nil
393}
394
395func (e Status) MarshalGQL(w io.Writer) {
396	fmt.Fprint(w, strconv.Quote(e.String()))
397}