MCPcopy
hub / github.com/cli/cli / IssueStatus

Function IssueStatus

api/queries_issue.go:393–470  ·  view source on GitHub ↗
(client *Client, repo ghrepo.Interface, options IssueStatusOptions)

Source from the content-addressed store, hash-verified

391}
392
393func IssueStatus(client *Client, repo ghrepo.Interface, options IssueStatusOptions) (*IssuesPayload, error) {
394 type response struct {
395 Repository struct {
396 Assigned struct {
397 TotalCount int
398 Nodes []Issue
399 }
400 Mentioned struct {
401 TotalCount int
402 Nodes []Issue
403 }
404 Authored struct {
405 TotalCount int
406 Nodes []Issue
407 }
408 HasIssuesEnabled bool
409 }
410 }
411
412 fragments := fmt.Sprintf("fragment issue on Issue{%s}", IssueGraphQL(options.Fields))
413 query := fragments + `
414 query IssueStatus($owner: String!, $repo: String!, $viewer: String!, $per_page: Int = 10) {
415 repository(owner: $owner, name: $repo) {
416 hasIssuesEnabled
417 assigned: issues(filterBy: {assignee: $viewer, states: OPEN}, first: $per_page, orderBy: {field: UPDATED_AT, direction: DESC}) {
418 totalCount
419 nodes {
420 ...issue
421 }
422 }
423 mentioned: issues(filterBy: {mentioned: $viewer, states: OPEN}, first: $per_page, orderBy: {field: UPDATED_AT, direction: DESC}) {
424 totalCount
425 nodes {
426 ...issue
427 }
428 }
429 authored: issues(filterBy: {createdBy: $viewer, states: OPEN}, first: $per_page, orderBy: {field: UPDATED_AT, direction: DESC}) {
430 totalCount
431 nodes {
432 ...issue
433 }
434 }
435 }
436 }`
437
438 variables := map[string]interface{}{
439 "owner": repo.RepoOwner(),
440 "repo": repo.RepoName(),
441 "viewer": options.Username,
442 }
443
444 var resp response
445 err := client.GraphQL(repo.RepoHost(), query, variables, &resp)
446 if err != nil {
447 return nil, err
448 }
449
450 if !resp.Repository.HasIssuesEnabled {

Callers 1

statusRunFunction · 0.92

Calls 7

FullNameFunction · 0.92
IssueGraphQLFunction · 0.85
GraphQLMethod · 0.80
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RepoHostMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected