Skip to content
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

Merged
merged 4 commits into from
May 15, 2023

Conversation

shalini-agr
Copy link
Contributor

No description provided.

@@ -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
Copy link
Member

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
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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")
Copy link
Member

@bradrydzewski bradrydzewski May 12, 2023

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)

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@tphoney tphoney merged commit 5877f38 into drone:master May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants