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

feat: remove the necessity for amazonAdvertisingAPIClientId and amazonAdvertisingAPIScope on every api function call #51

Open
josh-fisher opened this issue Feb 1, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@josh-fisher
Copy link
Contributor

The autogenerated models contain request params for the API endpoints that most of the time take amazonAdvertisingAPIClientId and amazonAdvertisingAPIScope.

It would be great if this were somehow auto-populated by the API configuration that also accepts the same vars so that each API call does not have to have the same values applied, which can get quite verbose.

Current example code:

const result = await commonEligibilityClient.productEligibility({
  amazonAdvertisingAPIClientId: env.AMAZON_ADS_CLIENT_ID,
  amazonAdvertisingAPIScope: env.AMAZON_ADS_PROFILE_ID,
  productEligibilityRequest: product,
});

In our other library walmart-marketplace-api we attempted to solve this by destructuring these from a so-called defaultConfig.

const result = await commonEligibilityClient.productEligibility({
  ...defaultConfig,
  productEligibilityRequest: product,
});

However, this only partially solves the problem.

It would be great if we either somehow intercept these calls and populate the values or post-processed these files and add some sort of mixin or helper util for all the functions that require them.

@josh-fisher josh-fisher added the enhancement New feature or request label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant