-
Notifications
You must be signed in to change notification settings - Fork 234
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
feat: [CDS-69341]: add find user email api for github in go-scm #256
Conversation
@@ -31,8 +31,9 @@ func (s *userService) FindLogin(ctx context.Context, login string) (*scm.User, * | |||
} | |||
|
|||
func (s *userService) FindEmail(ctx context.Context) (string, *scm.Response, error) { | |||
user, res, err := s.Find(ctx) | |||
return user.Email, res, err |
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.
you can re-use the ListEmail
function here:
func (s *userService) FindEmail(ctx context.Context) (string, *scm.Response, error) {
out, res, err := s.ListEmails(ctx, scm.ListOptions{})
return returnPrimaryEmail(out), res, err
}
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.
done
scm/driver/github/user_test.go
Outdated
Reply(200). | ||
Type("application/json"). | ||
SetHeader("X-GitHub-Request-Id", "DD0E:6011:12F21A8:1926790:5A2064E2"). | ||
SetHeader("X-RateLimit-Limit", "60"). | ||
SetHeader("X-RateLimit-Remaining", "59"). | ||
SetHeader("X-RateLimit-Reset", "1512076018"). | ||
File("testdata/user.json") | ||
File("testdata/userEmail.json") |
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.
files in the testdata folder use snake case for file names as opposed to camel case (e.g. user_email.json
as opposed to userEmail.json
)
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.
although you may be able to re-use the existing testdata/emails.json
file in that folder for your test
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.
done
No description provided.