@henrylabs/mcp 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/code-tool-worker.d.mts.map +1 -1
  2. package/code-tool-worker.d.ts.map +1 -1
  3. package/code-tool-worker.js +43 -2
  4. package/code-tool-worker.js.map +1 -1
  5. package/code-tool-worker.mjs +10 -2
  6. package/code-tool-worker.mjs.map +1 -1
  7. package/code-tool.d.mts.map +1 -1
  8. package/code-tool.d.ts.map +1 -1
  9. package/code-tool.js +6 -1
  10. package/code-tool.js.map +1 -1
  11. package/code-tool.mjs +6 -1
  12. package/code-tool.mjs.map +1 -1
  13. package/docs-search-tool.d.mts.map +1 -1
  14. package/docs-search-tool.d.ts.map +1 -1
  15. package/docs-search-tool.js +10 -11
  16. package/docs-search-tool.js.map +1 -1
  17. package/docs-search-tool.mjs +10 -11
  18. package/docs-search-tool.mjs.map +1 -1
  19. package/http.d.mts.map +1 -1
  20. package/http.d.ts.map +1 -1
  21. package/http.js +22 -0
  22. package/http.js.map +1 -1
  23. package/http.mjs +22 -0
  24. package/http.mjs.map +1 -1
  25. package/instructions.js +1 -1
  26. package/instructions.js.map +1 -1
  27. package/instructions.mjs +1 -1
  28. package/instructions.mjs.map +1 -1
  29. package/local-docs-search.d.mts.map +1 -1
  30. package/local-docs-search.d.ts.map +1 -1
  31. package/local-docs-search.js +350 -91
  32. package/local-docs-search.js.map +1 -1
  33. package/local-docs-search.mjs +350 -91
  34. package/local-docs-search.mjs.map +1 -1
  35. package/package.json +2 -2
  36. package/server.d.mts +5 -0
  37. package/server.d.mts.map +1 -1
  38. package/server.d.ts +5 -0
  39. package/server.d.ts.map +1 -1
  40. package/server.js +3 -1
  41. package/server.js.map +1 -1
  42. package/server.mjs +3 -1
  43. package/server.mjs.map +1 -1
  44. package/src/code-tool-worker.ts +10 -2
  45. package/src/code-tool.ts +6 -1
  46. package/src/docs-search-tool.ts +10 -18
  47. package/src/http.ts +25 -0
  48. package/src/instructions.ts +1 -1
  49. package/src/local-docs-search.ts +409 -97
  50. package/src/server.ts +5 -1
  51. package/src/types.ts +2 -0
  52. package/types.d.mts +5 -0
  53. package/types.d.mts.map +1 -1
  54. package/types.d.ts +5 -0
  55. package/types.d.ts.map +1 -1
  56. package/types.js.map +1 -1
  57. package/types.mjs.map +1 -1
@@ -4,17 +4,81 @@ import * as fs from 'node:fs/promises';
4
4
  import * as path from 'node:path';
5
5
  import { getLogger } from "./logger.mjs";
