git-bug/graphql/models/gen_models.go

142 lines
3.3 KiB
Go
Raw Normal View History

2018-09-14 13:40:31 +03:00
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
2018-07-27 20:48:45 +03:00
package models
2018-07-27 20:48:45 +03:00
import (
2018-12-23 19:11:37 +03:00
"fmt"
"io"
"strconv"
2018-07-27 20:48:45 +03:00
2018-12-23 19:11:37 +03:00
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/identity"
2018-07-27 20:48:45 +03:00
)
2018-09-14 13:40:31 +03:00
// An object that has an author.
2018-12-23 19:11:37 +03:00
type Authored interface {
IsAuthored()
}
2018-09-14 13:40:31 +03:00
// The connection type for Bug.
2018-07-27 20:48:45 +03:00
type BugConnection struct {
2019-04-09 18:43:17 +03:00
// A list of edges.
Edges []*BugEdge `json:"edges"`
Nodes []*bug.Snapshot `json:"nodes"`
2019-04-09 18:43:17 +03:00
// Information to aid in pagination.
PageInfo *PageInfo `json:"pageInfo"`
2019-04-09 18:43:17 +03:00
// Identifies the total count of items in the connection.
TotalCount int `json:"totalCount"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
// An edge in a connection.
2018-07-27 20:48:45 +03:00
type BugEdge struct {
2019-04-09 18:43:17 +03:00
// A cursor for use in pagination.
Cursor string `json:"cursor"`
// The item at the end of the edge.
Node *bug.Snapshot `json:"node"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
2018-07-27 20:48:45 +03:00
type CommentConnection struct {
Edges []*CommentEdge `json:"edges"`
Nodes []*bug.Comment `json:"nodes"`
PageInfo *PageInfo `json:"pageInfo"`
TotalCount int `json:"totalCount"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
2018-07-27 20:48:45 +03:00
type CommentEdge struct {
Cursor string `json:"cursor"`
Node *bug.Comment `json:"node"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
type IdentityConnection struct {
Edges []*IdentityEdge `json:"edges"`
Nodes []identity.Interface `json:"nodes"`
PageInfo *PageInfo `json:"pageInfo"`
TotalCount int `json:"totalCount"`
}
type IdentityEdge struct {
Cursor string `json:"cursor"`
Node identity.Interface `json:"node"`
}
// The connection type for an Operation
2018-07-27 20:48:45 +03:00
type OperationConnection struct {
Edges []*OperationEdge `json:"edges"`
Nodes []bug.Operation `json:"nodes"`
PageInfo *PageInfo `json:"pageInfo"`
TotalCount int `json:"totalCount"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
// Represent an Operation
2018-07-27 20:48:45 +03:00
type OperationEdge struct {
Cursor string `json:"cursor"`
Node bug.Operation `json:"node"`
2018-07-27 20:48:45 +03:00
}
2018-09-14 13:40:31 +03:00
// Information about pagination in a connection.
2018-07-27 20:48:45 +03:00
type PageInfo struct {
2019-04-09 18:43:17 +03:00
// When paginating forwards, are there more items?
HasNextPage bool `json:"hasNextPage"`
// When paginating backwards, are there more items?
HasPreviousPage bool `json:"hasPreviousPage"`
// When paginating backwards, the cursor to continue.
StartCursor string `json:"startCursor"`
// When paginating forwards, the cursor to continue.
EndCursor string `json:"endCursor"`
2018-07-27 20:48:45 +03:00
}
// The connection type for TimelineItem
2018-09-29 21:58:25 +03:00
type TimelineItemConnection struct {
Edges []*TimelineItemEdge `json:"edges"`
Nodes []bug.TimelineItem `json:"nodes"`
PageInfo *PageInfo `json:"pageInfo"`
TotalCount int `json:"totalCount"`
2018-09-29 21:58:25 +03:00
}
// Represent a TimelineItem
2018-09-29 21:58:25 +03:00
type TimelineItemEdge struct {
Cursor string `json:"cursor"`
Node bug.TimelineItem `json:"node"`
}
2018-07-27 20:48:45 +03:00
type Status string
const (
StatusOpen Status = "OPEN"
StatusClosed Status = "CLOSED"
)
2019-04-09 18:43:17 +03:00
var AllStatus = []Status{
StatusOpen,
StatusClosed,
}
2018-07-27 20:48:45 +03:00
func (e Status) IsValid() bool {
switch e {
case StatusOpen, StatusClosed:
return true
}
return false
}
func (e Status) String() string {
return string(e)
}
func (e *Status) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Status(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Status", str)
}
return nil
}
func (e Status) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}