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/util/git"
 12)
 13
 14// An object that has an author.
 15type Authored interface {
 16	IsAuthored()
 17}
 18
 19type AddCommentInput 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 first message of the new bug.
 27	Message string `json:"message"`
 28	// The collection of file's hash required for the first message.
 29	Files []git.Hash `json:"files"`
 30}
 31
 32type AddCommentPayload 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 operation.
 38	Operation *bug.AddCommentOperation `json:"operation"`
 39}
 40
 41// The connection type for Bug.
 42type BugConnection struct {
 43	// A list of edges.
 44	Edges []*BugEdge   `json:"edges"`
 45	Nodes []BugWrapper `json:"nodes"`
 46	// Information to aid in pagination.
 47	PageInfo *PageInfo `json:"pageInfo"`
 48	// Identifies the total count of items in the connection.
 49	TotalCount int `json:"totalCount"`
 50}
 51
 52// An edge in a connection.
 53type BugEdge struct {
 54	// A cursor for use in pagination.
 55	Cursor string `json:"cursor"`
 56	// The item at the end of the edge.
 57	Node BugWrapper `json:"node"`
 58}
 59
 60type ChangeLabelInput struct {
 61	// A unique identifier for the client performing the mutation.
 62	ClientMutationID *string `json:"clientMutationId"`
 63	// "The name of the repository. If not set, the default repository is used.
 64	RepoRef *string `json:"repoRef"`
 65	// The bug ID's prefix.
 66	Prefix string `json:"prefix"`
 67	// The list of label to add.
 68	Added []string `json:"added"`
 69	// The list of label to remove.
 70	Removed []string `json:"Removed"`
 71}
 72
 73type ChangeLabelPayload struct {
 74	// A unique identifier for the client performing the mutation.
 75	ClientMutationID *string `json:"clientMutationId"`
 76	// The affected bug.
 77	Bug BugWrapper `json:"bug"`
 78	// The resulting operation.
 79	Operation *bug.LabelChangeOperation `json:"operation"`
 80	// The effect each source label had.
 81	Results []*bug.LabelChangeResult `json:"results"`
 82}
 83
 84type CloseBugInput 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}
 92
 93type CloseBugPayload struct {
 94	// A unique identifier for the client performing the mutation.
 95	ClientMutationID *string `json:"clientMutationId"`
 96	// The affected bug.
 97	Bug BugWrapper `json:"bug"`
 98	// The resulting operation.
 99	Operation *bug.SetStatusOperation `json:"operation"`
100}
101
102type CommentConnection struct {
103	Edges      []*CommentEdge `json:"edges"`
104	Nodes      []*bug.Comment `json:"nodes"`
105	PageInfo   *PageInfo      `json:"pageInfo"`
106	TotalCount int            `json:"totalCount"`
107}
108
109type CommentEdge struct {
110	Cursor string       `json:"cursor"`
111	Node   *bug.Comment `json:"node"`
112}
113
114type CommitInput struct {
115	// A unique identifier for the client performing the mutation.
116	ClientMutationID *string `json:"clientMutationId"`
117	// The identifier of the transaction
118	ID string `json:"id"`
119}
120
121type CommitPayload struct {
122	// A unique identifier for the client performing the mutation.
123	ClientMutationID *string `json:"clientMutationId"`
124	// The identifier of the transaction
125	ID string `json:"id"`
126	// The affected bug.
127	Bug BugWrapper `json:"bug"`
128}
129
130type IdentityConnection struct {
131	Edges      []*IdentityEdge   `json:"edges"`
132	Nodes      []IdentityWrapper `json:"nodes"`
133	PageInfo   *PageInfo         `json:"pageInfo"`
134	TotalCount int               `json:"totalCount"`
135}
136
137type IdentityEdge struct {
138	Cursor string          `json:"cursor"`
139	Node   IdentityWrapper `json:"node"`
140}
141
142type LabelConnection struct {
143	Edges      []*LabelEdge `json:"edges"`
144	Nodes      []bug.Label  `json:"nodes"`
145	PageInfo   *PageInfo    `json:"pageInfo"`
146	TotalCount int          `json:"totalCount"`
147}
148
149type LabelEdge struct {
150	Cursor string    `json:"cursor"`
151	Node   bug.Label `json:"node"`
152}
153
154type NewBugInput struct {
155	// A unique identifier for the client performing the mutation.
156	ClientMutationID *string `json:"clientMutationId"`
157	// "The name of the repository. If not set, the default repository is used.
158	RepoRef *string `json:"repoRef"`
159	// The title of the new bug.
160	Title string `json:"title"`
161	// The first message of the new bug.
162	Message string `json:"message"`
163	// The collection of file's hash required for the first message.
164	Files []git.Hash `json:"files"`
165}
166
167type NewBugPayload struct {
168	// A unique identifier for the client performing the mutation.
169	ClientMutationID *string `json:"clientMutationId"`
170	// The created bug.
171	Bug BugWrapper `json:"bug"`
172	// The resulting operation.
173	Operation *bug.CreateOperation `json:"operation"`
174}
175
176type OpenBugInput struct {
177	// A unique identifier for the client performing the mutation.
178	ClientMutationID *string `json:"clientMutationId"`
179	// "The name of the repository. If not set, the default repository is used.
180	RepoRef *string `json:"repoRef"`
181	// The bug ID's prefix.
182	Prefix string `json:"prefix"`
183}
184
185type OpenBugPayload struct {
186	// A unique identifier for the client performing the mutation.
187	ClientMutationID *string `json:"clientMutationId"`
188	// The affected bug.
189	Bug BugWrapper `json:"bug"`
190	// The resulting operation.
191	Operation *bug.SetStatusOperation `json:"operation"`
192}
193
194// The connection type for an Operation
195type OperationConnection struct {
196	Edges      []*OperationEdge `json:"edges"`
197	Nodes      []bug.Operation  `json:"nodes"`
198	PageInfo   *PageInfo        `json:"pageInfo"`
199	TotalCount int              `json:"totalCount"`
200}
201
202// Represent an Operation
203type OperationEdge struct {
204	Cursor string        `json:"cursor"`
205	Node   bug.Operation `json:"node"`
206}
207
208// Information about pagination in a connection.
209type PageInfo struct {
210	// When paginating forwards, are there more items?
211	HasNextPage bool `json:"hasNextPage"`
212	// When paginating backwards, are there more items?
213	HasPreviousPage bool `json:"hasPreviousPage"`
214	// When paginating backwards, the cursor to continue.
215	StartCursor string `json:"startCursor"`
216	// When paginating forwards, the cursor to continue.
217	EndCursor string `json:"endCursor"`
218}
219
220type RollbackInput struct {
221	// A unique identifier for the client performing the mutation.
222	ClientMutationID *string `json:"clientMutationId"`
223	// The identifier of the transaction
224	ID string `json:"id"`
225}
226
227type RollbackPayload struct {
228	// A unique identifier for the client performing the mutation.
229	ClientMutationID *string `json:"clientMutationId"`
230	// The identifier of the transaction
231	ID string `json:"id"`
232	// The affected bug.
233	Bug BugWrapper `json:"bug"`
234}
235
236type SetTitleInput struct {
237	// A unique identifier for the client performing the mutation.
238	ClientMutationID *string `json:"clientMutationId"`
239	// "The name of the repository. If not set, the default repository is used.
240	RepoRef *string `json:"repoRef"`
241	// The bug ID's prefix.
242	Prefix string `json:"prefix"`
243	// The new title.
244	Title string `json:"title"`
245}
246
247type SetTitlePayload struct {
248	// A unique identifier for the client performing the mutation.
249	ClientMutationID *string `json:"clientMutationId"`
250	// The affected bug.
251	Bug BugWrapper `json:"bug"`
252	// The resulting operation
253	Operation *bug.SetTitleOperation `json:"operation"`
254}
255
256type StartTransactionInput struct {
257	// A unique identifier for the client performing the mutation.
258	ClientMutationID *string `json:"clientMutationId"`
259	// "The name of the repository. If not set, the default repository is used.
260	RepoRef *string `json:"repoRef"`
261	// The bug ID's prefix.
262	Prefix string `json:"prefix"`
263}
264
265type StartTransactionPayload struct {
266	// A unique identifier for the client performing the mutation.
267	ClientMutationID *string `json:"clientMutationId"`
268	// The identifier of the transaction
269	ID string `json:"id"`
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}