@@ -204,7 +204,7 @@ type ComplexityRoot struct {
}
Identity struct {
- AvatarURL func(childComplexity int) int
+ AvatarUrl func(childComplexity int) int
DisplayName func(childComplexity int) int
Email func(childComplexity int) int
HumanID func(childComplexity int) int
@@ -418,14 +418,8 @@ type EditCommentOperationResolver interface {
Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error)
}
type IdentityResolver interface {
- ID(ctx context.Context, obj *identity.Interface) (string, error)
- HumanID(ctx context.Context, obj *identity.Interface) (string, error)
- Name(ctx context.Context, obj *identity.Interface) (*string, error)
- Email(ctx context.Context, obj *identity.Interface) (*string, error)
- Login(ctx context.Context, obj *identity.Interface) (*string, error)
- DisplayName(ctx context.Context, obj *identity.Interface) (string, error)
- AvatarURL(ctx context.Context, obj *identity.Interface) (*string, error)
- IsProtected(ctx context.Context, obj *identity.Interface) (bool, error)
+ ID(ctx context.Context, obj identity.Interface) (string, error)
+ HumanID(ctx context.Context, obj identity.Interface) (string, error)
}
type LabelResolver interface {
Name(ctx context.Context, obj *bug.Label) (string, error)
@@ -1104,11 +1098,11 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.EditCommentOperation.Target(childComplexity), true
case "Identity.avatarUrl":
- if e.complexity.Identity.AvatarURL == nil {
+ if e.complexity.Identity.AvatarUrl == nil {
break
}
- return e.complexity.Identity.AvatarURL(childComplexity), true
+ return e.complexity.Identity.AvatarUrl(childComplexity), true
case "Identity.displayName":
if e.complexity.Identity.DisplayName == nil {
@@ -1828,46 +1822,48 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false
}
-func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- ec := executionContext{graphql.GetRequestContext(ctx), e}
+func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
+ rc := graphql.GetOperationContext(ctx)
+ ec := executionContext{rc, e}
+ first := true
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- data := ec._Query(ctx, op.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
-
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
- }
-}
+ switch rc.Operation.Operation {
+ case ast.Query:
+ return func(ctx context.Context) *graphql.Response {
+ if !first {
+ return nil
+ }
+ first = false
+ data := ec._Query(ctx, rc.Operation.SelectionSet)
+ var buf bytes.Buffer
+ data.MarshalGQL(&buf)
-func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- ec := executionContext{graphql.GetRequestContext(ctx), e}
+ return &graphql.Response{
+ Data: buf.Bytes(),
+ }
+ }
+ case ast.Mutation:
+ return func(ctx context.Context) *graphql.Response {
+ if !first {
+ return nil
+ }
+ first = false
+ data := ec._Mutation(ctx, rc.Operation.SelectionSet)
+ var buf bytes.Buffer
+ data.MarshalGQL(&buf)
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- data := ec._Mutation(ctx, op.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
+ return &graphql.Response{
+ Data: buf.Bytes(),
+ }
+ }
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
+ default:
+ return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
}
}
-func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
- return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported"))
-}
-
type executionContext struct {
- *graphql.RequestContext
+ *graphql.OperationContext
*executableSchema
}
@@ -1886,637 +1882,877 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er
}
var parsedSchema = gqlparser.MustLoadSchema(
- &ast.Source{Name: "schema/bug.graphql", Input: `"""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!
+ &ast.Source{Name: "schema.graphql", Input: `input AddCommentInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The first message of the new bug.
+ """
+ message: String!
+ """
+ The collection of file's hash required for the first message.
+ """
+ files: [Hash!]
}
-
-type CommentEdge {
- cursor: String!
- node: Comment!
+type AddCommentOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ message: String!
+ files: [Hash!]!
}
-
-enum Status {
- OPEN
- CLOSED
+type AddCommentPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: AddCommentOperation!
+}
+"""
+AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history
+"""
+type AddCommentTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
+}
+"""
+An object that has an author.
+"""
+interface Authored {
+ """
+ The author of this object.
+ """
+ author: Identity!
}
-
type Bug implements Authored {
- """The identifier for this bug"""
- id: String!
- """The human version (truncated) identifier for this bug"""
- humanId: String!
- status: Status!
- title: String!
- labels: [Label!]!
- author: Identity!
- createdAt: Time!
- lastEdit: Time!
-
- """The actors of the bug. Actors are Identity that have interacted with the bug."""
- actors(
- """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
- ): IdentityConnection!
-
- """The participants of the bug. Participants are Identity that have created or
- added a comment on the bug."""
- participants(
- """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
- ): IdentityConnection!
-
- 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."""
+ """
+ The identifier for this bug
+ """
+ id: String!
+ """
+ The human version (truncated) identifier for this bug
+ """
+ humanId: String!
+ status: Status!
+ title: String!
+ labels: [Label!]!
+ author: Identity!
+ createdAt: Time!
+ lastEdit: Time!
+ """
+ The actors of the bug. Actors are Identity that have interacted with the bug.
+ """
+ actors("""
+ 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): IdentityConnection!
+ """
+ The participants of the bug. Participants are Identity that have created or
+ added a comment on the bug.
+ """
+ participants("""
+ 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): IdentityConnection!
+ 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."""
+ """
+ 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!
-}
-`},
- &ast.Source{Name: "schema/identity.graphql", Input: `"""Represents an identity"""
-type Identity {
- """The identifier for this identity"""
- id: String!
- """The human version (truncated) identifier for this identity"""
- humanId: String!
- """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
- """isProtected is true if the chain of git commits started to be signed.
- If that's the case, only signed commit with a valid key for this identity can be added."""
- isProtected: Boolean!
-}
-
-type IdentityConnection {
- edges: [IdentityEdge!]!
- nodes: [Identity!]!
- pageInfo: PageInfo!
- totalCount: Int!
-}
-
-type IdentityEdge {
- cursor: String!
- node: Identity!
-}`},
- &ast.Source{Name: "schema/label.graphql", Input: `"""Label for a bug."""
-type Label {
- """The name of the label."""
- name: String!
- """Color of the label."""
- color: Color!
-}
-
-type LabelConnection {
- edges: [LabelEdge!]!
- nodes: [Label!]!
- pageInfo: PageInfo!
- totalCount: Int!
-}
-
-type LabelEdge {
- cursor: String!
- node: Label!
-}`},
- &ast.Source{Name: "schema/mutations.graphql", Input: `input NewBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The title of the new bug."""
- title: String!
- """The first message of the new bug."""
- message: String!
- """The collection of file's hash required for the first message."""
- files: [Hash!]
-}
-
-type NewBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The created bug."""
- bug: Bug!
- """The resulting operation."""
- operation: CreateOperation!
-}
-
-input AddCommentInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The first message of the new bug."""
- message: String!
- """The collection of file's hash required for the first message."""
- files: [Hash!]
-}
-
-type AddCommentPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: AddCommentOperation!
+ """
+ A cursor for use in pagination.
+ """
+ cursor: String!
+ """
+ The item at the end of the edge.
+ """
+ node: Bug!
}
-
input ChangeLabelInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The list of label to add."""
- added: [String!]
- """The list of label to remove."""
- Removed: [String!]
-}
-
-enum LabelChangeStatus {
- ADDED
- REMOVED
- DUPLICATE_IN_OP
- ALREADY_EXIST
- DOESNT_EXIST
-}
-
-type LabelChangeResult {
- """The source label."""
- label: Label!
- """The effect this label had."""
- status: LabelChangeStatus!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The list of label to add.
+ """
+ added: [String!]
+ """
+ The list of label to remove.
+ """
+ Removed: [String!]
}
-
type ChangeLabelPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: LabelChangeOperation!
- """The effect each source label had."""
- results: [LabelChangeResult]!
-}
-
-input OpenBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: LabelChangeOperation!
+ """
+ The effect each source label had.
+ """
+ results: [LabelChangeResult]!
}
-
-type OpenBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: SetStatusOperation!
-}
-
input CloseBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
type CloseBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: SetStatusOperation!
-}
-
-input SetTitleInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The new title."""
- title: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: SetStatusOperation!
+}
+"""
+Defines a color by red, green and blue components.
+"""
+type Color {
+ """
+ Red component of the color.
+ """
+ R: Int!
+ """
+ Green component of the color.
+ """
+ G: Int!
+ """
+ Blue component of the color.
+ """
+ B: Int!
+}
+"""
+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 SetTitlePayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation"""
- operation: SetTitleOperation!
+type CommentConnection {
+ edges: [CommentEdge!]!
+ nodes: [Comment!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
}
-
-input CommitInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+type CommentEdge {
+ cursor: String!
+ node: Comment!
}
-
-type CommitPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
+"""
+CommentHistoryStep hold one version of a message in the history
+"""
+type CommentHistoryStep {
+ message: String!
+ date: Time!
}
-
input CommitAsNeededInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
type CommitAsNeededPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
-}
-`},
- &ast.Source{Name: "schema/operations.graphql", Input: `"""An operation applied to a bug."""
-interface Operation {
- """The identifier of the operation"""
- id: String!
- """The operations author."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
}
-
-# Connection
-
-"""The connection type for an Operation"""
-type OperationConnection {
- edges: [OperationEdge!]!
- nodes: [Operation!]!
- pageInfo: PageInfo!
- totalCount: Int!
+input CommitInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
-"""Represent an Operation"""
-type OperationEdge {
- cursor: String!
- node: Operation!
+type CommitPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
}
-
-# Operations
-
type CreateOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- title: String!
- message: String!
- files: [Hash!]!
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ title: String!
+ message: String!
+ files: [Hash!]!
+}
+"""
+CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history
+"""
+type CreateTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
}
-
-type SetTitleOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- title: String!
- was: String!
+type EditCommentOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ target: String!
+ message: String!
+ files: [Hash!]!
}
-
-type AddCommentOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- message: String!
- files: [Hash!]!
+scalar Hash
+"""
+Represents an identity
+"""
+type Identity {
+ """
+ The identifier for this identity
+ """
+ id: String!
+ """
+ The human version (truncated) identifier for this identity
+ """
+ humanId: String!
+ """
+ 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
+ """
+ isProtected is true if the chain of git commits started to be signed.
+ If that's the case, only signed commit with a valid key for this identity can be added.
+ """
+ isProtected: Boolean!
}
-
-type EditCommentOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- target: String!
- message: String!
- files: [Hash!]!
+type IdentityConnection {
+ edges: [IdentityEdge!]!
+ nodes: [Identity!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
}
-
-type SetStatusOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- status: Status!
+type IdentityEdge {
+ cursor: String!
+ node: Identity!
+}
+"""
+Label for a bug.
+"""
+type Label {
+ """
+ The name of the label.
+ """
+ name: String!
+ """
+ Color of the label.
+ """
+ color: Color!
}
-
type LabelChangeOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- added: [Label!]!
- removed: [Label!]!
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ added: [Label!]!
+ removed: [Label!]!
}
-`},
- &ast.Source{Name: "schema/repository.graphql", Input: `
-type Repository {
- """All the bugs"""
- 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
-
- """All the identities"""
- allIdentities(
- """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
- ): IdentityConnection!
-
- identity(prefix: String!): Identity
-
- """The identity created or selected by the user as its own"""
- userIdentity: Identity
-
- """List of valid labels."""
- validLabels(
- """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
- ): LabelConnection!
-}`},
- &ast.Source{Name: "schema/root.graphql", Input: `type Query {
- """The default unnamend repository."""
- defaultRepository: Repository
- """Access a repository by reference/name."""
- repository(ref: String!): Repository
+type LabelChangeResult {
+ """
+ The source label.
+ """
+ label: Label!
+ """
+ The effect this label had.
+ """
+ status: LabelChangeStatus!
+}
+enum LabelChangeStatus {
+ ADDED
+ REMOVED
+ DUPLICATE_IN_OP
+ ALREADY_EXIST
+ DOESNT_EXIST
+}
+"""
+LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug
+"""
+type LabelChangeTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ added: [Label!]!
+ removed: [Label!]!
+}
+type LabelConnection {
+ edges: [LabelEdge!]!
+ nodes: [Label!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+type LabelEdge {
+ cursor: String!
+ node: Label!
}
-
type Mutation {
- """Create a new bug"""
- newBug(input: NewBugInput!): NewBugPayload!
- """Add a new comment to a bug"""
- addComment(input: AddCommentInput!): AddCommentPayload!
- """Add or remove a set of label on a bug"""
- changeLabels(input: ChangeLabelInput): ChangeLabelPayload!
- """Change a bug's status to open"""
- openBug(input: OpenBugInput!): OpenBugPayload!
- """Change a bug's status to closed"""
- closeBug(input: CloseBugInput!): CloseBugPayload!
- """Change a bug's title"""
- setTitle(input: SetTitleInput!): SetTitlePayload!
- """Commit write the pending operations into storage. This mutation fail if nothing is pending"""
- commit(input: CommitInput!): CommitPayload!
- """Commit write the pending operations into storage. This mutation succed if nothing is pending"""
- commitAsNeeded(input: CommitAsNeededInput!): CommitAsNeededPayload!
+ """
+ Create a new bug
+ """
+ newBug(input: NewBugInput!): NewBugPayload!
+ """
+ Add a new comment to a bug
+ """
+ addComment(input: AddCommentInput!): AddCommentPayload!
+ """
+ Add or remove a set of label on a bug
+ """
+ changeLabels(input: ChangeLabelInput): ChangeLabelPayload!
+ """
+ Change a bug's status to open
+ """
+ openBug(input: OpenBugInput!): OpenBugPayload!
+ """
+ Change a bug's status to closed
+ """
+ closeBug(input: CloseBugInput!): CloseBugPayload!
+ """
+ Change a bug's title
+ """
+ setTitle(input: SetTitleInput!): SetTitlePayload!
+ """
+ Commit write the pending operations into storage. This mutation fail if nothing is pending
+ """
+ commit(input: CommitInput!): CommitPayload!
+ """
+ Commit write the pending operations into storage. This mutation succed if nothing is pending
+ """
+ commitAsNeeded(input: CommitAsNeededInput!): CommitAsNeededPayload!
+}
+input NewBugInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The title of the new bug.
+ """
+ title: String!
+ """
+ The first message of the new bug.
+ """
+ message: String!
+ """
+ The collection of file's hash required for the first message.
+ """
+ files: [Hash!]
}
-`},
- &ast.Source{Name: "schema/timeline.graphql", Input: `"""An item in the timeline of events"""
-interface TimelineItem {
- """The identifier of the source operation"""
- id: String!
+type NewBugPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The created bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: CreateOperation!
}
-
-"""CommentHistoryStep hold one version of a message in the history"""
-type CommentHistoryStep {
- message: String!
- date: Time!
+input OpenBugInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
-# Connection
-
-"""The connection type for TimelineItem"""
-type TimelineItemConnection {
- edges: [TimelineItemEdge!]!
- nodes: [TimelineItem!]!
- pageInfo: PageInfo!
- totalCount: Int!
+type OpenBugPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: SetStatusOperation!
+}
+"""
+An operation applied to a bug.
+"""
+interface Operation {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The operations author.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+}
+"""
+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!
}
-
-"""Represent a TimelineItem"""
-type TimelineItemEdge {
- cursor: String!
- node: TimelineItem!
+"""
+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!
+}
+type Query {
+ """
+ The default unnamend repository.
+ """
+ defaultRepository: Repository
+ """
+ Access a repository by reference/name.
+ """
+ repository(ref: String!): Repository
}
-
-# Items
-
-"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history"""
-type CreateTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- 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 & Authored {
- """The identifier of the source operation"""
- id: String!
- 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 & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- added: [Label!]!
- removed: [Label!]!
+type Repository {
+ """
+ All the bugs
+ """
+ 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
+ """
+ All the identities
+ """
+ allIdentities("""
+ 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): IdentityConnection!
+ identity(prefix: String!): Identity
+ """
+ The identity created or selected by the user as its own
+ """
+ userIdentity: Identity
+ """
+ List of valid labels.
+ """
+ validLabels("""
+ 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): LabelConnection!
}
-
-"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug"""
+type SetStatusOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ status: Status!
+}
+"""
+SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug
+"""
type SetStatusTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- status: Status!
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ status: Status!
}
-
-"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug"""
-type SetTitleTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- title: String!
- was: String!
+input SetTitleInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The new title.
+ """
+ title: String!
}
-`},
- &ast.Source{Name: "schema/types.graphql", Input: `scalar Time
-scalar Hash
-
-"""Defines a color by red, green and blue components."""
-type Color {
- """Red component of the color."""
- R: Int!
- """Green component of the color."""
- G: Int!
- """Blue component of the color."""
- B: Int!
+type SetTitleOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ title: String!
+ was: String!
}
-
-"""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!
+type SetTitlePayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation
+ """
+ operation: SetTitleOperation!
+}
+"""
+LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug
+"""
+type SetTitleTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ title: String!
+ was: String!
}
-
-"""An object that has an author."""
-interface Authored {
- """The author of this object."""
- author: Identity!
+enum Status {
+ OPEN
+ CLOSED
+}
+scalar Time
+"""
+An item in the timeline of events
+"""
+interface TimelineItem {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+}
+"""
+The connection type for TimelineItem
+"""
+type TimelineItemConnection {
+ edges: [TimelineItemEdge!]!
+ nodes: [TimelineItem!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+"""
+Represent a TimelineItem
+"""
+type TimelineItemEdge {
+ cursor: String!
+ node: TimelineItem!
}
`},
)
@@ -11,41 +11,10 @@ var _ graph.IdentityResolver = &identityResolver{}
type identityResolver struct{}
-func (identityResolver) ID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).Id().String(), nil
+func (identityResolver) ID(ctx context.Context, obj identity.Interface) (string, error) {
+ return obj.Id().String(), nil
}
-func (identityResolver) HumanID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).Id().Human(), nil
-}
-
-func (identityResolver) Name(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Name())
-}
-
-func (identityResolver) Email(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Email())
-}
-
-func (identityResolver) Login(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Login())
-}
-
-func (identityResolver) DisplayName(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).DisplayName(), nil
-}
-
-func (identityResolver) AvatarURL(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).AvatarUrl())
-}
-
-func (identityResolver) IsProtected(ctx context.Context, obj *identity.Interface) (bool, error) {
- return (*obj).IsProtected(), nil
-}
-
-func nilIfEmpty(s string) (*string, error) {
- if s == "" {
- return nil, nil
- }
- return &s, nil
+func (identityResolver) HumanID(ctx context.Context, obj identity.Interface) (string, error) {
+ return obj.Id().Human(), nil
}