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