| 749 | } |
| 750 | |
| 751 | func (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 | |
| 787 | func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error) { |
| 788 | var ids []string |