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

search by ePID with Auth flow #140

Merged
merged 5 commits into from
May 3, 2021
Merged

Conversation

rambonette
Copy link
Contributor

Goal of the pull request:

  • Documentation
  • Bugfix
  • Feature (New!)
  • Enhancement

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'

  • 52

if (!searchConfig.keyword && !searchConfig.categoryId && !searchConfig.gtin && !searchConfig.epid) throw new Error('Error --> Keyword or category id is required in query param');

  • 61

queryParam = queryParam + (searchConfig.epid ? '&epid=' + searchConfig.epid : '');

@@ -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');
Copy link
Owner

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

Copy link
Contributor Author

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?

Copy link
Owner

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

Copy link
Contributor Author

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 :)

Copy link
Owner

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.

@rambonette rambonette requested a review from pajaydev May 1, 2021 12:34
@pajaydev pajaydev merged commit 361b40e into pajaydev:master May 3, 2021
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