-
Notifications
You must be signed in to change notification settings - Fork 75
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
search by ePID with Auth flow #140
Conversation
add epid in searchItems
@@ -49,7 +49,7 @@ const getItemByItemGroup = function (itemGroupId) { | |||
|
|||
const searchItems = function (searchConfig) { | |||
if (!searchConfig) throw new Error('Error --> Missing or invalid input parameter to search'); | |||
if (!searchConfig.keyword && !searchConfig.categoryId && !searchConfig.gtin) throw new Error('Error --> Keyword or category id is required in query param'); | |||
if (!searchConfig.keyword && !searchConfig.categoryId && !searchConfig.gtin && !searchConfig.epid) throw new Error('Error --> Keyword or category id is required in query param'); | |||
if (!this.options.appAccessToken) throw new Error('Error -->Missing Access token, Generate access token'); |
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.
epid is not required field, you can remove this from the if loop.
https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search#h2-input
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.
Is not possible to seach only by epid then?
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.
@rambonette You are right, we can search using epid. We can change the error message like this
'Error --> Kindly provide the valid Keyword, category id, epid or gtin in query param
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.
@pajaydev That's perfect! I readded the !searchConfig.epid
condition and updated the error message with the text you provided! Let me know if there's anything more to be changed :)
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.
@rambonette Cool. Thanks I appreciate it.
Goal of the pull request:
Description
added the ability so search by epid in function 'searchItems'. It was stated in the repo's docs but there was no real way to do it using the auth flow.
marked both bugfix and enhancement because it's not a proper bug, but it's not an enhancement either since it was stated in the docs that 'searchItems' could search by ePID.
Details:
just two lines in 'src/buy-api.js'
if (!searchConfig.keyword && !searchConfig.categoryId && !searchConfig.gtin && !searchConfig.epid) throw new Error('Error --> Keyword or category id is required in query param');
queryParam = queryParam + (searchConfig.epid ? '&epid=' + searchConfig.epid : '');