whitebox-co / walmart-marketplace-api

A fully typed TypeScript, Javascript, and Node.js API library for the Walmart Marketplace API
MIT License
25 stars 10 forks source link

feat: make all WM Headers Optional #163

Open josh-fisher opened 1 year ago

josh-fisher commented 1 year ago

The current generation takes a Walmart OpenApi spec and generates the required WM headers on every API function. This is due to how walmart has these required as part of each API call.

It would be great if we could update all these to optional using ts-morph after the generation is finished and then use interceptors to intercept each function call and add these in for the user automatically.

This would make so that we no longer have to do the following

await itemsApi.getAnItem({
    id: '4390580943850',
    productIdType: 'SKU',
    authorization: '',
    wMSECACCESSTOKEN: '',
    wMQOSCORRELATIONID: '',
    wMSVCNAME: ''
});

or

await itemsApi.getAnItem({
  ...defaultParams,
  id: '4390580943850',
  productIdType: 'SKU',
});

and can simply do

await itemsApi.getAnItem({
  id: '4390580943850',
  productIdType: 'SKU',
});