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

Method MembersToIDs

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

Source from the content-addressed store, hash-verified

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