aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/models/gen_models.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-06-16 21:29:49 +0200
committerMichael Muré <batolettre@gmail.com>2019-06-16 21:29:49 +0200
commitb2f8572c4493205535558fb9320689aaf4774dc1 (patch)
tree021ed8eef1bb57c73ca595c3e79706cf215d6eee /graphql/models/gen_models.go
parent08c0e18ade5241d124fc8a3424b7612174e82cef (diff)
downloadgit-bug-b2f8572c4493205535558fb9320689aaf4774dc1.tar.gz
graphql: change mutations to respect the Relay specification
https://facebook.github.io/relay/graphql/mutations.htm This specification also allow to expose a mutationId for fire and forget, as well as the created operation.
Diffstat (limited to 'graphql/models/gen_models.go')
-rw-r--r--graphql/models/gen_models.go204
1 files changed, 204 insertions, 0 deletions
diff --git a/graphql/models/gen_models.go b/graphql/models/gen_models.go
index 858abfba..3c142e24 100644
--- a/graphql/models/gen_models.go
+++ b/graphql/models/gen_models.go
@@ -9,6 +9,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/identity"
+ "github.com/MichaelMure/git-bug/util/git"
)
// An object that has an author.
@@ -16,6 +17,28 @@ type Authored interface {
IsAuthored()
}
+type AddCommentInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+ // The first message of the new bug.
+ Message string `json:"message"`
+ // The collection of file's hash required for the first message.
+ Files []git.Hash `json:"files"`
+}
+
+type AddCommentPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation.
+ Operation *bug.AddCommentOperation `json:"operation"`
+}
+
// The connection type for Bug.
type BugConnection struct {
// A list of edges.
@@ -35,6 +58,48 @@ type BugEdge struct {
Node *bug.Snapshot `json:"node"`
}
+type ChangeLabelInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+ // The list of label to add.
+ Added []string `json:"added"`
+ // The list of label to remove.
+ Removed []string `json:"Removed"`
+}
+
+type ChangeLabelPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation.
+ Operation *bug.LabelChangeOperation `json:"operation"`
+ // The effect each source label had.
+ Results []*bug.LabelChangeResult `json:"results"`
+}
+
+type CloseBugInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+}
+
+type CloseBugPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation.
+ Operation *bug.SetStatusOperation `json:"operation"`
+}
+
type CommentConnection struct {
Edges []*CommentEdge `json:"edges"`
Nodes []*bug.Comment `json:"nodes"`
@@ -47,6 +112,38 @@ type CommentEdge struct {
Node *bug.Comment `json:"node"`
}
+type CommitAsNeededInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+}
+
+type CommitAsNeededPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+}
+
+type CommitInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+}
+
+type CommitPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+}
+
type IdentityConnection struct {
Edges []*IdentityEdge `json:"edges"`
Nodes []identity.Interface `json:"nodes"`
@@ -59,6 +156,46 @@ type IdentityEdge struct {
Node identity.Interface `json:"node"`
}
+type NewBugInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The title of the new bug.
+ Title string `json:"title"`
+ // The first message of the new bug.
+ Message string `json:"message"`
+ // The collection of file's hash required for the first message.
+ Files []git.Hash `json:"files"`
+}
+
+type NewBugPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The created bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation.
+ Operation *bug.CreateOperation `json:"operation"`
+}
+
+type OpenBugInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+}
+
+type OpenBugPayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation.
+ Operation *bug.SetStatusOperation `json:"operation"`
+}
+
// The connection type for an Operation
type OperationConnection struct {
Edges []*OperationEdge `json:"edges"`
@@ -85,6 +222,26 @@ type PageInfo struct {
EndCursor string `json:"endCursor"`
}
+type SetTitleInput struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // "The name of the repository. If not set, the default repository is used.
+ RepoRef *string `json:"repoRef"`
+ // The bug ID's prefix.
+ Prefix string `json:"prefix"`
+ // The new title.
+ Title string `json:"title"`
+}
+
+type SetTitlePayload struct {
+ // A unique identifier for the client performing the mutation.
+ ClientMutationID *string `json:"clientMutationId"`
+ // The affected bug.
+ Bug *bug.Snapshot `json:"bug"`
+ // The resulting operation
+ Operation *bug.SetTitleOperation `json:"operation"`
+}
+
// The connection type for TimelineItem
type TimelineItemConnection struct {
Edges []*TimelineItemEdge `json:"edges"`
@@ -99,6 +256,53 @@ type TimelineItemEdge struct {
Node bug.TimelineItem `json:"node"`
}
+type LabelChangeStatus string
+
+const (
+ LabelChangeStatusAdded LabelChangeStatus = "ADDED"
+ LabelChangeStatusRemoved LabelChangeStatus = "REMOVED"
+ LabelChangeStatusDuplicateInOp LabelChangeStatus = "DUPLICATE_IN_OP"
+ LabelChangeStatusAlreadyExist LabelChangeStatus = "ALREADY_EXIST"
+ LabelChangeStatusDoesntExist LabelChangeStatus = "DOESNT_EXIST"
+)
+
+var AllLabelChangeStatus = []LabelChangeStatus{
+ LabelChangeStatusAdded,
+ LabelChangeStatusRemoved,
+ LabelChangeStatusDuplicateInOp,
+ LabelChangeStatusAlreadyExist,
+ LabelChangeStatusDoesntExist,
+}
+
+func (e LabelChangeStatus) IsValid() bool {
+ switch e {
+ case LabelChangeStatusAdded, LabelChangeStatusRemoved, LabelChangeStatusDuplicateInOp, LabelChangeStatusAlreadyExist, LabelChangeStatusDoesntExist:
+ return true
+ }
+ return false
+}
+
+func (e LabelChangeStatus) String() string {
+ return string(e)
+}
+
+func (e *LabelChangeStatus) UnmarshalGQL(v interface{}) error {
+ str, ok := v.(string)
+ if !ok {
+ return fmt.Errorf("enums must be strings")
+ }
+
+ *e = LabelChangeStatus(str)
+ if !e.IsValid() {
+ return fmt.Errorf("%s is not a valid LabelChangeStatus", str)
+ }
+ return nil
+}
+
+func (e LabelChangeStatus) MarshalGQL(w io.Writer) {
+ fmt.Fprint(w, strconv.Quote(e.String()))
+}
+
type Status string
const (