aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/schema
diff options
context:
space:
mode:
authorMichael Muré <michael.mure@consensys.net>2018-11-21 18:56:12 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:35:36 +0100
commitfeab9412dffe5772048aad29893c4cb01d566387 (patch)
treeb7bc9751f2ebdf8d41f5621bbf372eaf7625c4b9 /graphql/schema
parent0aefae6fcca5786f2c898029c3d6282f760f2c63 (diff)
downloadgit-bug-feab9412dffe5772048aad29893c4cb01d566387.tar.gz
WIP identity in git
Diffstat (limited to 'graphql/schema')
-rw-r--r--graphql/schema/bug.graphql108
-rw-r--r--graphql/schema/identity.graphql13
-rw-r--r--graphql/schema/operations.graphql100
-rw-r--r--graphql/schema/root.graphql38
-rw-r--r--graphql/schema/timeline.graphql86
5 files changed, 345 insertions, 0 deletions
diff --git a/graphql/schema/bug.graphql b/graphql/schema/bug.graphql
new file mode 100644
index 00000000..9530c576
--- /dev/null
+++ b/graphql/schema/bug.graphql
@@ -0,0 +1,108 @@
+"""Represents a comment on a bug."""
+type Comment implements Authored {
+ """The author of this comment."""
+ author: Identity!
+
+ """The message of this comment."""
+ message: String!
+
+ """All media's hash referenced in this comment"""
+ files: [Hash!]!
+}
+
+type CommentConnection {
+ edges: [CommentEdge!]!
+ nodes: [Comment!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+
+type CommentEdge {
+ cursor: String!
+ node: Comment!
+}
+
+enum Status {
+ OPEN
+ CLOSED
+}
+
+type Bug {
+ id: String!
+ humanId: String!
+ status: Status!
+ title: String!
+ labels: [Label!]!
+ author: Identity!
+ createdAt: Time!
+ lastEdit: Time!
+
+ comments(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ ): CommentConnection!
+
+ timeline(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ ): TimelineItemConnection!
+
+ operations(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ ): OperationConnection!
+}
+
+"""The connection type for Bug."""
+type BugConnection {
+ """A list of edges."""
+ edges: [BugEdge!]!
+ nodes: [Bug!]!
+ """Information to aid in pagination."""
+ pageInfo: PageInfo!
+ """Identifies the total count of items in the connection."""
+ totalCount: Int!
+}
+
+"""An edge in a connection."""
+type BugEdge {
+ """A cursor for use in pagination."""
+ cursor: String!
+ """The item at the end of the edge."""
+ node: Bug!
+}
+
+type Repository {
+ allBugs(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ """A query to select and order bugs"""
+ query: String
+ ): BugConnection!
+ bug(prefix: String!): Bug
+}
+
diff --git a/graphql/schema/identity.graphql b/graphql/schema/identity.graphql
new file mode 100644
index 00000000..9e76d885
--- /dev/null
+++ b/graphql/schema/identity.graphql
@@ -0,0 +1,13 @@
+"""Represents an identity"""
+type Identity {
+ """The name of the person, if known."""
+ name: String
+ """The email of the person, if known."""
+ email: String
+ """The login of the person, if known."""
+ login: String
+ """A string containing the either the name of the person, its login or both"""
+ displayName: String!
+ """An url to an avatar"""
+ avatarUrl: String
+} \ No newline at end of file
diff --git a/graphql/schema/operations.graphql b/graphql/schema/operations.graphql
new file mode 100644
index 00000000..2b206418
--- /dev/null
+++ b/graphql/schema/operations.graphql
@@ -0,0 +1,100 @@
+"""An operation applied to a bug."""
+interface Operation {
+ """The hash of the operation"""
+ hash: Hash!
+ """The operations author."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+}
+
+# Connection
+
+"""The connection type for an Operation"""
+type OperationConnection {
+ edges: [OperationEdge!]!
+ nodes: [Operation!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+
+"""Represent an Operation"""
+type OperationEdge {
+ cursor: String!
+ node: Operation!
+}
+
+# Operations
+
+type CreateOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ title: String!
+ message: String!
+ files: [Hash!]!
+}
+
+type SetTitleOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ title: String!
+ was: String!
+}
+
+type AddCommentOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ message: String!
+ files: [Hash!]!
+}
+
+type EditCommentOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ target: Hash!
+ message: String!
+ files: [Hash!]!
+}
+
+type SetStatusOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ status: Status!
+}
+
+type LabelChangeOperation implements Operation & Authored {
+ """The hash of the operation"""
+ hash: Hash!
+ """The author of this object."""
+ author: Identity!
+ """The datetime when this operation was issued."""
+ date: Time!
+
+ added: [Label!]!
+ removed: [Label!]!
+} \ No newline at end of file
diff --git a/graphql/schema/root.graphql b/graphql/schema/root.graphql
new file mode 100644
index 00000000..56558f7c
--- /dev/null
+++ b/graphql/schema/root.graphql
@@ -0,0 +1,38 @@
+scalar Time
+scalar Label
+scalar Hash
+
+"""Information about pagination in a connection."""
+type PageInfo {
+ """When paginating forwards, are there more items?"""
+ hasNextPage: Boolean!
+ """When paginating backwards, are there more items?"""
+ hasPreviousPage: Boolean!
+ """When paginating backwards, the cursor to continue."""
+ startCursor: String!
+ """When paginating forwards, the cursor to continue."""
+ endCursor: String!
+}
+
+"""An object that has an author."""
+interface Authored {
+ """The author of this object."""
+ author: Identity!
+}
+
+type Query {
+ defaultRepository: Repository
+ repository(id: String!): Repository
+}
+
+type Mutation {
+ newBug(repoRef: String, title: String!, message: String!, files: [Hash!]): Bug!
+
+ addComment(repoRef: String, prefix: String!, message: String!, files: [Hash!]): Bug!
+ changeLabels(repoRef: String, prefix: String!, added: [String!], removed: [String!]): Bug!
+ open(repoRef: String, prefix: String!): Bug!
+ close(repoRef: String, prefix: String!): Bug!
+ setTitle(repoRef: String, prefix: String!, title: String!): Bug!
+
+ commit(repoRef: String, prefix: String!): Bug!
+} \ No newline at end of file
diff --git a/graphql/schema/timeline.graphql b/graphql/schema/timeline.graphql
new file mode 100644
index 00000000..29ed6e60
--- /dev/null
+++ b/graphql/schema/timeline.graphql
@@ -0,0 +1,86 @@
+"""An item in the timeline of events"""
+interface TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+}
+
+"""CommentHistoryStep hold one version of a message in the history"""
+type CommentHistoryStep {
+ message: String!
+ date: Time!
+}
+
+# Connection
+
+"""The connection type for TimelineItem"""
+type TimelineItemConnection {
+ edges: [TimelineItemEdge!]!
+ nodes: [TimelineItem!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+
+"""Represent a TimelineItem"""
+type TimelineItemEdge {
+ cursor: String!
+ node: TimelineItem!
+}
+
+# Items
+
+"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history"""
+type CreateTimelineItem implements TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
+}
+
+"""AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history"""
+type AddCommentTimelineItem implements TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
+}
+
+"""LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug"""
+type LabelChangeTimelineItem implements TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+ author: Identity!
+ date: Time!
+ added: [Label!]!
+ removed: [Label!]!
+}
+
+"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug"""
+type SetStatusTimelineItem implements TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+ author: Identity!
+ date: Time!
+ status: Status!
+}
+
+"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug"""
+type SetTitleTimelineItem implements TimelineItem {
+ """The hash of the source operation"""
+ hash: Hash!
+ author: Identity!
+ date: Time!
+ title: String!
+ was: String!
+} \ No newline at end of file