6
6
  const EMBEDDED_METHODS = [
7
+ {
8
+ name: 'search',
9
+ endpoint: '/product/search',
10
+ httpMethod: 'post',
11
+ summary: 'Product Search',
12
+ description: 'Search for products by text query or image input. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
13
+ stainlessPath: '(resource) products > (method) search',
14
+ qualified: 'client.products.search',
15
+ params: [
16
+ "{ query: string; searchType: 'text'; country?: string; cursor?: number; limit?: number; maxPrice?: number; merchant?: string; minPrice?: number; mode?: 'async' | 'sync'; sortBy?: 'lowToHigh' | 'highToLow'; } | { imageUrl: string; searchType: 'image'; country?: string; limit?: number; mode?: 'async' | 'sync'; };",
17
+ ],
18
+ response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; price?: object; sku?: string; variants?: object[]; }[]; }; }",
19
+ perLanguage: {
20
+ http: {
21
+ example: 'curl https://api.henrylabs.ai/v1/product/search \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "query": "Air Max Shoes",\n "searchType": "text",\n "country": "US",\n "limit": 20,\n "maxPrice": 100,\n "merchant": "Nike",\n "minPrice": 1,\n "mode": "async",\n "sortBy": "lowToHigh"\n }\'',
22
+ },
23
+ python: {
24
+ method: 'products.search',
25
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.products.search(\n query="Air Max Shoes",\n search_type="text",\n country="US",\n cursor=0,\n limit=40,\n max_price=100,\n merchant="Nike",\n min_price=1,\n mode="async",\n sort_by="lowToHigh",\n)\nprint(response.ref_id)',
26
+ },
27
+ typescript: {
28
+ method: 'client.products.search',
29
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.products.search({\n query: 'Air Max Shoes',\n searchType: 'text',\n country: 'US',\n limit: 40,\n maxPrice: 100,\n merchant: 'Nike',\n minPrice: 1,\n mode: 'async',\n sortBy: 'lowToHigh',\n});\n\nconsole.log(response.refId);",
30
+ },
31
+ },
32
+ },
33
+ {
34
+ name: 'poll_search',
35
+ endpoint: '/product/search/status',
36
+ httpMethod: 'get',
37
+ summary: 'Product Search Status',
38
+ description: 'Check the status of a product search retrieval job and get results when ready.',
39
+ stainlessPath: '(resource) products > (method) poll_search',
40
+ qualified: 'client.products.pollSearch',
41
+ params: ['refId: string;'],
42
+ response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; price?: object; sku?: string; variants?: object[]; }[]; }; }",
43
+ markdown: "## poll_search\n\n`client.products.pollSearch(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/product/search/status`\n\nCheck the status of a product search retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; price?: object; sku?: string; variants?: object[]; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; price?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.pollSearch({ refId: 'prs-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
44
+ perLanguage: {
45
+ http: {
46
+ example: 'curl https://api.henrylabs.ai/v1/product/search/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
47
+ },
48
+ python: {
49
+ method: 'products.poll_search',
50
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.products.poll_search(\n ref_id="prs-ref_3fa85f64-5717-4562-b3fc",\n)\nprint(response.ref_id)',
51
+ },
52
+ typescript: {
53
+ method: 'client.products.pollSearch',
54
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.products.pollSearch({ refId: 'prs-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response.refId);",
55
+ },
56
+ },
57
+ },
7
58
  {
8
59
  name: 'details',
9
60
  endpoint: '/product/details',
10
61
  httpMethod: 'post',
11
62
  summary: 'Product Details',
12
- description: 'Fetch detailed information about a product from a given URL.',
63
+ description: 'Fetch detailed information about a product from a given URL. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
13
64
  stainlessPath: '(resource) products > (method) details',
14
65
  qualified: 'client.products.details',
15
- params: ['link: string;', 'country?: string;', 'variant?: string | object;'],
16
- response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }; }",
17
- markdown: "## details\n\n`client.products.details(link: string, country?: string, variant?: string | object): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**post** `/product/details`\n\nFetch detailed information about a product from a given URL.\n\n### Parameters\n\n- `link: string`\n Direct product URL\n\n- `country?: string`\n\n- `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.details({ link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' });\n\nconsole.log(response);\n```",
66
+ params: ['link: string;', 'country?: string;', "mode?: 'async' | 'sync';", 'variant?: string | object;'],
67
+ response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }; }",
68
+ markdown: "## details\n\n`client.products.details(link: string, country?: string, mode?: 'async' | 'sync', variant?: string | object): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**post** `/product/details`\n\nFetch detailed information about a product from a given URL. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.\n\n### Parameters\n\n- `link: string`\n Direct product URL\n\n- `country?: string`\n Country code for the product's location\n\n- `mode?: 'async' | 'sync'`\n Response mode. Use sync to wait up to 30 seconds for the backing worker flow to complete.\n\n- `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.details({ link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' });\n\nconsole.log(response);\n```",
69
+ perLanguage: {
70
+ http: {
71
+ example: 'curl https://api.henrylabs.ai/v1/product/details \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "country": "US",\n "mode": "async",\n "variant": {\n "size": "bar",\n "color": "bar"\n }\n }\'',
72
+ },
73
+ python: {
74
+ method: 'products.details',
75
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.products.details(\n link="https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n country="US",\n mode="async",\n variant={\n "size": "10",\n "color": "Black",\n },\n)\nprint(response.ref_id)',
76
+ },
77
+ typescript: {
78
+ method: 'client.products.details',
79
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.products.details({\n link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',\n country: 'US',\n mode: 'async',\n variant: { size: '10', color: 'Black' },\n});\n\nconsole.log(response.refId);",
80
+ },
81
+ },
18
82
  },
19
83
  {
20
84
  name: 'poll_details',
@@ -25,41 +89,21 @@ const EMBEDDED_METHODS = [
25
89
  stainlessPath: '(resource) products > (method) poll_details',
26
90
  qualified: 'client.products.pollDetails',
27
91
  params: ['refId: string;'],
28
- response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }; }",
29
- markdown: "## poll_details\n\n`client.products.pollDetails(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/product/details/status`\n\nCheck the status of a product details retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.pollDetails({ refId: 'prd-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
30
- },
31
- {
32
- name: 'poll_search',
33
- endpoint: '/product/search/status',
34
- httpMethod: 'get',
35
- summary: 'Product Search Status',
36
- description: 'Check the status of a product search retrieval job and get results when ready.',
37
- stainlessPath: '(resource) products > (method) poll_search',
38
- qualified: 'client.products.pollSearch',
39
- params: ['refId: string;'],
40
- response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: object; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; variants?: object[]; }[]; }; }",
41
- markdown: "## poll_search\n\n`client.products.pollSearch(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/product/search/status`\n\nCheck the status of a product search retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: object; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; variants?: object[]; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.pollSearch({ refId: 'prs-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
42
- },
43
- {
44
- name: 'search',
45
- endpoint: '/product/search',
46
- httpMethod: 'post',
47
- summary: 'Text Product Search',
48
- description: 'Search for products using keyword and passing various filters and criteria',
49
- stainlessPath: '(resource) products > (method) search',
50
- qualified: 'client.products.search',
51
- params: [
52
- 'query: string;',
53
- 'country?: string;',
54
- 'cursor?: number;',
55
- 'limit?: number;',
56
- 'maxPrice?: number;',
57
- 'merchant?: string;',
58
- 'minPrice?: number;',
59
- "sortBy?: 'lowToHigh' | 'highToLow';",
60
- ],
61
- response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: object; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; variants?: object[]; }[]; }; }",
62
- markdown: "## search\n\n`client.products.search(query: string, country?: string, cursor?: number, limit?: number, maxPrice?: number, merchant?: string, minPrice?: number, sortBy?: 'lowToHigh' | 'highToLow'): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**post** `/product/search`\n\nSearch for products using keyword and passing various filters and criteria\n\n### Parameters\n\n- `query: string`\n Search query\n\n- `country?: string`\n\n- `cursor?: number`\n Cursor returned from the previous response\n\n- `limit?: number`\n Limit the number of results\n\n- `maxPrice?: number`\n Maximum price filter\n\n- `merchant?: string`\n Merchant to filter results\n\n- `minPrice?: number`\n Minimum price filter\n\n- `sortBy?: 'lowToHigh' | 'highToLow'`\n Sort by price: 'lowToHigh' or 'highToLow'\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: object; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: object[]; originalPrice?: object; variants?: object[]; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { pagination: { nextCursor: string; previousCursor: string; }; products: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; variants?: { name: string; sku: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; }[]; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.search({ query: 'Air Max Shoes' });\n\nconsole.log(response);\n```",
92
+ response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }; }",
93
+ markdown: "## poll_details\n\n`client.products.pollDetails(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/product/details/status`\n\nCheck the status of a product details retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { host: string; link: string; merchant: string; name: string; price: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; description?: string; images?: { url: string; isFeatured?: boolean; }[]; metadata?: object; originalPrice?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; sku?: string; variants?: { name: string; availability?: 'in_stock' | 'limited_stock' | 'out_of_stock' | 'preorder' | 'backorder'; sku?: string; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.products.pollDetails({ refId: 'prd-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
94
+ perLanguage: {
95
+ http: {
96
+ example: 'curl https://api.henrylabs.ai/v1/product/details/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
97
+ },
98
+ python: {
99
+ method: 'products.poll_details',
100
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.products.poll_details(\n ref_id="prd-ref_3fa85f64-5717-4562-b3fc",\n)\nprint(response.ref_id)',
101
+ },
102
+ typescript: {
103
+ method: 'client.products.pollDetails',
104
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.products.pollDetails({ refId: 'prd-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response.refId);",
105
+ },
106
+ },
63
107
  },
64
108
  {
65
109
  name: 'create',
@@ -71,11 +115,24 @@ const EMBEDDED_METHODS = [
71
115
  qualified: 'client.cart.create',
72
116
  params: [
73
117
  'items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[];',
74
- "settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; }; commissionFeePercent?: number; events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; };",
118
+ "settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; }; commissionFeePercent?: number; events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; };",
75
119
  'tags?: object;',
76
120
  ],
77
121
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
78
- markdown: "## create\n\n`client.cart.create(items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[], settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }, tags?: object): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart`\n\nCreate a cart with one or more items and get a checkout URL\n\n### Parameters\n\n- `items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]`\n Items to include in the cart\n\n- `settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; }; commissionFeePercent?: number; events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }`\n - `commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; }`\n - `commissionFeePercent?: number`\n Commission percentage (0–100)\n - `events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]`\n List of events to trigger during checkout\n - `options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }`\n\n- `tags?: object`\n Key-value tags to associate with the cart\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst cart = await client.cart.create({ items: [{ link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' }] });\n\nconsole.log(cart);\n```",
122
+ markdown: "## create\n\n`client.cart.create(items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[], settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }, tags?: object): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart`\n\nCreate a cart with one or more items and get a checkout URL\n\n### Parameters\n\n- `items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]`\n Items to include in the cart\n\n- `settings?: { commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; }; commissionFeePercent?: number; events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }`\n - `commissionFeeFixed?: { value: number; currency?: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; }`\n - `commissionFeePercent?: number`\n Commission percentage (0–100)\n - `events?: { data: { points: number; type: 'give_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'give_points_per_spent'; } | { points: number; type: 'remove_points_fixed'; } | { perAmount: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; points: number; type: 'remove_points_per_spent'; } | { tierUUID: string; type: 'give_tier'; } | { type: 'remove_tier'; } | { type: 'send_webhook'; webhookUUID: string; } | { type: 'send_email'; }[]; type: string; conditional?: { operator: 'equals' | 'not_equals'; type: 'tier'; value: string; } | { operator: string; type: 'points'; value: number; }; }[]`\n List of events to trigger during checkout\n - `options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }`\n\n- `tags?: object`\n Key-value tags to associate with the cart\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst cart = await client.cart.create({ items: [{ link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' }] });\n\nconsole.log(cart);\n```",
123
+ perLanguage: {
124
+ http: {
125
+ example: 'curl https://api.henrylabs.ai/v1/cart \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "items": [\n {\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "metadata": {\n "creatorSource": "bar"\n },\n "quantity": 2,\n "variant": {\n "size": "bar",\n "color": "bar"\n }\n }\n ]\n }\'',
126
+ },
127
+ python: {
128
+ method: 'cart.create',
129
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\ncart = client.cart.create(\n items=[{\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "quantity": 2,\n "variant": {\n "size": "10",\n "color": "Black",\n },\n "metadata": {\n "creatorSource": "Frank Herbert"\n },\n }],\n settings={\n "options": {\n "allow_partial_purchase": True,\n "collect_buyer_email": "required",\n "collect_buyer_address": "optional",\n "collect_buyer_phone": "off",\n },\n "commission_fee_fixed": {\n "value": 1.99,\n "currency": "USD",\n },\n "commission_fee_percent": 10,\n "events": [],\n },\n)\nprint(cart.data)',
130
+ },
131
+ typescript: {
132
+ method: 'client.cart.create',
133
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst cart = await client.cart.create({\n items: [\n {\n link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',\n quantity: 2,\n variant: { size: '10', color: 'Black' },\n metadata: { creatorSource: 'Frank Herbert' },\n },\n ],\n settings: {\n options: {\n allowPartialPurchase: true,\n collectBuyerEmail: 'required',\n collectBuyerAddress: 'optional',\n collectBuyerPhone: 'off',\n },\n commissionFeeFixed: { value: 1.99, currency: 'USD' },\n commissionFeePercent: 10,\n events: [],\n },\n});\n\nconsole.log(cart.data);",
134
+ },
135
+ },
79
136
  },
80
137
  {
81
138
  name: 'list',
@@ -87,7 +144,20 @@ const EMBEDDED_METHODS = [
87
144
  qualified: 'client.cart.list',
88
145
  params: ['cartId?: string;', 'cursor?: string;', 'limit?: number;', 'tags?: object;'],
89
146
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }[]; message: string; status: string; success: boolean; }',
90
- markdown: "## list\n\n`client.cart.list(cartId?: string, cursor?: string, limit?: number, tags?: object): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/cart`\n\nFetch a list of carts with optional filtering by cart ID or tags.\n\n### Parameters\n\n- `cartId?: string`\n Filter by a specific cart ID\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `limit?: number`\n Limit the number of results\n\n- `tags?: object`\n Filter carts by key-value tags\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst carts = await client.cart.list();\n\nconsole.log(carts);\n```",
147
+ markdown: "## list\n\n`client.cart.list(cartId?: string, cursor?: string, limit?: number, tags?: object): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/cart`\n\nFetch a list of carts with optional filtering by cart ID or tags.\n\n### Parameters\n\n- `cartId?: string`\n Filter by a specific cart ID\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `limit?: number`\n Limit the number of results\n\n- `tags?: object`\n Filter carts by key-value tags\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst carts = await client.cart.list();\n\nconsole.log(carts);\n```",
148
+ perLanguage: {
149
+ http: {
150
+ example: 'curl https://api.henrylabs.ai/v1/cart \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
151
+ },
152
+ python: {
153
+ method: 'cart.list',
154
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\ncarts = client.cart.list()\nprint(carts.data)',
155
+ },
156
+ typescript: {
157
+ method: 'client.cart.list',
158
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst carts = await client.cart.list();\n\nconsole.log(carts.data);",
159
+ },
160
+ },
91
161
  },
92
162
  {
93
163
  name: 'delete',
@@ -99,37 +169,76 @@ const EMBEDDED_METHODS = [
99
169
  qualified: 'client.cart.delete',
100
170
  params: ['cartId: string;'],
101
171
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
102
- markdown: "## delete\n\n`client.cart.delete(cartId: string): { data: object; message: string; status: string; success: boolean; }`\n\n**delete** `/cart/{cartId}`\n\nDelete a cart by its unique identifier\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst cart = await client.cart.delete('crt_sa2aEsCz9PRM');\n\nconsole.log(cart);\n```",
172
+ markdown: "## delete\n\n`client.cart.delete(cartId: string): { data: object; message: string; status: string; success: boolean; }`\n\n**delete** `/cart/{cartId}`\n\nDelete a cart by its unique identifier\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst cart = await client.cart.delete('crt_sa2aEsCz9PRM');\n\nconsole.log(cart);\n```",
173
+ perLanguage: {
174
+ http: {
175
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID \\\n -X DELETE \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
176
+ },
177
+ python: {
178
+ method: 'cart.delete',
179
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\ncart = client.cart.delete(\n "crt_sa2aEsCz9PRM",\n)\nprint(cart.data)',
180
+ },
181
+ typescript: {
182
+ method: 'client.cart.delete',
183
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst cart = await client.cart.delete('crt_sa2aEsCz9PRM');\n\nconsole.log(cart.data);",
184
+ },
185
+ },
103
186
  },
104
187
  {
105
- name: 'update',
188
+ name: 'add',
106
189
  endpoint: '/cart/{cartId}/item',
107
- httpMethod: 'put',
108
- summary: 'Cart Update Item',
109
- description: 'Update an item in an existing cart.',
110
- stainlessPath: '(resource) cart.item > (method) update',
111
- qualified: 'client.cart.item.update',
190
+ httpMethod: 'post',
191
+ summary: 'Cart Add Item',
192
+ description: 'Add an item to an existing cart.',
193
+ stainlessPath: '(resource) cart.item > (method) add',
194
+ qualified: 'client.cart.item.add',
112
195
  params: [
113
196
  'cartId: string;',
114
197
  'item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; };',
115
198
  ],
116
199
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
117
- markdown: "## update\n\n`client.cart.item.update(cartId: string, item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }): { data: object; message: string; status: string; success: boolean; }`\n\n**put** `/cart/{cartId}/item`\n\nUpdate an item in an existing cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }`\n Item to update\n - `link: string`\n Direct product URL\n - `coupons?: string[]`\n List of coupon codes applied to this cart item\n - `metadata?: object`\n Misc metadata associated with this cart item\n - `quantity?: number`\n Quantity of this item\n - `shippingOption?: { id?: string; value?: string; }`\n Shipping option selected for this cart item\n - `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst item = await client.cart.item.update('crt_sa2aEsCz9PRM', { item: { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' } });\n\nconsole.log(item);\n```",
200
+ markdown: "## add\n\n`client.cart.item.add(cartId: string, item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart/{cartId}/item`\n\nAdd an item to an existing cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }`\n Item to add to the cart (can be object or stringified JSON)\n - `link: string`\n Direct product URL\n - `coupons?: string[]`\n List of coupon codes applied to this cart item\n - `metadata?: object`\n Misc metadata associated with this cart item\n - `quantity?: number`\n Quantity of this item\n - `shippingOption?: { id?: string; value?: string; }`\n Shipping option selected for this cart item\n - `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.item.add('crt_sa2aEsCz9PRM', { item: { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' } });\n\nconsole.log(response);\n```",
201
+ perLanguage: {
202
+ http: {
203
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/item \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "item": {\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "metadata": {\n "creatorSource": "bar"\n },\n "quantity": 1,\n "variant": {\n "size": "bar",\n "color": "bar"\n }\n }\n }\'',
204
+ },
205
+ python: {
206
+ method: 'cart.item.add',
207
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.cart.item.add(\n cart_id="crt_sa2aEsCz9PRM",\n item={\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "quantity": 1,\n "variant": {\n "size": "10",\n "color": "Black",\n },\n "metadata": {\n "creatorSource": "Frank Herbert"\n },\n },\n)\nprint(response.data)',
208
+ },
209
+ typescript: {
210
+ method: 'client.cart.item.add',
211
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.cart.item.add('crt_sa2aEsCz9PRM', {\n item: {\n link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',\n quantity: 1,\n variant: { size: '10', color: 'Black' },\n metadata: { creatorSource: 'Frank Herbert' },\n },\n});\n\nconsole.log(response.data);",
212
+ },
213
+ },
118
214
  },
119
215
  {
120
- name: 'add',
216
+ name: 'update',
121
217
  endpoint: '/cart/{cartId}/item',
122
- httpMethod: 'post',
123
- summary: 'Cart Add Item',
124
- description: 'Add an item to an existing cart.',
125
- stainlessPath: '(resource) cart.item > (method) add',
126
- qualified: 'client.cart.item.add',
218
+ httpMethod: 'put',
219
+ summary: 'Cart Update Item',
220
+ description: 'Update an item in an existing cart.',
221
+ stainlessPath: '(resource) cart.item > (method) update',
222
+ qualified: 'client.cart.item.update',
127
223
  params: [
128
224
  'cartId: string;',
129
225
  'item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; };',
130
226
  ],
131
227
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
132
- markdown: "## add\n\n`client.cart.item.add(cartId: string, item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart/{cartId}/item`\n\nAdd an item to an existing cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }`\n Item to add to the cart\n - `link: string`\n Direct product URL\n - `coupons?: string[]`\n List of coupon codes applied to this cart item\n - `metadata?: object`\n Misc metadata associated with this cart item\n - `quantity?: number`\n Quantity of this item\n - `shippingOption?: { id?: string; value?: string; }`\n Shipping option selected for this cart item\n - `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.item.add('crt_sa2aEsCz9PRM', { item: { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' } });\n\nconsole.log(response);\n```",
228
+ markdown: "## update\n\n`client.cart.item.update(cartId: string, item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }): { data: object; message: string; status: string; success: boolean; }`\n\n**put** `/cart/{cartId}/item`\n\nUpdate an item in an existing cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }`\n Item to update (can be object or stringified JSON)\n - `link: string`\n Direct product URL\n - `coupons?: string[]`\n List of coupon codes applied to this cart item\n - `metadata?: object`\n Misc metadata associated with this cart item\n - `quantity?: number`\n Quantity of this item\n - `shippingOption?: { id?: string; value?: string; }`\n Shipping option selected for this cart item\n - `variant?: string | object`\n Variant selection. Can be a simple string or a key-value object\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst item = await client.cart.item.update('crt_sa2aEsCz9PRM', { item: { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' } });\n\nconsole.log(item);\n```",
229
+ perLanguage: {
230
+ http: {
231
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/item \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "item": {\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "metadata": {\n "creatorSource": "bar"\n },\n "quantity": 1,\n "variant": {\n "size": "bar",\n "color": "bar"\n }\n }\n }\'',
232
+ },
233
+ python: {
234
+ method: 'cart.item.update',
235
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nitem = client.cart.item.update(\n cart_id="crt_sa2aEsCz9PRM",\n item={\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n "quantity": 1,\n "variant": {\n "size": "10",\n "color": "Black",\n },\n "metadata": {\n "creatorSource": "Frank Herbert"\n },\n },\n)\nprint(item.data)',
236
+ },
237
+ typescript: {
238
+ method: 'client.cart.item.update',
239
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst item = await client.cart.item.update('crt_sa2aEsCz9PRM', {\n item: {\n link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',\n quantity: 1,\n variant: { size: '10', color: 'Black' },\n metadata: { creatorSource: 'Frank Herbert' },\n },\n});\n\nconsole.log(item.data);",
240
+ },
241
+ },
133
242
  },
134
243
  {
135
244
  name: 'remove',
@@ -141,24 +250,51 @@ const EMBEDDED_METHODS = [
141
250
  qualified: 'client.cart.item.remove',
142
251
  params: ['cartId: string;', 'link: string;'],
143
252
  response: '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
144
- markdown: "## remove\n\n`client.cart.item.remove(cartId: string, link: string): { data: object; message: string; status: string; success: boolean; }`\n\n**delete** `/cart/{cartId}/item`\n\nRemove an item from a cart by its unique identifier\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `link: string`\n Direct product URL\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst item = await client.cart.item.remove('crt_sa2aEsCz9PRM', { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' });\n\nconsole.log(item);\n```",
253
+ markdown: "## remove\n\n`client.cart.item.remove(cartId: string, link: string): { data: object; message: string; status: string; success: boolean; }`\n\n**delete** `/cart/{cartId}/item`\n\nRemove an item from a cart by its unique identifier\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `link: string`\n Direct product URL\n\n### Returns\n\n- `{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { cartId: string; checkoutUrl: string; data: { items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[]; settings?: { commissionFeeFixed?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; commissionFeePercent?: number; events?: { data: object | object | object | object | object | object | object | object[]; type: string; conditional?: object | object; }[]; options?: { allowPartialPurchase?: boolean; collectBuyerAddress?: 'off' | 'required' | 'optional'; collectBuyerEmail?: 'off' | 'required' | 'optional'; collectBuyerPhone?: 'off' | 'required' | 'optional'; }; }; tags?: object; }; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst item = await client.cart.item.remove('crt_sa2aEsCz9PRM', { link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205' });\n\nconsole.log(item);\n```",
254
+ perLanguage: {
255
+ http: {
256
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/item \\\n -X DELETE \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
257
+ },
258
+ python: {
259
+ method: 'cart.item.remove',
260
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nitem = client.cart.item.remove(\n cart_id="crt_sa2aEsCz9PRM",\n link="https://www.nike.com/u/custom-nike-ja-3-by-you-10002205",\n)\nprint(item.data)',
261
+ },
262
+ typescript: {
263
+ method: 'client.cart.item.remove',
264
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst item = await client.cart.item.remove('crt_sa2aEsCz9PRM', {\n link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',\n});\n\nconsole.log(item.data);",
265
+ },
266
+ },
145
267
  },
146
268
  {
147
269
  name: 'details',
148
270
  endpoint: '/cart/{cartId}/details',
149
271
  httpMethod: 'post',
150
272
  summary: 'Cart Details',
151
- description: 'Retrieve detailed information about a cart.',
273
+ description: 'Retrieve detailed information about a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
152
274
  stainlessPath: '(resource) cart.checkout > (method) details',
153
275
  qualified: 'client.cart.checkout.details',
154
276
  params: [
155
277
  'cartId: string;',
156
- 'buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; };',
278
+ 'buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; };',
157
279
  'coupons?: string[];',
158
280
  'metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; };',
281
+ "mode?: 'async' | 'sync';",
159
282
  ],
160
283
  response: "{ data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }[]; metadata?: object; }; message: string; status: string; success: boolean; }",
161
- markdown: "## details\n\n`client.cart.checkout.details(cartId: string, buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }, coupons?: string[], metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart/{cartId}/details`\n\nRetrieve detailed information about a cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }`\n - `shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }`\n\n- `coupons?: string[]`\n List of coupon codes applied to the cart\n\n- `metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }`\n Additional metadata for the request\n - `botAuth?: { forterToken?: string; }`\n Bot authentication credentials\n - `userData?: { ipAddress?: string; userAgent?: string; }`\n User identity and device information\n\n### Returns\n\n- `{ data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }[]; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }[]; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', { buyer: { shippingAddress: {\n city: 'Anytown',\n countryCode: 'US',\n line1: '123 Main St',\n postalCode: '12345',\n province: 'CA',\n} } });\n\nconsole.log(response);\n```",
284
+ markdown: "## details\n\n`client.cart.checkout.details(cartId: string, buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }, coupons?: string[], metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }, mode?: 'async' | 'sync'): { data: object; message: string; status: string; success: boolean; }`\n\n**post** `/cart/{cartId}/details`\n\nRetrieve detailed information about a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }`\n - `shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }`\n Shipping address for the cart\n\n- `coupons?: string[]`\n List of coupon codes applied to the cart\n\n- `metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }`\n Additional metadata for the request\n - `botAuth?: { forterToken?: string; }`\n Bot authentication credentials\n - `userData?: { ipAddress?: string; userAgent?: string; }`\n User identity and device information\n\n- `mode?: 'async' | 'sync'`\n Response mode. Use sync to wait up to 30 seconds for the backing worker flow to complete.\n\n### Returns\n\n- `{ data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }[]; metadata?: object; }; message: string; status: string; success: boolean; }`\n\n - `data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }[]; metadata?: object; }`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', { buyer: { shippingAddress: {\n city: 'Anytown',\n countryCode: 'US',\n line1: '123 Main St',\n postalCode: '12345',\n province: 'CA',\n} } });\n\nconsole.log(response);\n```",
285
+ perLanguage: {
286
+ http: {
287
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/details \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "buyer": {\n "shippingAddress": {\n "city": "Anytown",\n "countryCode": "US",\n "line1": "123 Main St",\n "postalCode": "12345",\n "province": "CA",\n "line2": "Apt 4B"\n }\n },\n "coupons": [\n "SUMMER21",\n "FREESHIP"\n ],\n "mode": "async"\n }\'',
288
+ },
289
+ python: {
290
+ method: 'cart.checkout.details',
291
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.cart.checkout.details(\n cart_id="crt_sa2aEsCz9PRM",\n buyer={\n "shipping_address": {\n "line1": "123 Main St",\n "line2": "Apt 4B",\n "city": "Anytown",\n "province": "CA",\n "postal_code": "12345",\n "country_code": "US",\n }\n },\n coupons=["SUMMER21", "FREESHIP"],\n mode="async",\n)\nprint(response.data)',
292
+ },
293
+ typescript: {
294
+ method: 'client.cart.checkout.details',
295
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', {\n buyer: {\n shippingAddress: {\n line1: '123 Main St',\n line2: 'Apt 4B',\n city: 'Anytown',\n province: 'CA',\n postalCode: '12345',\n countryCode: 'US',\n },\n },\n coupons: ['SUMMER21', 'FREESHIP'],\n mode: 'async',\n});\n\nconsole.log(response.data);",
296
+ },
297
+ },
162
298
  },
163
299
  {
164
300
  name: 'poll_details',
@@ -170,37 +306,77 @@ const EMBEDDED_METHODS = [
170
306
  qualified: 'client.cart.checkout.pollDetails',
171
307
  params: ['refId: string;'],
172
308
  response: "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }",
173
- markdown: "## poll_details\n\n`client.cart.checkout.pollDetails(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/cart/checkout/status`\n\nCheck the status of a cart details retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { items: { costs: { subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; shippingOptions: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }[]; coupons?: { available: boolean; code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }[]; metadata?: object; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.pollDetails({ refId: 'ckd-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
174
- },
175
- {
176
- name: 'poll_purchase',
177
- endpoint: '/cart/purchase/status',
178
- httpMethod: 'get',
179
- summary: 'Cart Purchase Status',
180
- description: 'Check the status of a cart purchase job and get results when ready.',
181
- stainlessPath: '(resource) cart.checkout > (method) poll_purchase',
182
- qualified: 'client.cart.checkout.pollPurchase',
183
- params: ['refId: string;'],
184
- response: "{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }",
185
- markdown: "## poll_purchase\n\n`client.cart.checkout.pollPurchase(refId: string): { details: object; products: object[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: object; }`\n\n**get** `/cart/purchase/status`\n\nCheck the status of a cart purchase job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }`\n\n - `details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }`\n - `products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]`\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'cancelled'`\n - `error?: object`\n - `result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; items: { confirmationNumber: string; costs: { total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; subtotal?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; metadata?: object; shippingOption?: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.pollPurchase({ refId: 'ckp-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
309
+ markdown: "## poll_details\n\n`client.cart.checkout.pollDetails(refId: string): { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }`\n\n**get** `/cart/checkout/status`\n\nCheck the status of a cart details retrieval job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }`\n\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'failed'`\n - `error?: object`\n - `result?: { items: { costs: { subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; shippingOptions: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }[]; coupons?: { available: boolean; code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }[]; metadata?: object; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.pollDetails({ refId: 'ckd-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
310
+ perLanguage: {
311
+ http: {
312
+ example: 'curl https://api.henrylabs.ai/v1/cart/checkout/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
313
+ },
314
+ python: {
315
+ method: 'cart.checkout.poll_details',
316
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.cart.checkout.poll_details(\n ref_id="ckd-ref_3fa85f64-5717-4562-b3fc",\n)\nprint(response.ref_id)',
317
+ },
318
+ typescript: {
319
+ method: 'client.cart.checkout.pollDetails',
320
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.cart.checkout.pollDetails({\n refId: 'ckd-ref_3fa85f64-5717-4562-b3fc',\n});\n\nconsole.log(response.refId);",
321
+ },
322
+ },
186
323
  },
187
324
  {
188
325
  name: 'purchase',
189
326
  endpoint: '/cart/{cartId}/purchase',
190
327
  httpMethod: 'post',
191
328
  summary: 'Cart Purchase',
192
- description: 'Initiate the purchase process for a cart.',
329
+ description: 'Initiate the purchase process for a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
193
330
  stainlessPath: '(resource) cart.checkout > (method) purchase',
194
331
  qualified: 'client.cart.checkout.purchase',
195
332
  params: [
196
333
  'cartId: string;',
197
- 'buyer: { card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; phone?: string; };',
334
+ 'buyer: { card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; phone?: string; };',
198
335
  'metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; };',
336
+ "mode?: 'async' | 'sync';",
199
337
  'overrideProducts?: object;',
200
338
  'settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; };',
201
339
  ],
202
- response: "{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }",
203
- markdown: "## purchase\n\n`client.cart.checkout.purchase(cartId: string, buyer: { card: { details: object; billingAddress?: object; nameOnCard?: object; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; phone?: string; }, metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }, overrideProducts?: object, settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }): { details: object; products: object[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: object; }`\n\n**post** `/cart/{cartId}/purchase`\n\nInitiate the purchase process for a cart.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `buyer: { card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; phone?: string; }`\n - `card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }`\n - `email: string`\n Buyer's email address\n - `name: { firstName: string; lastName: string; middleName?: string; }`\n Buyer's full name\n - `shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }`\n - `phone?: string`\n Buyer's phone number\n\n- `metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }`\n Additional metadata for the request\n - `botAuth?: { forterToken?: string; }`\n Bot authentication credentials\n - `userData?: { ipAddress?: string; userAgent?: string; }`\n User identity and device information\n\n- `overrideProducts?: object`\n Override quantity for a specific product URL\n\n- `settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }`\n Settings for what information to collect\n - `collectAddress?: boolean`\n Whether to collect the buyer's shipping address\n - `collectEmail?: boolean`\n Whether to collect the buyer's email address\n - `collectPhone?: boolean`\n Whether to collect the buyer's phone number\n\n### Returns\n\n- `{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }`\n\n - `details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }`\n - `products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]`\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'cancelled'`\n - `error?: object`\n - `result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; items: { confirmationNumber: string; costs: { total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; subtotal?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; metadata?: object; shippingOption?: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.purchase('crt_sa2aEsCz9PRM', { buyer: {\n card: { details: { cardToken: 'card_live_SimDpKU9cmU7tvdUXHzOeLudtgfadQVnbof' } },\n email: 'johnadoe@example.com',\n name: { firstName: 'John', lastName: 'Doe' },\n shippingAddress: {\n city: 'Anytown',\n countryCode: 'US',\n line1: '123 Main St',\n postalCode: '12345',\n province: 'CA',\n},\n} });\n\nconsole.log(response);\n```",
340
+ response: "{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }",
341
+ markdown: "## purchase\n\n`client.cart.checkout.purchase(cartId: string, buyer: { card: { details: object; billingAddress?: object; nameOnCard?: object; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; phone?: string; }, metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }, mode?: 'async' | 'sync', overrideProducts?: object, settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }): { details: object; products: object[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: object; }`\n\n**post** `/cart/{cartId}/purchase`\n\nInitiate the purchase process for a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.\n\n### Parameters\n\n- `cartId: string`\n Unique identifier for the cart\n\n- `buyer: { card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }; email: string; name: { firstName: string; lastName: string; middleName?: string; }; shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; phone?: string; }`\n - `card: { details: { cardToken: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; nameOnCard?: { firstName: string; lastName: string; middleName?: string; }; }`\n - `email: string`\n Buyer's email address\n - `name: { firstName: string; lastName: string; middleName?: string; }`\n Buyer's full name\n - `shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }`\n Shipping address for the cart\n - `phone?: string`\n Buyer's phone number\n\n- `metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; }`\n Additional metadata for the request\n - `botAuth?: { forterToken?: string; }`\n Bot authentication credentials\n - `userData?: { ipAddress?: string; userAgent?: string; }`\n User identity and device information\n\n- `mode?: 'async' | 'sync'`\n Response mode. Use sync to wait up to 30 seconds for the backing worker flow to complete.\n\n- `overrideProducts?: object`\n Override quantity for a specific product URL\n\n- `settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }`\n Settings for what information to collect\n - `collectAddress?: boolean`\n Whether to collect the buyer's shipping address\n - `collectEmail?: boolean`\n Whether to collect the buyer's email address\n - `collectPhone?: boolean`\n Whether to collect the buyer's phone number\n\n### Returns\n\n- `{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }`\n\n - `details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }`\n - `products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]`\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'cancelled'`\n - `error?: object`\n - `result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; items: { confirmationNumber: string; costs: { total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; subtotal?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; metadata?: object; shippingOption?: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.purchase('crt_sa2aEsCz9PRM', { buyer: {\n card: { details: { cardToken: 'card_live_SimDpKU9cmU7tvdUXHzOeLudtgfadQVnbof' } },\n email: 'johnadoe@example.com',\n name: { firstName: 'John', lastName: 'Doe' },\n shippingAddress: {\n city: 'Anytown',\n countryCode: 'US',\n line1: '123 Main St',\n postalCode: '12345',\n province: 'CA',\n},\n} });\n\nconsole.log(response);\n```",
342
+ perLanguage: {
343
+ http: {
344
+ example: 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/purchase \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $HENRY_SDK_API_KEY" \\\n -d \'{\n "buyer": {\n "card": {\n "details": {\n "cardToken": "card_live_SimDpKU9cmU7tvdUXHzOeLudtgfadQVnbof"\n },\n "billingAddress": {\n "city": "Anytown",\n "countryCode": "US",\n "line1": "123 Main St",\n "postalCode": "12345",\n "province": "CA",\n "line2": "Apt 4B"\n },\n "nameOnCard": {\n "firstName": "John",\n "lastName": "Doe",\n "middleName": "A."\n }\n },\n "email": "johnadoe@example.com",\n "name": {\n "firstName": "John",\n "lastName": "Doe",\n "middleName": "A."\n },\n "shippingAddress": {\n "city": "Anytown",\n "countryCode": "US",\n "line1": "123 Main St",\n "postalCode": "12345",\n "province": "CA",\n "line2": "Apt 4B"\n },\n "phone": "+1234567890"\n },\n "mode": "async"\n }\'',
345
+ },
346
+ python: {
347
+ method: 'cart.checkout.purchase',
348
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.cart.checkout.purchase(\n cart_id="crt_sa2aEsCz9PRM",\n buyer={\n "name": {\n "first_name": "John",\n "middle_name": "A.",\n "last_name": "Doe",\n },\n "email": "johnadoe@example.com",\n "phone": "+1234567890",\n "shipping_address": {\n "line1": "123 Main St",\n "line2": "Apt 4B",\n "city": "Anytown",\n "province": "CA",\n "postal_code": "12345",\n "country_code": "US",\n },\n "card": {\n "name_on_card": {\n "first_name": "John",\n "middle_name": "A.",\n "last_name": "Doe",\n },\n "details": {\n "card_token": "card_live_SimDpKU9cmU7tvdUXHzOeLudtgfadQVnbof"\n },\n "billing_address": {\n "line1": "123 Main St",\n "line2": "Apt 4B",\n "city": "Anytown",\n "province": "CA",\n "postal_code": "12345",\n "country_code": "US",\n },\n },\n },\n mode="async",\n)\nprint(response.details)',
349
+ },
350
+ typescript: {
351
+ method: 'client.cart.checkout.purchase',
352
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.cart.checkout.purchase('crt_sa2aEsCz9PRM', {\n buyer: {\n name: {\n firstName: 'John',\n middleName: 'A.',\n lastName: 'Doe',\n },\n email: 'johnadoe@example.com',\n phone: '+1234567890',\n shippingAddress: {\n line1: '123 Main St',\n line2: 'Apt 4B',\n city: 'Anytown',\n province: 'CA',\n postalCode: '12345',\n countryCode: 'US',\n },\n card: {\n nameOnCard: {\n firstName: 'John',\n middleName: 'A.',\n lastName: 'Doe',\n },\n details: { cardToken: 'card_live_SimDpKU9cmU7tvdUXHzOeLudtgfadQVnbof' },\n billingAddress: {\n line1: '123 Main St',\n line2: 'Apt 4B',\n city: 'Anytown',\n province: 'CA',\n postalCode: '12345',\n countryCode: 'US',\n },\n },\n },\n mode: 'async',\n});\n\nconsole.log(response.details);",
353
+ },
354
+ },
355
+ },
356
+ {
357
+ name: 'poll_purchase',
358
+ endpoint: '/cart/purchase/status',
359
+ httpMethod: 'get',
360
+ summary: 'Cart Purchase Status',
361
+ description: 'Check the status of a cart purchase job and get results when ready.',
362
+ stainlessPath: '(resource) cart.checkout > (method) poll_purchase',
363
+ qualified: 'client.cart.checkout.pollPurchase',
364
+ params: ['refId: string;'],
365
+ response: "{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }",
366
+ markdown: "## poll_purchase\n\n`client.cart.checkout.pollPurchase(refId: string): { details: object; products: object[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: object; }`\n\n**get** `/cart/purchase/status`\n\nCheck the status of a cart purchase job and get results when ready.\n\n### Parameters\n\n- `refId: string`\n Reference ID used for checking status\n\n### Returns\n\n- `{ details: { card: { details: object; nameOnCard: object; billingAddress?: object; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: object; subtotal: object; total: object; }; items: { confirmationNumber: string; costs: object; productLink: string; appliedCoupon?: object; metadata?: object; shippingOption?: object; }[]; }; }`\n\n - `details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }`\n - `products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]`\n - `refId: string`\n - `status: 'pending' | 'processing' | 'complete' | 'cancelled'`\n - `error?: object`\n - `result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; items: { confirmationNumber: string; costs: { total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; discount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; shipping?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; subtotal?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; tax?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; metadata?: object; shippingOption?: { id: string; cost: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst response = await client.cart.checkout.pollPurchase({ refId: 'ckp-ref_3fa85f64-5717-4562-b3fc' });\n\nconsole.log(response);\n```",
367
+ perLanguage: {
368
+ http: {
369
+ example: 'curl https://api.henrylabs.ai/v1/cart/purchase/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
370
+ },
371
+ python: {
372
+ method: 'cart.checkout.poll_purchase',
373
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.cart.checkout.poll_purchase(\n ref_id="ckp-ref_3fa85f64-5717-4562-b3fc",\n)\nprint(response.details)',
374
+ },
375
+ typescript: {
376
+ method: 'client.cart.checkout.pollPurchase',
377
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.cart.checkout.pollPurchase({\n refId: 'ckp-ref_3fa85f64-5717-4562-b3fc',\n});\n\nconsole.log(response.details);",
378
+ },
379
+ },
204
380
  },
205
381
  {
206
382
  name: 'list',
@@ -217,7 +393,20 @@ const EMBEDDED_METHODS = [
217
393
  "status?: 'pending' | 'processing' | 'complete' | 'cancelled';",
218
394
  ],
219
395
  response: "{ data: { details: { card: object; hasAccount: boolean; name: object; email?: string; phone?: object; settings?: object; shippingAddress?: object; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: object; items: object[]; }; }[]; message: string; status: string; success: boolean; }",
220
- markdown: "## list\n\n`client.orders.list(cartId?: string, cursor?: string, limit?: number, status?: 'pending' | 'processing' | 'complete' | 'cancelled'): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/orders`\n\nFetch a list of orders with optional filtering and pagination.\n\n### Parameters\n\n- `cartId?: string`\n Filter orders by cart ID\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `limit?: number`\n Limit the number of results\n\n- `status?: 'pending' | 'processing' | 'complete' | 'cancelled'`\n Filter orders by status\n\n### Returns\n\n- `{ data: { details: { card: object; hasAccount: boolean; name: object; email?: string; phone?: object; settings?: object; shippingAddress?: object; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: object; items: object[]; }; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN'; value: number; }; }; items: { confirmationNumber: string; costs: { total: object; discount?: object; shipping?: object; subtotal?: object; tax?: object; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: object; }; metadata?: object; shippingOption?: { id: string; cost: object; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst orders = await client.orders.list();\n\nconsole.log(orders);\n```",
396
+ markdown: "## list\n\n`client.orders.list(cartId?: string, cursor?: string, limit?: number, status?: 'pending' | 'processing' | 'complete' | 'cancelled'): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/orders`\n\nFetch a list of orders with optional filtering and pagination.\n\n### Parameters\n\n- `cartId?: string`\n Filter orders by cart ID\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `limit?: number`\n Limit the number of results\n\n- `status?: 'pending' | 'processing' | 'complete' | 'cancelled'`\n Filter orders by status\n\n### Returns\n\n- `{ data: { details: { card: object; hasAccount: boolean; name: object; email?: string; phone?: object; settings?: object; shippingAddress?: object; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: object; items: object[]; }; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { details: { card: { details: object; nameOnCard: { firstName: string; lastName: string; middleName?: string; }; billingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: object; phone?: object; }; }; hasAccount: boolean; name: { firstName: string; lastName: string; middleName?: string; }; email?: string; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; }; shippingAddress?: { city: string; countryCode: string; line1: string; postalCode: string; province: string; email?: string; line2?: string; name?: { firstName: string; lastName: string; middleName?: string; }; phone?: { countryCode: string; e164: string; nationalNumber: string; country?: string; }; }; }; products: { host: string; link: string; merchant: string; quantity: number; status: 'pending' | 'processing' | 'complete' | 'failed'; metadata?: object; variant?: string | object; }[]; refId: string; status: 'pending' | 'processing' | 'complete' | 'cancelled'; error?: object; result?: { costs: { commissionFee: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; subtotal: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; total: { currency: 'USD' | 'EUR' | 'AUD' | 'SGD' | 'TWD' | 'GBP' | 'CAD' | 'MXN' | 'NPR'; value: number; }; }; items: { confirmationNumber: string; costs: { total: object; discount?: object; shipping?: object; subtotal?: object; tax?: object; }; productLink: string; appliedCoupon?: { code: string; savedAmount?: object; }; metadata?: object; shippingOption?: { id: string; cost: object; name: string; maxDate?: string; minDate?: string; timeEstimate?: string; }; }[]; }; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst orders = await client.orders.list();\n\nconsole.log(orders);\n```",
397
+ perLanguage: {
398
+ http: {
399
+ example: 'curl https://api.henrylabs.ai/v1/orders \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
400
+ },
401
+ python: {
402
+ method: 'orders.list',
403
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\norders = client.orders.list()\nprint(orders.data)',
404
+ },
405
+ typescript: {
406
+ method: 'client.orders.list',
407
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst orders = await client.orders.list();\n\nconsole.log(orders.data);",
408
+ },
409
+ },
221
410
  },
222
411
  {
223
412
  name: 'list',
@@ -235,7 +424,30 @@ const EMBEDDED_METHODS = [
235
424
  'name?: string;',
236
425
  ],
237
426
  response: '{ data: { categories: string[]; description: string; host: string; logo: { urls: object[]; }; name: string; website: { urls: object[]; }; }[]; message: string; status: string; success: boolean; }',
238
- markdown: "## list\n\n`client.merchants.list(categories?: string[], cursor?: string, host?: string, limit?: number, name?: string): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/merchants`\n\nFetch a list of merchants with optional filtering and pagination.\n\n### Parameters\n\n- `categories?: string[]`\n Filter merchants by categories\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `host?: string`\n Filter merchants by host\n\n- `limit?: number`\n Limit the number of results\n\n- `name?: string`\n Filter merchants by name (partial match)\n\n### Returns\n\n- `{ data: { categories: string[]; description: string; host: string; logo: { urls: object[]; }; name: string; website: { urls: object[]; }; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { categories: string[]; description: string; host: string; logo: { urls: { value: string; }[]; }; name: string; website: { urls: { value: string; type?: 'landing' | 'checkout'; }[]; }; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst merchants = await client.merchants.list();\n\nconsole.log(merchants);\n```",
427
+ markdown: "## list\n\n`client.merchants.list(categories?: string[], cursor?: string, host?: string, limit?: number, name?: string): { data: object[]; message: string; status: string; success: boolean; }`\n\n**get** `/merchants`\n\nFetch a list of merchants with optional filtering and pagination.\n\n### Parameters\n\n- `categories?: string[]`\n\n- `cursor?: string`\n Cursor returned from the previous response\n\n- `host?: string`\n Filter merchants by host\n\n- `limit?: number`\n Limit the number of results\n\n- `name?: string`\n Filter merchants by name (partial match)\n\n### Returns\n\n- `{ data: { categories: string[]; description: string; host: string; logo: { urls: object[]; }; name: string; website: { urls: object[]; }; }[]; message: string; status: string; success: boolean; }`\n\n - `data: { categories: string[]; description: string; host: string; logo: { urls: { value: string; }[]; }; name: string; website: { urls: { value: string; type?: 'landing' | 'checkout'; }[]; }; }[]`\n - `message: string`\n - `status: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK();\n\nconst merchants = await client.merchants.list();\n\nconsole.log(merchants);\n```",
428
+ perLanguage: {
429
+ http: {
430
+ example: 'curl https://api.henrylabs.ai/v1/merchants \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
431
+ },
432
+ python: {
433
+ method: 'merchants.list',
434
+ example: 'import os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\nmerchants = client.merchants.list()\nprint(merchants.data)',
435
+ },
436
+ typescript: {
437
+ method: 'client.merchants.list',
438
+ example: "import HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst merchants = await client.merchants.list();\n\nconsole.log(merchants.data);",
439
+ },
440
+ },
441
+ },
442
+ ];
443
+ const EMBEDDED_READMES = [
444
+ {
445
+ language: 'python',
446
+ content: '# Henry SDK Python API library\n\n<!-- prettier-ignore -->\n[![PyPI version](https://img.shields.io/pypi/v/henrylabs.svg?label=pypi%20(stable))](https://pypi.org/project/henrylabs/)\n\nThe Henry SDK Python library provides convenient access to the Henry SDK REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Henry SDK MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40henrylabs%2Fmcp&config=eyJuYW1lIjoiQGhlbnJ5bGFicy9tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9oZW5yeS1zZGsuc3RsbWNwLmNvbSIsImhlYWRlcnMiOnsieC1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40henrylabs%2Fmcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fhenry-sdk.stlmcp.com%22%2C%22headers%22%3A%7B%22x-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [docs.henrylabs.ai](https://docs.henrylabs.ai/). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install henrylabs\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\n\nresponse = client.products.search(\n image_url="https://static.nike.com/a/images/t_web_pdp_535_v2/f_auto/example.png",\n search_type="image",\n country="US",\n limit=10,\n)\nprint(response.ref_id)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `HENRY_SDK_API_KEY="My API Key"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncHenrySDK` instead of `HenrySDK` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom henry_sdk import AsyncHenrySDK\n\nclient = AsyncHenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n response = await client.products.search(\n image_url="https://static.nike.com/a/images/t_web_pdp_535_v2/f_auto/example.png",\n search_type="image",\n country="US",\n limit=10,\n )\n print(response.ref_id)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install henrylabs[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom henry_sdk import DefaultAioHttpClient\nfrom henry_sdk import AsyncHenrySDK\n\nasync def main() -> None:\n async with AsyncHenrySDK(\n api_key=os.environ.get("HENRY_SDK_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.products.search(\n image_url="https://static.nike.com/a/images/t_web_pdp_535_v2/f_auto/example.png",\n search_type="image",\n country="US",\n limit=10,\n )\n print(response.ref_id)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK()\n\ncart = client.cart.create(\n items=[{\n "link": "https://www.nike.com/u/custom-nike-ja-3-by-you-10002205"\n }],\n settings={\n "commission_fee_fixed": {\n "value": 1.99,\n "currency": "USD",\n },\n "commission_fee_percent": 10,\n "events": [{\n "data": [{\n "points": 0,\n "type": "give_points_fixed",\n }],\n "type": "order",\n }],\n "options": {\n "allow_partial_purchase": True,\n "collect_buyer_address": "optional",\n "collect_buyer_email": "required",\n "collect_buyer_phone": "off",\n },\n },\n)\nprint(cart.settings)\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `henry_sdk.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `henry_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `henry_sdk.APIError`.\n\n```python\nimport henry_sdk\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK()\n\ntry:\n client.products.search(\n query="Nike Air Max",\n search_type="text",\n )\nexcept henry_sdk.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept henry_sdk.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept henry_sdk.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom henry_sdk import HenrySDK\n\n# Configure the default for all requests:\nclient = HenrySDK(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).products.search(\n query="Nike Air Max",\n search_type="text",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom henry_sdk import HenrySDK\n\n# Configure the default for all requests:\nclient = HenrySDK(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = HenrySDK(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).products.search(\n query="Nike Air Max",\n search_type="text",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `HENRY_SDK_LOG` to `info`.\n\n```shell\n$ export HENRY_SDK_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom henry_sdk import HenrySDK\n\nclient = HenrySDK()\nresponse = client.products.with_raw_response.search(\n query="Nike Air Max",\n search_type="text",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nproduct = response.parse() # get the object that `products.search()` would have returned\nprint(product.ref_id)\n```\n\nThese methods return an [`APIResponse`](https://github.com/Henry-Social/henry-sdk-py/tree/main/src/henry_sdk/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/Henry-Social/henry-sdk-py/tree/main/src/henry_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.products.with_streaming_response.search(\n query="Nike Air Max",\n search_type="text",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom henry_sdk import HenrySDK, DefaultHttpxClient\n\nclient = HenrySDK(\n # Or use the `HENRY_SDK_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom henry_sdk import HenrySDK\n\nwith HenrySDK() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Henry-Social/henry-sdk-py/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport henry_sdk\nprint(henry_sdk.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
447
+ },
448
+ {
449
+ language: 'typescript',
450
+ content: "# Henry SDK TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/@henrylabs/sdk.svg?label=npm%20(stable))](https://npmjs.org/package/@henrylabs/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@henrylabs/sdk)\n\nThis library provides convenient access to the Henry SDK REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.henrylabs.ai](https://docs.henrylabs.ai/). The full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Henry SDK MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40henrylabs%2Fmcp&config=eyJuYW1lIjoiQGhlbnJ5bGFicy9tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9oZW5yeS1zZGsuc3RsbWNwLmNvbSIsImhlYWRlcnMiOnsieC1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40henrylabs%2Fmcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fhenry-sdk.stlmcp.com%22%2C%22headers%22%3A%7B%22x-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @henrylabs/sdk\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n<!-- prettier-ignore -->\n```js\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.products.search({\n imageUrl: 'https://static.nike.com/a/images/t_web_pdp_535_v2/f_auto/example.png',\n searchType: 'image',\n country: 'US',\n limit: 10,\n});\n\nconsole.log(response.refId);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n<!-- prettier-ignore -->\n```ts\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted\n});\n\nconst params: HenrySDK.ProductSearchParams = { query: 'Nike Air Max', searchType: 'text' };\nconst response: HenrySDK.ProductSearchResponse = await client.products.search(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n<!-- prettier-ignore -->\n```ts\nconst response = await client.products\n .search({ query: 'Nike Air Max', searchType: 'text' })\n .catch(async (err) => {\n if (err instanceof HenrySDK.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n<!-- prettier-ignore -->\n```js\n// Configure the default for all requests:\nconst client = new HenrySDK({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.products.search({ query: 'Nike Air Max', searchType: 'text' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n<!-- prettier-ignore -->\n```ts\n// Configure the default for all requests:\nconst client = new HenrySDK({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.products.search({ query: 'Nike Air Max', searchType: 'text' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n<!-- prettier-ignore -->\n```ts\nconst client = new HenrySDK();\n\nconst response = await client.products\n .search({ query: 'Nike Air Max', searchType: 'text' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: response, response: raw } = await client.products\n .search({ query: 'Nike Air Max', searchType: 'text' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(response.refId);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `HENRY_SDK_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new HenrySDK({\n logger: logger.child({ name: 'HenrySDK' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.products.search({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\nimport fetch from 'my-fetch';\n\nconst client = new HenrySDK({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new HenrySDK({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\n\n```ts\nimport HenrySDK from '@henrylabs/sdk';\n\nconst client = new HenrySDK({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\n\n```ts\nimport HenrySDK from 'npm:@henrylabs/sdk';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new HenrySDK({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Henry-Social/henry-sdk-ts/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n",
239
451
  },
240
452
  ];
241
453
  const INDEX_OPTIONS = {
@@ -252,13 +464,15 @@ const INDEX_OPTIONS = {
252
464
  storeFields: ['kind', '_original'],
253
465
  searchOptions: {
254
466
  prefix: true,
255
- fuzzy: 0.2,
467
+ fuzzy: 0.1,
256
468
  boost: {
257
- name: 3,
258
- endpoint: 2,
469
+ name: 5,
470
+ stainlessPath: 3,
471
+ endpoint: 3,
472
+ qualified: 3,
259
473
  summary: 2,
260
- qualified: 2,
261
474
  content: 1,
475
+ description: 1,
262
476
  },
263
477
  },
264
478
  };
@@ -277,21 +491,40 @@ export class LocalDocsSearch {
277
491
  static async create(opts) {
278
492
  const instance = new LocalDocsSearch();
279
493
  instance.indexMethods(EMBEDDED_METHODS);
494
+ for (const readme of EMBEDDED_READMES) {
495
+ instance.indexProse(readme.content, `readme:${readme.language}`);
496
+ }
280
497
  if (opts?.docsDir) {
281
498
  await instance.loadDocsDirectory(opts.docsDir);
282
499
  }
283
500
  return instance;
284
501
  }
285
- // Note: Language is accepted for interface consistency with remote search, but currently has no
286
- // effect since this local search only supports TypeScript docs.
287
502
  search(props) {
288
- const { query, detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
503
+ const { query, language = 'typescript', detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
289
504
  const useMarkdown = detail === 'verbose' || detail === 'high';
290
- // Search both indices and merge results by score
505
+ // Search both indices and merge results by score.
506
+ // Filter prose hits so language-tagged content (READMEs and docs with
507
+ // frontmatter) only matches the requested language.
291
508
  const methodHits = this.methodIndex
292
509
  .search(query)
293
510
  .map((hit) => ({ ...hit, _kind: 'http_method' }));
294
- const proseHits = this.proseIndex.search(query).map((hit) => ({ ...hit, _kind: 'prose' }));
511
+ const proseHits = this.proseIndex
512
+ .search(query)
513
+ .filter((hit) => {
514
+ const source = hit['_original']?.source;
515
+ if (!source)
516
+ return true;
517
+ // Check for language-tagged sources: "readme:<lang>" or "lang:<lang>:<filename>"
518
+ let taggedLang;
519
+ if (source.startsWith('readme:'))
520
+ taggedLang = source.slice('readme:'.length);
521
+ else if (source.startsWith('lang:'))
522
+ taggedLang = source.split(':')[1];
523
+ if (!taggedLang)
524
+ return true;
525
+ return taggedLang === language || (language === 'javascript' && taggedLang === 'typescript');
526
+ })
527
+ .map((hit) => ({ ...hit, _kind: 'prose' }));
295
528
  const merged = [...methodHits, ...proseHits].sort((a, b) => b.score - a.score);
296
529
  const top = merged.slice(0, maxResults);
297
530
  const fullResults = [];
@@ -303,11 +536,16 @@ export class LocalDocsSearch {
303
536
  fullResults.push(m.markdown);
304
537
  }
305
538
  else {
539
+ // Use per-language data when available, falling back to the
540
+ // top-level fields (which are TypeScript-specific in the
541
+ // legacy codepath).
542
+ const langData = m.perLanguage?.[language];
306
543
  fullResults.push({
307
- method: m.qualified,
544
+ method: langData?.method ?? m.qualified,
308
545
  summary: m.summary,
309
546
  description: m.description,
310
547
  endpoint: `${m.httpMethod.toUpperCase()} ${m.endpoint}`,
548
+ ...(langData?.example ? { example: langData.example } : {}),
311
549
  ...(m.params ? { params: m.params } : {}),
312
550
  ...(m.response ? { response: m.response } : {}),
313
551
  });
@@ -374,7 +612,19 @@ export class LocalDocsSearch {
374
612
  }
375
613
  }
376
614
  else {
377
- this.indexProse(content, file.name);
615
+ // Parse optional YAML frontmatter for language tagging.
616
+ // Files with a "language" field in frontmatter will only
617
+ // surface in searches for that language.
618
+ //
619
+ // Example:
620
+ // ---
621
+ // language: python
622
+ // ---
623
+ // # Error handling in Python
624
+ // ...
625
+ const frontmatter = parseFrontmatter(content);
626
+ const source = frontmatter.language ? `lang:${frontmatter.language}:${file.name}` : file.name;
627
+ this.indexProse(content, source);
378
628
  }
379
629
  }
380
630
  catch (err) {
@@ -450,4 +700,13 @@ function extractTexts(data, depth = 0) {
450
700
  }
451
701
  return [];
452
702
  }
703
+ /** Parses YAML frontmatter from a markdown string, extracting the language field if present. */
704
+ function parseFrontmatter(markdown) {
705
+ const match = markdown.match(/^---\n([\s\S]*?)\n---/);
706
+ if (!match)
707
+ return {};
708
+ const body = match[1] ?? '';
709
+ const langMatch = body.match(/^language:\s*(.+)$/m);
710
+ return langMatch ? { language: langMatch[1].trim() } : {};
711
+ }
453
712
  //# sourceMappingURL=local-docs-search.mjs.map