IssueGraphQL constructs a GraphQL query fragment for a set of issue fields.
(fields []string)
| 383 | |
| 384 | // IssueGraphQL constructs a GraphQL query fragment for a set of issue fields. |
| 385 | func IssueGraphQL(fields []string) string { |
| 386 | var q []string |
| 387 | for _, field := range fields { |
| 388 | switch field { |
| 389 | case "author": |
| 390 | q = append(q, `author{login,...on User{id,name}}`) |
| 391 | case "mergedBy": |
| 392 | q = append(q, `mergedBy{login,...on User{id,name}}`) |
| 393 | case "headRepositoryOwner": |
| 394 | q = append(q, `headRepositoryOwner{id,login,...on User{name}}`) |
| 395 | case "headRepository": |
| 396 | q = append(q, `headRepository{id,name,nameWithOwner}`) |
| 397 | case "assignees": |
| 398 | q = append(q, `assignees(first:100){nodes{id,login,name,databaseId},totalCount}`) |
| 399 | case "assignedActors": |
| 400 | q = append(q, assignedActors) |
| 401 | case "labels": |
| 402 | q = append(q, `labels(first:100){nodes{id,name,description,color},totalCount}`) |
| 403 | case "projectCards": |
| 404 | q = append(q, `projectCards(first:100){nodes{project{name}column{name}},totalCount}`) |
| 405 | case "projectItems": |
| 406 | q = append(q, `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`) |
| 407 | case "milestone": |
| 408 | q = append(q, `milestone{number,title,description,dueOn}`) |
| 409 | case "reactionGroups": |
| 410 | q = append(q, `reactionGroups{content,users{totalCount}}`) |
| 411 | case "mergeCommit": |
| 412 | q = append(q, `mergeCommit{oid}`) |
| 413 | case "potentialMergeCommit": |
| 414 | q = append(q, `potentialMergeCommit{oid}`) |
| 415 | case "autoMergeRequest": |
| 416 | q = append(q, autoMergeRequest) |
| 417 | case "comments": |
| 418 | q = append(q, issueComments) |
| 419 | case "lastComment": // pseudo-field |
| 420 | q = append(q, issueCommentLast) |
| 421 | case "reviewRequests": |
| 422 | q = append(q, prReviewRequests) |
| 423 | case "reviews": |
| 424 | q = append(q, prReviews) |
| 425 | case "latestReviews": |
| 426 | q = append(q, prLatestReviews) |
| 427 | case "files": |
| 428 | q = append(q, prFiles) |
| 429 | case "commits": |
| 430 | q = append(q, prCommits) |
| 431 | case "lastCommit": // pseudo-field |
| 432 | q = append(q, `commits(last:1){nodes{commit{oid}}}`) |
| 433 | case "commitsCount": // pseudo-field |
| 434 | q = append(q, `commits{totalCount}`) |
| 435 | case "requiresStrictStatusChecks": // pseudo-field |
| 436 | q = append(q, `baseRef{branchProtectionRule{requiresStrictStatusChecks}}`) |
| 437 | case "statusCheckRollup": |
| 438 | q = append(q, StatusCheckRollupGraphQLWithoutCountByState("")) |
| 439 | case "statusCheckRollupWithCountByState": // pseudo-field |
| 440 | q = append(q, StatusCheckRollupGraphQLWithCountByState()) |
| 441 | case "closingIssuesReferences": |
| 442 | q = append(q, prClosingIssuesReferences) |