-
Notifications
You must be signed in to change notification settings - Fork 36
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
added search customer by email api #124
Conversation
lib/api.ts
Outdated
@@ -51,6 +52,14 @@ export class APIClient { | |||
return this.request.post(`${this.apiRoot}/send/email`, req.message); | |||
} | |||
|
|||
getCustomersByEmail(email: string) { | |||
if (typeof email !== 'string' || !email) { |
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.
We prefer the isEmpty
util to the !
operator to catch cases where the value is an empty string
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!
t.truthy((t.context.client.request.get as SinonStub).calledWith(`${RegionUS.apiUrl}/customers?email=${email}`)); | ||
}) | ||
|
||
test('#getCustomersByEmail: should throw error when email is empty', (t) => { |
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.
Another test should be added for cases where null
/undefined
or a non-string object are used for non-typescript clients
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!
@mike-engel could you take another look? |
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.
Thanks @PFadel! One last thing I forgot—can you add documentation to the readme?
@mike-engel done! |
@mike-engel could you take another look? <3 |
Thanks for your patience @PFadel. This was included with 3.4.0 |
See the example:
getCustomersByEmail.js
Features:
Added get method
Url encode emails
updates from: #89