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

Method MembersToIDs

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

Source from the content-addressed store, hash-verified

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