MCPcopy Index your code
hub / github.com/cli/cli / SuggestedAssignableActors

Function SuggestedAssignableActors

api/queries_pr.go:630–717  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

628// (Issue or PullRequest) node ID. `assignableID` is the GraphQL node ID for the Issue/PR.
629// Returns the actors, the total count of available assignees in the repo, and an error.
630func SuggestedAssignableActors(client *Client, repo ghrepo.Interface, assignableID string, query string) ([]AssignableActor, int, error) {
631 type responseData struct {
632 Repository struct {
633 AssignableUsers struct {
634 TotalCount int
635 }
636 } `graphql:"repository(owner: $owner, name: $name)"`
637 Node struct {
638 Issue struct {
639 SuggestedActors struct {
640 Nodes []struct {
641 TypeName string `graphql:"__typename"`
642 User struct {
643 ID string
644 Login string
645 Name string
646 } `graphql:"... on User"`
647 Bot struct {
648 ID string
649 Login string
650 } `graphql:"... on Bot"`
651 }
652 } `graphql:"suggestedActors(first: 10, query: $query)"`
653 } `graphql:"... on Issue"`
654 PullRequest struct {
655 SuggestedActors struct {
656 Nodes []struct {
657 TypeName string `graphql:"__typename"`
658 User struct {
659 ID string
660 Login string
661 Name string
662 } `graphql:"... on User"`
663 Bot struct {
664 ID string
665 Login string
666 } `graphql:"... on Bot"`
667 }
668 } `graphql:"suggestedActors(first: 10, query: $query)"`
669 } `graphql:"... on PullRequest"`
670 } `graphql:"node(id: $id)"`
671 }
672
673 variables := map[string]interface{}{
674 "id": githubv4.ID(assignableID),
675 "query": githubv4.String(query),
676 "owner": githubv4.String(repo.RepoOwner()),
677 "name": githubv4.String(repo.RepoName()),
678 }
679
680 var result responseData
681 if err := client.Query(repo.RepoHost(), "SuggestedAssignableActors", &result, variables); err != nil {
682 return nil, 0, err
683 }
684
685 availableAssigneesCount := result.Repository.AssignableUsers.TotalCount
686
687 var nodes []struct {

Callers 1

AssigneeSearchFuncFunction · 0.92

Calls 6

IDMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected