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