1scalar Time
  2scalar Label
  3scalar Hash
  4
  5# Information about pagination in a connection.
  6type PageInfo {
  7  # When paginating forwards, are there more items?
  8  hasNextPage: Boolean!
  9  # When paginating backwards, are there more items?
 10  hasPreviousPage: Boolean!
 11  # When paginating backwards, the cursor to continue.
 12  startCursor: String!
 13  # When paginating forwards, the cursor to continue.
 14  endCursor: String!
 15}
 16
 17# Represents an person in a git object.
 18type Person {
 19  # The email of the person.
 20  email: String
 21
 22  # The name of the person.
 23  name: String
 24}
 25
 26type CommentConnection {
 27  edges: [CommentEdge!]!
 28  nodes: [Comment!]!
 29  pageInfo: PageInfo!
 30  totalCount: Int!
 31}
 32
 33type CommentEdge {
 34  cursor: String!
 35  node: Comment!
 36}
 37
 38# Represents a comment on a bug.
 39type Comment implements Authored {
 40  # The author of this comment.
 41  author: Person!
 42
 43  # The message of this comment.
 44  message: String!
 45
 46  # All media's hash referenced in this comment
 47  files: [Hash!]!
 48}
 49
 50enum Status {
 51  OPEN
 52  CLOSED
 53}
 54
 55# An object that has an author.
 56interface Authored {
 57  # The author of this object.
 58  author: Person!
 59}
 60
 61type OperationConnection {
 62  edges: [OperationEdge!]!
 63  nodes: [Operation!]!
 64  pageInfo: PageInfo!
 65  totalCount: Int!
 66}
 67
 68type OperationEdge {
 69  cursor: String!
 70  node: Operation!
 71}
 72
 73# An operation applied to a bug.
 74interface Operation {
 75  # The operations author.
 76  author: Person!
 77  # The datetime when this operation was issued.
 78  date: Time!
 79}
 80
 81type CreateOperation implements Operation, Authored {
 82  author: Person!
 83  date: Time!
 84
 85  title: String!
 86  message: String!
 87  files: [Hash!]!
 88}
 89
 90type SetTitleOperation implements Operation, Authored {
 91  author: Person!
 92  date: Time!
 93
 94  title: String!
 95  was: String!
 96}
 97
 98type AddCommentOperation implements Operation, Authored {
 99  author: Person!
100  date: Time!
101
102  message: String!
103  files: [Hash!]!
104}
105
106type SetStatusOperation implements Operation, Authored {
107  author: Person!
108  date: Time!
109
110  status: Status!
111}
112
113type LabelChangeOperation implements Operation, Authored {
114  author: Person!
115  date: Time!
116
117  added: [Label!]!
118  removed: [Label!]!
119}
120
121# The connection type for Bug.
122type BugConnection {
123  # A list of edges.
124  edges: [BugEdge!]!
125  nodes: [Bug!]!
126  # Information to aid in pagination.
127  pageInfo: PageInfo!
128  # Identifies the total count of items in the connection.
129  totalCount: Int!
130}
131
132# An edge in a connection.
133type BugEdge {
134  # A cursor for use in pagination.
135  cursor: String!
136  # The item at the end of the edge.
137  node: Bug!
138}
139
140type Bug {
141  id: String!
142  humanId: String!
143  status: Status!
144  title: String!
145  labels: [Label!]!
146  author: Person!
147  createdAt: Time!
148  lastEdit: Time!
149
150  comments(
151    # Returns the elements in the list that come after the specified cursor.
152    after: String
153    # Returns the elements in the list that come before the specified cursor.
154    before: String
155    # Returns the first _n_ elements from the list.
156    first: Int
157    # Returns the last _n_ elements from the list.
158    last: Int
159  ): CommentConnection!
160
161  operations(
162    # Returns the elements in the list that come after the specified cursor.
163    after: String
164    # Returns the elements in the list that come before the specified cursor.
165    before: String
166    # Returns the first _n_ elements from the list.
167    first: Int
168    # Returns the last _n_ elements from the list.
169    last: Int
170  ): OperationConnection!
171}
172
173type Repository {
174  allBugs(
175    # Returns the elements in the list that come after the specified cursor.
176    after: String
177    # Returns the elements in the list that come before the specified cursor.
178    before: String
179    # Returns the first _n_ elements from the list.
180    first: Int
181    # Returns the last _n_ elements from the list.
182    last: Int
183  ): BugConnection!
184  bug(prefix: String!): Bug
185}
186
187type Query {
188  defaultRepository: Repository
189  repository(id: String!): Repository
190}
191
192type Mutation {
193  newBug(repoRef: String, title: String!, message: String!, files: [Hash!]): Bug!
194
195  addComment(repoRef: String, prefix: String!, message: String!, files: [Hash!]): Bug!
196  changeLabels(repoRef: String, prefix: String!, added: [String!], removed: [String!]): Bug!
197  open(repoRef: String, prefix: String!): Bug!
198  close(repoRef: String, prefix: String!): Bug!
199  setTitle(repoRef: String, prefix: String!, title: String!): Bug!
200
201  commit(repoRef: String, prefix: String!): Bug!
202}