-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: swaps implementation from deprecated methods to new methods #112
Conversation
the deprecated methods now wrap the new methods moves validate jwt and create magic link methods to Auth struct aliases some types to new names
return nil, Error{Message: "network error: failed to create Passage Magic Link"} | ||
var passageError PassageError | ||
if errors.As(err, &passageError) { | ||
return magicLink, Error{ |
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 mapping (same for all the deprecated methods) is technically a breaking change since it drops the StatusText
value. but since that value is basically just the generic reason for a status code (unlikely that anyone would be checking this), i figured it would be okay to drop.
app_user.go
Outdated
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.
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 file will be renamed to passage.go
in the major release when App
is replaced
app_user_test.go
Outdated
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 is just a file rename from 79dae32
authentication.go
Outdated
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 file will be deleted in the major release
user.go
Outdated
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.
rename of app_user.go from 79dae32
user_test.go
Outdated
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.
just a file rename from 79dae32
0fb435d
to
1bd7679
Compare
return strings.TrimSuffix(sb.String(), ", ") | ||
} | ||
|
||
func errorFromResponse(body []byte, statusCode int) error { |
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.
since each generated client call returns its own struct (i.e. GetUserResponse
, ActivateUserResponse
, etc) and the required values are only exposed as properties (JSON400.Error
or JSON400.Code
)
it can't be easily abstracted into a generic function without delineating each of the different possible types and casting them.
so instead this function manually unmarshalls the response body instead of using the pre-parsed JSONXXX
properties to DRY up the code.
the trade-off is that it's taking extra steps to parse the bytes into a new struct, but i thought the simplification was worth it.
Quality Gate passedIssues Measures |
What's New?
Screenshots (if appropriate):
Type of change
Checklist:
Additional context