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