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: Email Addresses API #224

Merged
merged 1 commit into from
Feb 7, 2024
Merged

feat: Email Addresses API #224

merged 1 commit into from
Feb 7, 2024

Conversation

gkats
Copy link
Member

@gkats gkats commented Feb 7, 2024

Added support for the Email Addresses API operations Create, Read, Update and Delete.

@gkats gkats requested a review from a team as a code owner February 7, 2024 15:03
Error json.RawMessage `json:"error,omitempty"`
}

type LinkedIdentification struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't like this name, so if you have something better to suggest, please do!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds fine to me. I would maybe omit the Identification prefix from the struct field names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@@ -422,3 +422,8 @@ func String(v string) *string {
func Int64(v int64) *int64 {
return &v
}

// Bool returns a pointer to the provided bool value.
func Bool(v bool) *bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

🔧 Suggestion since this function is exported:

Suggested change
func Bool(v bool) *bool {
func BoolPtr(v bool) *bool {

Error json.RawMessage `json:"error,omitempty"`
}

type LinkedIdentification struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds fine to me. I would maybe omit the Identification prefix from the struct field names.

client := NewClient(config)
_, err := client.Create(context.Background(), &CreateParams{})
require.Error(t, err)
apiErr, ok := err.(*clerk.APIErrorResponse)
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Perhaps a helper is useful?

apiErr, ok := clerk.AsErrorResponse(err)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. However, I cannot see how this would help.

I imagine that if we change the APIErrorResponse type, even if we had the helper, we would still have to change the code that uses the error response type. 🤔

Happy to add the helper in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would mostly serve as a guide. Autocompletion may help you write the conversion faster too. Otherwise someone must probably remember or look up the error type? The rest of the code will remain the same, you're absolutely right!

Added support for the Email Addresses API operations Create, Read,
Update and Delete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants