MCPcopy Create free account
hub / github.com/cli/cli / MembersToIDs

Method MembersToIDs

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

Source from the content-addressed store, hash-verified

752}
753
754func (m *RepoMetadataResult) MembersToIDs(names []string) ([]string, error) {
755 var ids []string
756 for _, assigneeLogin := range names {
757 found := false
758 for _, u := range m.AssignableUsers {
759 if strings.EqualFold(assigneeLogin, u.Login()) {
760 ids = append(ids, u.ID())
761 found = true
762 break
763 }
764 }
765
766 // Look for ID in assignable actors if not found in assignable users
767 if !found {
768 for _, a := range m.AssignableActors {
769 if strings.EqualFold(assigneeLogin, a.Login()) {
770 ids = append(ids, a.ID())
771 found = true
772 break
773 }
774 if strings.EqualFold(assigneeLogin, a.DisplayName()) {
775 ids = append(ids, a.ID())
776 found = true
777 break
778 }
779 }
780 }
781
782 // And if we still didn't find an ID, return an error
783 if !found {
784 return nil, fmt.Errorf("'%s' not found", assigneeLogin)
785 }
786 }
787 return ids, nil
788}
789
790func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error) {
791 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