MCPcopy
hub / github.com/cli/cli / MembersToIDs

Method MembersToIDs

api/queries_repo.go:746–780  ·  view source on GitHub ↗
(names []string)

Source from the content-addressed store, hash-verified

744}
745
746func (m *RepoMetadataResult) MembersToIDs(names []string) ([]string, error) {
747 var ids []string
748 for _, assigneeLogin := range names {
749 found := false
750 for _, u := range m.AssignableUsers {
751 if strings.EqualFold(assigneeLogin, u.Login()) {
752 ids = append(ids, u.ID())
753 found = true
754 break
755 }
756 }
757
758 // Look for ID in assignable actors if not found in assignable users
759 if !found {
760 for _, a := range m.AssignableActors {
761 if strings.EqualFold(assigneeLogin, a.Login()) {
762 ids = append(ids, a.ID())
763 found = true
764 break
765 }
766 if strings.EqualFold(assigneeLogin, a.DisplayName()) {
767 ids = append(ids, a.ID())
768 found = true
769 break
770 }
771 }
772 }
773
774 // And if we still didn't find an ID, return an error
775 if !found {
776 return nil, fmt.Errorf("'%s' not found", assigneeLogin)
777 }
778 }
779 return ids, nil
780}
781
782func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error) {
783 var ids []string

Callers 4

TestMembersToIDsFunction · 0.95
AddMetadataToIssueParamsFunction · 0.80
AssigneeIdsMethod · 0.80
Test_RepoMetadataFunction · 0.80

Calls 4

LoginMethod · 0.65
IDMethod · 0.65
DisplayNameMethod · 0.65
ErrorfMethod · 0.65

Tested by 2

TestMembersToIDsFunction · 0.76
Test_RepoMetadataFunction · 0.64