Skip to content

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