Skip to content

feat(ebay): search.searchByImage — eBay's own visual search - #33

Merged
0xGhostCasper merged 1 commit into
mainfrom
feat/ebay-search-by-image
Sep 4, 2026
Merged

feat(ebay): search.searchByImage — eBay's own visual search#33
0xGhostCasper merged 1 commit into
mainfrom
feat/ebay-search-by-image

Conversation

@0xGhostCasper

Copy link
Copy Markdown
Member

Adds client.ebay.search.searchByImage(...) for POST /v1/ebay/search/by-image — what eBay's camera icon does. 10 credits.

The method

const visual = await client.ebay.search.searchByImage({
  image_url: "https://example.com/sneaker.jpg",
  domain: "com",
  condition: "used",
  max_price: 200,
});

// or upload the picture yourself
const byUpload = await client.ebay.search.searchByImage({
  image_base64: readFileSync("./photo.jpg").toString("base64"),
});

The SDK's first eBay POST, so it follows the request(path, { method: "POST", body }) shape the web-scraping and YouTube-batch endpoints already use, and keeps the eBay module's snake_case parameter names.

Returns the same SearchResponse as search(), with query null.

Notes

  • Exactly one of image_url / image_base64. Neither or both throws an Error client-side, so the wrong shape costs no round trip and no credits — mirroring the server's own validator.
  • No sort_by. eBay ignores _sop on a visual results page, and a parameter that silently does nothing is worse than no parameter.
  • location and language ride along. The visual SRP honours both, so EbaySearchByImageParams exposes them via two new unions, EbayLocation and EbayLanguage.
  • EbayCondition gains graded / ungraded — eBay's trading-card conditions (slabbed vs raw). The scraper has accepted them on search, completed and by-image alike; the union here was stale, so this fixes every eBay method, not just the new one.
  • image_base64 takes a bare payload or a data:image/jpeg;base64,... URL. JPEG and PNG, at most 10 MB decoded.

Test plan

  • npm run typecheck — clean
  • npm run lint — clean
  • npm test — 279 passed (21 files); tests/ebay.test.ts 14 → 17
  • npm run build — ESM + CJS + DTS build success
  • New tests cover the POST target and JSON body, every filter passed through, sort_by never sent, and both bad-input shapes rejected before fetch is called

Docs: README.md eBay row and docs/ebay.md (sub-client table, param enums, a Search by Image section).

🤖 Generated with Claude Code

https://claude.ai/code/session_01RaAGmbLG3FotV7LFRkGhr3

POST /v1/ebay/search/by-image, the SDK's first eBay POST: the body carries
either image_url (a public http(s) URL the API downloads) or image_base64
(a bare JPEG/PNG payload or a data: URL), never both. The guard runs
client-side, so the wrong shape costs no round trip and no credits.

Returns the same SearchResponse as search(), with query null. No sort_by:
eBay ignores _sop on a visual results page, and a parameter that silently
does nothing is worse than no parameter.

Two filters the keyword endpoints do not expose yet ride along because the
visual SRP honours them: location (domestic|worldwide) and language
(english|japanese|chinese|korean).

EbayCondition also gains graded/ungraded — eBay's trading-card conditions.
The scraper has accepted them on search, completed and by-image alike; the
union here was simply stale, so every eBay method picks up the fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RaAGmbLG3FotV7LFRkGhr3
@0xGhostCasper
0xGhostCasper merged commit be841d7 into main Sep 4, 2026
4 checks passed
@0xGhostCasper
0xGhostCasper deleted the feat/ebay-search-by-image branch September 4, 2026 12:27
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