@@ -296,7 +296,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
296296 `
297297
298298 queryPrefix := `
299- query($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
299+ query PullRequestStatus ($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
300300 repository(owner: $owner, name: $repo) {
301301 defaultBranchRef { name }
302302 pullRequests(headRefName: $headRefName, first: $per_page, orderBy: { field: CREATED_AT, direction: DESC }) {
@@ -311,7 +311,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
311311 `
312312 if currentPRNumber > 0 {
313313 queryPrefix = `
314- query($owner: String!, $repo: String!, $number: Int!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
314+ query PullRequestStatus ($owner: String!, $repo: String!, $number: Int!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
315315 repository(owner: $owner, name: $repo) {
316316 defaultBranchRef { name }
317317 pullRequest(number: $number) {
@@ -408,7 +408,7 @@ func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*Pu
408408 }
409409
410410 query := `
411- query($owner: String!, $repo: String!, $pr_number: Int!) {
411+ query PullRequestByNumber ($owner: String!, $repo: String!, $pr_number: Int!) {
412412 repository(owner: $owner, name: $repo) {
413413 pullRequest(number: $pr_number) {
414414 id
@@ -518,7 +518,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, baseBranch, hea
518518 }
519519
520520 query := `
521- query($owner: String!, $repo: String!, $headRefName: String!) {
521+ query PullRequestForBranch ($owner: String!, $repo: String!, $headRefName: String!) {
522522 repository(owner: $owner, name: $repo) {
523523 pullRequests(headRefName: $headRefName, states: OPEN, first: 30) {
524524 nodes {
@@ -634,7 +634,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, baseBranch, hea
634634// CreatePullRequest creates a pull request in a GitHub repository
635635func CreatePullRequest (client * Client , repo * Repository , params map [string ]interface {}) (* PullRequest , error ) {
636636 query := `
637- mutation CreatePullRequest ($input: CreatePullRequestInput!) {
637+ mutation PullRequestCreate ($input: CreatePullRequestInput!) {
638638 createPullRequest(input: $input) {
639639 pullRequest {
640640 id
@@ -681,7 +681,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter
681681 }
682682 if len (updateParams ) > 0 {
683683 updateQuery := `
684- mutation UpdatePullRequest ($input: UpdatePullRequestInput!) {
684+ mutation PullRequestCreateMetadata ($input: UpdatePullRequestInput!) {
685685 updatePullRequest(input: $input) { clientMutationId }
686686 }`
687687 updateParams ["pullRequestId" ] = pr .ID
@@ -705,7 +705,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter
705705
706706 if len (reviewParams ) > 0 {
707707 reviewQuery := `
708- mutation RequestReviews ($input: RequestReviewsInput!) {
708+ mutation PullRequestCreateRequestReviews ($input: RequestReviewsInput!) {
709709 requestReviews(input: $input) { clientMutationId }
710710 }`
711711 reviewParams ["pullRequestId" ] = pr .ID
@@ -749,16 +749,16 @@ func AddReview(client *Client, pr *PullRequest, input *PullRequestReviewInput) e
749749 }
750750
751751 body := githubv4 .String (input .Body )
752-
753- gqlInput := githubv4.AddPullRequestReviewInput {
754- PullRequestID : pr .ID ,
755- Event : & state ,
756- Body : & body ,
752+ variables := map [string ]interface {}{
753+ "input" : githubv4.AddPullRequestReviewInput {
754+ PullRequestID : pr .ID ,
755+ Event : & state ,
756+ Body : & body ,
757+ },
757758 }
758759
759- v4 := githubv4 .NewClient (client .http )
760-
761- return v4 .Mutate (context .Background (), & mutation , gqlInput , nil )
760+ gql := graphQLClient (client .http )
761+ return gql .MutateNamed (context .Background (), "PullRequestReviewAdd" , & mutation , variables )
762762}
763763
764764func PullRequestList (client * Client , vars map [string ]interface {}, limit int ) (* PullRequestAndTotalCount , error ) {
@@ -798,7 +798,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) (*P
798798 // If assignee wasn't specified, use `Repository.pullRequest` for ability to
799799 // query by multiple labels
800800 query := fragment + `
801- query(
801+ query PullRequestList (
802802 $owner: String!,
803803 $repo: String!,
804804 $limit: Int!,
@@ -840,7 +840,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) (*P
840840 // `Repository.pullRequests`, but this mode doesn't support multiple labels
841841 if assignee , ok := vars ["assignee" ].(string ); ok {
842842 query = fragment + `
843- query(
843+ query PullRequestList (
844844 $q: String!,
845845 $limit: Int!,
846846 $endCursor: String,
@@ -938,12 +938,14 @@ func PullRequestClose(client *Client, repo ghrepo.Interface, pr *PullRequest) er
938938 } `graphql:"closePullRequest(input: $input)"`
939939 }
940940
941- input := githubv4.ClosePullRequestInput {
942- PullRequestID : pr .ID ,
941+ variables := map [string ]interface {}{
942+ "input" : githubv4.ClosePullRequestInput {
943+ PullRequestID : pr .ID ,
944+ },
943945 }
944946
945- v4 := githubv4 . NewClient (client .http )
946- err := v4 . Mutate (context .Background (), & mutation , input , nil )
947+ gql := graphQLClient (client .http )
948+ err := gql . MutateNamed (context .Background (), "PullRequestClose" , & mutation , variables )
947949
948950 return err
949951}
@@ -957,12 +959,14 @@ func PullRequestReopen(client *Client, repo ghrepo.Interface, pr *PullRequest) e
957959 } `graphql:"reopenPullRequest(input: $input)"`
958960 }
959961
960- input := githubv4.ReopenPullRequestInput {
961- PullRequestID : pr .ID ,
962+ variables := map [string ]interface {}{
963+ "input" : githubv4.ReopenPullRequestInput {
964+ PullRequestID : pr .ID ,
965+ },
962966 }
963967
964- v4 := githubv4 . NewClient (client .http )
965- err := v4 . Mutate (context .Background (), & mutation , input , nil )
968+ gql := graphQLClient (client .http )
969+ err := gql . MutateNamed (context .Background (), "PullRequestReopen" , & mutation , variables )
966970
967971 return err
968972}
@@ -984,13 +988,15 @@ func PullRequestMerge(client *Client, repo ghrepo.Interface, pr *PullRequest, m
984988 } `graphql:"mergePullRequest(input: $input)"`
985989 }
986990
987- input := githubv4.MergePullRequestInput {
988- PullRequestID : pr .ID ,
989- MergeMethod : & mergeMethod ,
991+ variables := map [string ]interface {}{
992+ "input" : githubv4.MergePullRequestInput {
993+ PullRequestID : pr .ID ,
994+ MergeMethod : & mergeMethod ,
995+ },
990996 }
991997
992- v4 := githubv4 . NewClient (client .http )
993- err := v4 . Mutate (context .Background (), & mutation , input , nil )
998+ gql := graphQLClient (client .http )
999+ err := gql . MutateNamed (context .Background (), "PullRequestMerge" , & mutation , variables )
9941000
9951001 return err
9961002}
@@ -1004,10 +1010,14 @@ func PullRequestReady(client *Client, repo ghrepo.Interface, pr *PullRequest) er
10041010 } `graphql:"markPullRequestReadyForReview(input: $input)"`
10051011 }
10061012
1007- input := githubv4.MarkPullRequestReadyForReviewInput {PullRequestID : pr .ID }
1013+ variables := map [string ]interface {}{
1014+ "input" : githubv4.MarkPullRequestReadyForReviewInput {
1015+ PullRequestID : pr .ID ,
1016+ },
1017+ }
10081018
1009- v4 := githubv4 . NewClient (client .http )
1010- return v4 . Mutate (context .Background (), & mutation , input , nil )
1019+ gql := graphQLClient (client .http )
1020+ return gql . MutateNamed (context .Background (), "PullRequestReadyForReview" , & mutation , variables )
10111021}
10121022
10131023func BranchDeleteRemote (client * Client , repo ghrepo.Interface , branch string ) error {
0 commit comments