MCPcopy Index your code
hub / github.com/cli/cli / CommentCreate

Function CommentCreate

api/queries_comments.go:56–80  ·  view source on GitHub ↗
(client *Client, repoHost string, params CommentCreateInput)

Source from the content-addressed store, hash-verified

54}
55
56func CommentCreate(client *Client, repoHost string, params CommentCreateInput) (string, error) {
57 var mutation struct {
58 AddComment struct {
59 CommentEdge struct {
60 Node struct {
61 URL string
62 }
63 }
64 } `graphql:"addComment(input: $input)"`
65 }
66
67 variables := map[string]interface{}{
68 "input": githubv4.AddCommentInput{
69 Body: githubv4.String(params.Body),
70 SubjectID: githubv4.ID(params.SubjectId),
71 },
72 }
73
74 err := client.Mutate(repoHost, "CommentCreate", &mutation, variables)
75 if err != nil {
76 return "", err
77 }
78
79 return mutation.AddComment.CommentEdge.Node.URL, nil
80}
81
82func CommentUpdate(client *Client, repoHost string, params CommentUpdateInput) (string, error) {
83 var mutation struct {

Callers 1

createCommentFunction · 0.92

Calls 3

IDMethod · 0.65
MutateMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected