-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter teams by name, org members by email #393
Conversation
|
||
// validEmail checks if the given input is a correct email | ||
func validEmail(v string) bool { | ||
_, err := mail.ParseAddress(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 🎉
@@ -77,6 +77,9 @@ type OrganizationMembershipListOptions struct { | |||
// Optional: A list of relations to include. See available resources | |||
// https://www.terraform.io/cloud-docs/api-docs/organization-memberships#available-related-resources | |||
Include []OrgMembershipIncludeOpt `url:"include,omitempty"` | |||
|
|||
// Optional: A list of organization member emails to filter by. | |||
Emails []string `url:"filter[email],omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be,
Emails []string `url:"filter[email],omitempty"` | |
Emails []string `url:"filter[emails],omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 The param in the API is actually filter[email]
: https://www.terraform.io/cloud-docs/api-docs/organization-memberships#query-parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
@@ -278,3 +285,13 @@ func validateTeamIncludeParams(params []TeamIncludeOpt) error { | |||
|
|||
return nil | |||
} | |||
|
|||
func validateTeamNames(names []string) error { | |||
for _, name := range names { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works when names is nil, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yessir!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
@@ -262,4 +262,8 @@ var ( | |||
ErrRequiredWorkspacesList = errors.New("no workspaces list provided") | |||
|
|||
ErrCommentBody = errors.New("comment body is required") | |||
|
|||
ErrEmptyTeamName = errors.New("team name can not be empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrEmptyTeamName = errors.New("team name can not be empty") | |
ErrEmptyTeamName = errors.New("team name cannot be empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking @laurapacilio about this because ... after doing a quick search I realized that this suggestion may not be consistent with what we do as a company.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ Nice!
Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes. |
Two new query params have been added to the list endpoints for
Teams
andOrganizationMemberships
:filter[names]
- List Teamsfilter[email]
- List Org Members