Skip to content

feat: add google shopping offers (barcode → seller prices)#5

Merged
0xGhostCasper merged 1 commit into
mainfrom
feat/google-shopping-offers-barcode
Jun 29, 2026
Merged

feat: add google shopping offers (barcode → seller prices)#5
0xGhostCasper merged 1 commit into
mainfrom
feat/google-shopping-offers-barcode

Conversation

@0xGhostCasper

Copy link
Copy Markdown
Member

What

Adds a new method client.google.shopping.offers({ barcode, gl?, hl? }) that calls GET /v1/google/shopping/offers.

It resolves a product by barcode (GTIN-8/UPC-A/EAN-13/GTIN-14) via Google web search, then returns that product's multi-seller Google Shopping offers:

const res = await client.google.shopping.offers({ barcode: "0190198001751", gl: "us" });
// { barcode, resolved_query, product_title, offers: [{ title, source, price, link, rating, ... }] }
  • Costs 14 credits.
  • 422 for an invalid/checksum-failing barcode, 404 when the barcode can't be resolved.

Changes

  • src/google/shopping.ts — new offers() method, mirroring search/product/click.
  • src/google/types.ts — new ShoppingOffersParams interface (barcode required, gl?, hl?).
  • src/google/index.ts + src/index.ts — export ShoppingOffersParams.
  • tests/google.test.ts — unit test asserting the endpoint path and forwarded params.
  • docs/google.md, README.md, CHANGELOG.md — usage, method/credit tables, type list.
  • Version bump 0.15.20.15.3.

Responses stay typed as GoogleResponse (Record<string, unknown>) to match every other Google method in the SDK — the repo does not define concrete response interfaces.

Test plan

  • npm run typecheck — clean
  • npm run build — success
  • npm test — 211 passed (incl. new offers test)
  • npm run lint — 7 pre-existing errors in src/youtube/types.ts (untouched by this PR); no new lint issues introduced

Add client.google.shopping.offers({ barcode, gl?, hl? }) calling
GET /v1/google/shopping/offers — resolves a product by barcode
(GTIN-8/UPC-A/EAN-13/GTIN-14) and returns its multi-seller Google
Shopping offers. New ShoppingOffersParams type, exported from the
google and root barrels. Docs, README, CHANGELOG, and a unit test
mirror the existing shopping methods. Version 0.15.2 -> 0.15.3.
@0xGhostCasper
0xGhostCasper merged commit 2527d53 into main Jun 29, 2026
1 of 4 checks passed
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.

2 participants