Skip to content

Conversation

@xavpaice
Copy link
Member

@xavpaice xavpaice commented Dec 3, 2025

  • Add listCustomersByEmail function to search customers by email address
  • Refactor listCustomersByName and listCustomersByEmail to share common searchCustomers helper function, eliminating code duplication
  • Fix API response parsing to use correct field names:
    • Use customers array instead of data
    • Use total_hits instead of total_count
  • Update all test mocks to match actual API response format
  • Add test script (examples/test-list-customers-by-name.ts) for debugging customer search functionality

The previous implementation was looking for data and total_count fields that the API never returns, causing searches to return empty results even when customers existed.

- Add `listCustomersByEmail` function to search customers by email address
- Refactor `listCustomersByName` and `listCustomersByEmail` to share common `searchCustomers` helper function, eliminating code duplication
- Fix API response parsing to use correct field names:
  - Use `customers` array instead of `data`
  - Use `total_hits` instead of `total_count`
- Update all test mocks to match actual API response format
- Add test script (`examples/test-list-customers-by-name.ts`) for debugging customer search functionality

The previous implementation was looking for `data` and `total_count` fields that the API never returns, causing searches to return empty results even when customers existed.
@xavpaice xavpaice merged commit 78d17b1 into main Dec 3, 2025
1 check passed
@xavpaice xavpaice deleted the xp/archive-by-email branch December 3, 2025 05:29
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.

3 participants