github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildplanner/request/createproject.go (about) 1 package request 2 3 import "github.com/ActiveState/cli/pkg/platform/runtime/buildexpression" 4 5 func CreateProject(owner, project string, private bool, expr *buildexpression.BuildExpression, description string) *createProject { 6 return &createProject{map[string]interface{}{ 7 "organization": owner, 8 "project": project, 9 "private": private, 10 "expr": expr, 11 "description": description, 12 "atTime": "", // default to the latest timestamp 13 }} 14 } 15 16 type createProject struct { 17 vars map[string]interface{} 18 } 19 20 func (c *createProject) Query() string { 21 return ` 22 mutation ($organization: String!, $project: String!, $private: Boolean!, $expr: BuildExpr!, $description: String!) { 23 createProject(input:{organization:$organization, project:$project, private:$private, expr:$expr, description:$description}) { 24 ... on ProjectCreated { 25 __typename 26 commit { 27 __typename 28 commitId 29 } 30 } 31 ... on AlreadyExists { 32 __typename 33 message 34 } 35 ... on NotFound { 36 __typename 37 message 38 } 39 ... on ParseError { 40 __typename 41 message 42 path 43 } 44 ... on ValidationError { 45 __typename 46 message 47 } 48 ... on Forbidden { 49 __typename 50 message 51 } 52 } 53 }` 54 } 55 56 func (c *createProject) Vars() (map[string]interface{}, error) { 57 return c.vars, nil 58 }