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