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 CommitAsNeededInput struct {
115	// A unique identifier for the client performing the mutation.
116	ClientMutationID *string `json:"clientMutationId"`
117	// "The name of the repository. If not set, the default repository is used.
118	RepoRef *string `json:"repoRef"`
119	// The bug ID's prefix.
120	Prefix string `json:"prefix"`
121}
122
123type CommitAsNeededPayload struct {
124	// A unique identifier for the client performing the mutation.
125	ClientMutationID *string `json:"clientMutationId"`
126	// The affected bug.
127	Bug BugWrapper `json:"bug"`
128}
129
130type CommitInput struct {
131	// A unique identifier for the client performing the mutation.
132	ClientMutationID *string `json:"clientMutationId"`
133	// "The name of the repository. If not set, the default repository is used.
134	RepoRef *string `json:"repoRef"`
135	// The bug ID's prefix.
136	Prefix string `json:"prefix"`
137}
138
139type CommitPayload struct {
140	// A unique identifier for the client performing the mutation.
141	ClientMutationID *string `json:"clientMutationId"`
142	// The affected bug.
143	Bug BugWrapper `json:"bug"`
144}
145
146type IdentityConnection struct {
147	Edges      []*IdentityEdge   `json:"edges"`
148	Nodes      []IdentityWrapper `json:"nodes"`
149	PageInfo   *PageInfo         `json:"pageInfo"`
150	TotalCount int               `json:"totalCount"`
151}
152
153type IdentityEdge struct {
154	Cursor string          `json:"cursor"`
155	Node   IdentityWrapper `json:"node"`
156}
157
158type LabelConnection struct {
159	Edges      []*LabelEdge `json:"edges"`
160	Nodes      []bug.Label  `json:"nodes"`
161	PageInfo   *PageInfo    `json:"pageInfo"`
162	TotalCount int          `json:"totalCount"`
163}
164
165type LabelEdge struct {
166	Cursor string    `json:"cursor"`
167	Node   bug.Label `json:"node"`
168}
169
170type NewBugInput struct {
171	// A unique identifier for the client performing the mutation.
172	ClientMutationID *string `json:"clientMutationId"`
173	// "The name of the repository. If not set, the default repository is used.
174	RepoRef *string `json:"repoRef"`
175	// The title of the new bug.
176	Title string `json:"title"`
177	// The first message of the new bug.
178	Message string `json:"message"`
179	// The collection of file's hash required for the first message.
180	Files []git.Hash `json:"files"`
181}
182
183type NewBugPayload struct {
184	// A unique identifier for the client performing the mutation.
185	ClientMutationID *string `json:"clientMutationId"`
186	// The created bug.
187	Bug BugWrapper `json:"bug"`
188	// The resulting operation.
189	Operation *bug.CreateOperation `json:"operation"`
190}
191
192type OpenBugInput struct {
193	// A unique identifier for the client performing the mutation.
194	ClientMutationID *string `json:"clientMutationId"`
195	// "The name of the repository. If not set, the default repository is used.
196	RepoRef *string `json:"repoRef"`
197	// The bug ID's prefix.
198	Prefix string `json:"prefix"`
199}
200
201type OpenBugPayload struct {
202	// A unique identifier for the client performing the mutation.
203	ClientMutationID *string `json:"clientMutationId"`
204	// The affected bug.
205	Bug BugWrapper `json:"bug"`
206	// The resulting operation.
207	Operation *bug.SetStatusOperation `json:"operation"`
208}
209
210// The connection type for an Operation
211type OperationConnection struct {
212	Edges      []*OperationEdge `json:"edges"`
213	Nodes      []bug.Operation  `json:"nodes"`
214	PageInfo   *PageInfo        `json:"pageInfo"`
215	TotalCount int              `json:"totalCount"`
216}
217
218// Represent an Operation
219type OperationEdge struct {
220	Cursor string        `json:"cursor"`
221	Node   bug.Operation `json:"node"`
222}
223
224// Information about pagination in a connection.
225type PageInfo struct {
226	// When paginating forwards, are there more items?
227	HasNextPage bool `json:"hasNextPage"`
228	// When paginating backwards, are there more items?
229	HasPreviousPage bool `json:"hasPreviousPage"`
230	// When paginating backwards, the cursor to continue.
231	StartCursor string `json:"startCursor"`
232	// When paginating forwards, the cursor to continue.
233	EndCursor string `json:"endCursor"`
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
256// The connection type for TimelineItem
257type TimelineItemConnection struct {
258	Edges      []*TimelineItemEdge `json:"edges"`
259	Nodes      []bug.TimelineItem  `json:"nodes"`
260	PageInfo   *PageInfo           `json:"pageInfo"`
261	TotalCount int                 `json:"totalCount"`
262}
263
264// Represent a TimelineItem
265type TimelineItemEdge struct {
266	Cursor string           `json:"cursor"`
267	Node   bug.TimelineItem `json:"node"`
268}
269
270type LabelChangeStatus string
271
272const (
273	LabelChangeStatusAdded         LabelChangeStatus = "ADDED"
274	LabelChangeStatusRemoved       LabelChangeStatus = "REMOVED"
275	LabelChangeStatusDuplicateInOp LabelChangeStatus = "DUPLICATE_IN_OP"
276	LabelChangeStatusAlreadyExist  LabelChangeStatus = "ALREADY_EXIST"
277	LabelChangeStatusDoesntExist   LabelChangeStatus = "DOESNT_EXIST"
278)
279
280var AllLabelChangeStatus = []LabelChangeStatus{
281	LabelChangeStatusAdded,
282	LabelChangeStatusRemoved,
283	LabelChangeStatusDuplicateInOp,
284	LabelChangeStatusAlreadyExist,
285	LabelChangeStatusDoesntExist,
286}
287
288func (e LabelChangeStatus) IsValid() bool {
289	switch e {
290	case LabelChangeStatusAdded, LabelChangeStatusRemoved, LabelChangeStatusDuplicateInOp, LabelChangeStatusAlreadyExist, LabelChangeStatusDoesntExist:
291		return true
292	}
293	return false
294}
295
296func (e LabelChangeStatus) String() string {
297	return string(e)
298}
299
300func (e *LabelChangeStatus) UnmarshalGQL(v interface{}) error {
301	str, ok := v.(string)
302	if !ok {
303		return fmt.Errorf("enums must be strings")
304	}
305
306	*e = LabelChangeStatus(str)
307	if !e.IsValid() {
308		return fmt.Errorf("%s is not a valid LabelChangeStatus", str)
309	}
310	return nil
311}
312
313func (e LabelChangeStatus) MarshalGQL(w io.Writer) {
314	fmt.Fprint(w, strconv.Quote(e.String()))
315}
316
317type Status string
318
319const (
320	StatusOpen   Status = "OPEN"
321	StatusClosed Status = "CLOSED"
322)
323
324var AllStatus = []Status{
325	StatusOpen,
326	StatusClosed,
327}
328
329func (e Status) IsValid() bool {
330	switch e {
331	case StatusOpen, StatusClosed:
332		return true
333	}
334	return false
335}
336
337func (e Status) String() string {
338	return string(e)
339}
340
341func (e *Status) UnmarshalGQL(v interface{}) error {
342	str, ok := v.(string)
343	if !ok {
344		return fmt.Errorf("enums must be strings")
345	}
346
347	*e = Status(str)
348	if !e.IsValid() {
349		return fmt.Errorf("%s is not a valid Status", str)
350	}
351	return nil
352}
353
354func (e Status) MarshalGQL(w io.Writer) {
355	fmt.Fprint(w, strconv.Quote(e.String()))
356}