Repository navigation
Add reports create, portfolios list, and file output for reports - #1
Merged
Merged
Conversation
- Update dependency versions: axios ^1.7.7, dotenv ^16.4.0, @types/node ^20.14.0, tsx ^4.18.0, typescript ^5.6.0, vitest ^2.1.0 - Add prettier dev dependency for code formatting - Update package.json metadata: author, repository, homepage, keywords - Add npm scripts: 'format' (prettier) and 'clean' - Fix vitest.config.ts coverage configuration to exclude only node_modules and dist - Create LICENSE file with MIT license text - Create .env.example with explanatory comments for required environment variables
Adds `reports create --type search-term|targeting|campaign` which builds a Sponsored Products v3 async report (spSearchTerm, spTargeting, spCampaigns) with 7-day attribution columns, polls until complete, and prints or writes the rows. `--daily` switches to one row per day, `--no-wait` returns the report ID, and `--out` writes CSV or JSON (by extension). `reports get` gains `--out`. Adds `portfolios list` so report rows can be joined to portfolio names. Client gains generic createReport, waitForReport, and getPortfolios methods; output gains a toCsv helper. The campaign preset omits portfolioId because the spCampaigns report type rejects it.
The lock file pinned vitest 4.1.0 while package.json asks for ^2.1.0, so npm ci failed in CI with missing and invalid entries. Regenerated with npm install; vitest resolves to 2.1.x and npm ci now succeeds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reports create --type search-term|targeting|campaign --start --endbuilds a Sponsored Products v3 async report (spSearchTerm / spTargeting / spCampaigns) with 7-day attribution columns, polls until complete, and prints or writes the rows.--dailygives one row per day,--no-waitreturns the report ID,--outwrites CSV or JSON by extension,--timeoutcaps the wait.reports getgains--out.portfolios listso report rows can be joined to portfolio names.createReport,waitForReport,getPortfolios;outputgainstoCsv.The campaign preset omits
portfolioIdbecause the spCampaigns report type rejects it; join oncampaignIdagainstcampaigns listinstead.Testing
npm run buildclean,npx vitest run31 passing (8 new inreports.test.ts: preset shapes, CSV escaping, create/no-wait, create with--out, bad preset, get with JSON out).