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