| 744 | } |
| 745 | |
| 746 | func (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 | |
| 782 | func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error) { |
| 783 | var ids []string |