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