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