SuggestedAssignableActors fetches up to 10 suggested actors for a specific assignable (Issue or PullRequest) node ID. `assignableID` is the GraphQL node ID for the Issue/PR. Returns the actors, the total count of available assignees in the repo, and an error.
(client *Client, repo ghrepo.Interface, assignableID string, query string)
| 653 | // (Issue or PullRequest) node ID. `assignableID` is the GraphQL node ID for the Issue/PR. |
| 654 | // Returns the actors, the total count of available assignees in the repo, and an error. |
| 655 | func SuggestedAssignableActors(client *Client, repo ghrepo.Interface, assignableID string, query string) ([]AssignableActor, int, error) { |
| 656 | type responseData struct { |
| 657 | Repository struct { |
| 658 | AssignableUsers struct { |
| 659 | TotalCount int |
| 660 | } |
| 661 | } `graphql:"repository(owner: $owner, name: $name)"` |
| 662 | Node struct { |
| 663 | Issue struct { |
| 664 | SuggestedActors struct { |
| 665 | Nodes []struct { |
| 666 | TypeName string `graphql:"__typename"` |
| 667 | User struct { |
| 668 | ID string |
| 669 | Login string |
| 670 | Name string |
| 671 | } `graphql:"... on User"` |
| 672 | Bot struct { |
| 673 | ID string |
| 674 | Login string |
| 675 | } `graphql:"... on Bot"` |
| 676 | } |
| 677 | } `graphql:"suggestedActors(first: 10, query: $query)"` |
| 678 | } `graphql:"... on Issue"` |
| 679 | PullRequest struct { |
| 680 | SuggestedActors struct { |
| 681 | Nodes []struct { |
| 682 | TypeName string `graphql:"__typename"` |
| 683 | User struct { |
| 684 | ID string |
| 685 | Login string |
| 686 | Name string |
| 687 | } `graphql:"... on User"` |
| 688 | Bot struct { |
| 689 | ID string |
| 690 | Login string |
| 691 | } `graphql:"... on Bot"` |
| 692 | } |
| 693 | } `graphql:"suggestedActors(first: 10, query: $query)"` |
| 694 | } `graphql:"... on PullRequest"` |
| 695 | } `graphql:"node(id: $id)"` |
| 696 | } |
| 697 | |
| 698 | variables := map[string]any{ |
| 699 | "id": githubv4.ID(assignableID), |
| 700 | "query": githubv4.String(query), |
| 701 | "owner": githubv4.String(repo.RepoOwner()), |
| 702 | "name": githubv4.String(repo.RepoName()), |
| 703 | } |
| 704 | |
| 705 | var result responseData |
| 706 | if err := client.Query(repo.RepoHost(), "SuggestedAssignableActors", &result, variables); err != nil { |
| 707 | return nil, 0, err |
| 708 | } |
| 709 | |
| 710 | availableAssigneesCount := result.Repository.AssignableUsers.TotalCount |
| 711 | |
| 712 | var nodes []struct { |