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

Update getSingleItem function #148

Merged
merged 1 commit into from
Oct 30, 2021
Merged

Update getSingleItem function #148

merged 1 commit into from
Oct 30, 2021

Conversation

EarthlingDavey
Copy link
Contributor

Update getSingleItem to accept object as parameter.

Goal of the pull request:

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

Description

This change allows for additional parameters to be passed to getSingleItem. For example in a similar way to getShippingCosts.

It can be used as before with a string of ItemID, backwards compatibility is preserved.

Also, an object may be passed, to add parameters refferenced in the eBay GetSingleItem docs

e.g.

ebay.getSingleItem({
      itemId: ebayId,
      includeSelector: 'Description',
});

Update `getSingleItem` to accept object as parameter.
@pajaydev pajaydev merged commit bd9ffe8 into pajaydev:master Oct 30, 2021
@EarthlingDavey
Copy link
Contributor Author

@pajaydev thanks for merging this in. I appreciate you maintaining this repo! 👊🏼✌🏼

@SteveMcArthur
Copy link

This actually seems to have broken the getSingleItem method as it seems to be expecting a parameter named "input" but the input is actually name "itemId". So the method call always fails.

const getSingleItem = function (itemId) {
    if (!input || (typeof input !== 'object' && typeof input !== 'string'))
        throw new Error('invalid_request_error -> Invalid input');
    // To preserve backwards compatibility
    if (typeof input === 'string') {
        input = { ItemID: input };
    }
  ...
};

@EarthlingDavey
Copy link
Contributor Author

Thanks @SteveMcArthur ... idk how I missed this. Probable tested on local then copy/pasted into the text editor on GitHub, lesson learned & patch PR just submitted.

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.

3 participants