@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
@@ -5,6 +5,11 @@ import * as fs from 'node:fs/promises';
5
5
  import * as path from 'node:path';
6
6
  import { getLogger } from './logger';
7
7
 
8
+ type PerLanguageData = {
9
+ method?: string;
10
+ example?: string;
11
+ };
12
+
8
13
  type MethodEntry = {
9
14
  name: string;
10
15
  endpoint: string;
@@ -16,6 +21,7 @@ type MethodEntry = {
16
21
  params?: string[];
17
22
  response?: string;
18
23
  markdown?: string;
24
+ perLanguage?: Record<string, PerLanguageData>;
19
25
  };
20
26
 
21
27
  type ProseChunk = {
@@ -44,19 +50,97 @@ type SearchResult = {
44
50
  };
45
51
 
46
52
  const EMBEDDED_METHODS: MethodEntry[] = [
53
+ {
54
+ name: 'search',
55
+ endpoint: '/product/search',
56
+ httpMethod: 'post',
57
+ summary: 'Product Search',
58
+ description:
59
+ '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.',
60
+ stainlessPath: '(resource) products > (method) search',
61
+ qualified: 'client.products.search',
62
+ params: [
63
+ "{ 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'; };",
64
+ ],
65
+ response:
66
+ "{ 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[]; }[]; }; }",
67
+ perLanguage: {
68
+ http: {
69
+ example:
70
+ '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 }\'',
71
+ },
72
+ python: {
73
+ method: 'products.search',
74
+ example:
75
+ '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)',
76
+ },
77
+ typescript: {
78
+ method: 'client.products.search',
79
+ example:
80
+ "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);",
81
+ },
82
+ },
83
+ },
84
+ {
85
+ name: 'poll_search',
86
+ endpoint: '/product/search/status',
87
+ httpMethod: 'get',
88
+ summary: 'Product Search Status',
89
+ description: 'Check the status of a product search retrieval job and get results when ready.',
90
+ stainlessPath: '(resource) products > (method) poll_search',
91
+ qualified: 'client.products.pollSearch',
92
+ params: ['refId: string;'],
93
+ response:
94
+ "{ 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[]; }[]; }; }",
95
+ markdown:
96
+ "## 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```",
97
+ perLanguage: {
98
+ http: {
99
+ example:
100
+ 'curl https://api.henrylabs.ai/v1/product/search/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
101
+ },
102
+ python: {
103
+ method: 'products.poll_search',
104
+ example:
105
+ '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)',
106
+ },
107
+ typescript: {
108
+ method: 'client.products.pollSearch',
109
+ example:
110
+ "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);",
111
+ },
112
+ },
113
+ },
47
114
  {
48
115
  name: 'details',
49
116
  endpoint: '/product/details',
50
117
  httpMethod: 'post',
51
118
  summary: 'Product Details',
52
- description: 'Fetch detailed information about a product from a given URL.',
119
+ description:
120
+ '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.',
53
121
  stainlessPath: '(resource) products > (method) details',
54
122
  qualified: 'client.products.details',
55
- params: ['link: string;', 'country?: string;', 'variant?: string | object;'],
123
+ params: ['link: string;', 'country?: string;', "mode?: 'async' | 'sync';", 'variant?: string | object;'],
56
124
  response:
57
- "{ 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'; }[]; }; }",
125
+ "{ 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; }[]; }; }",
58
126
  markdown:
59
- "## 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```",
127
+ "## 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```",
128
+ perLanguage: {
129
+ http: {
130
+ example:
131
+ '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 }\'',
132
+ },
133
+ python: {
134
+ method: 'products.details',
135
+ example:
136
+ '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)',
137
+ },
138
+ typescript: {
139
+ method: 'client.products.details',
140
+ example:
141
+ "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);",
142
+ },
143
+ },
60
144
  },
61
145
  {
62
146
  name: 'poll_details',
@@ -68,46 +152,25 @@ const EMBEDDED_METHODS: MethodEntry[] = [
68
152
  qualified: 'client.products.pollDetails',
69
153
  params: ['refId: string;'],
70
154
  response:
71
- "{ 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'; }[]; }; }",
155
+ "{ 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; }[]; }; }",
72
156
  markdown:
73
- "## 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```",
74
- },
75
- {
76
- name: 'poll_search',
77
- endpoint: '/product/search/status',
78
- httpMethod: 'get',
79
- summary: 'Product Search Status',
80
- description: 'Check the status of a product search retrieval job and get results when ready.',
81
- stainlessPath: '(resource) products > (method) poll_search',
82
- qualified: 'client.products.pollSearch',
83
- params: ['refId: string;'],
84
- response:
85
- "{ 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[]; }[]; }; }",
86
- markdown:
87
- "## 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```",
88
- },
89
- {
90
- name: 'search',
91
- endpoint: '/product/search',
92
- httpMethod: 'post',
93
- summary: 'Text Product Search',
94
- description: 'Search for products using keyword and passing various filters and criteria',
95
- stainlessPath: '(resource) products > (method) search',
96
- qualified: 'client.products.search',
97
- params: [
98
- 'query: string;',
99
- 'country?: string;',
100
- 'cursor?: number;',
101
- 'limit?: number;',
102
- 'maxPrice?: number;',
103
- 'merchant?: string;',
104
- 'minPrice?: number;',
105
- "sortBy?: 'lowToHigh' | 'highToLow';",
106
- ],
107
- response:
108
- "{ 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[]; }[]; }; }",
109
- markdown:
110
- "## 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```",
157
+ "## 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```",
158
+ perLanguage: {
159
+ http: {
160
+ example:
161
+ 'curl https://api.henrylabs.ai/v1/product/details/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
162
+ },
163
+ python: {
164
+ method: 'products.poll_details',
165
+ example:
166
+ '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)',
167
+ },
168
+ typescript: {
169
+ method: 'client.products.pollDetails',
170
+ example:
171
+ "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);",
172
+ },
173
+ },
111
174
  },
112
175
  {
113
176
  name: 'create',
@@ -119,13 +182,29 @@ const EMBEDDED_METHODS: MethodEntry[] = [
119
182
  qualified: 'client.cart.create',
120
183
  params: [
121
184
  'items: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; }[];',
122
- "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'; }; };",
185
+ "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'; }; };",
123
186
  'tags?: object;',
124
187
  ],
125
188
  response:
126
189
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
127
190
  markdown:
128
- "## 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```",
191
+ "## 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```",
192
+ perLanguage: {
193
+ http: {
194
+ example:
195
+ '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 }\'',
196
+ },
197
+ python: {
198
+ method: 'cart.create',
199
+ example:
200
+ '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)',
201
+ },
202
+ typescript: {
203
+ method: 'client.cart.create',
204
+ example:
205
+ "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);",
206
+ },
207
+ },
129
208
  },
130
209
  {
131
210
  name: 'list',
@@ -139,7 +218,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [
139
218
  response:
140
219
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }[]; message: string; status: string; success: boolean; }',
141
220
  markdown:
142
- "## 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```",
221
+ "## 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```",
222
+ perLanguage: {
223
+ http: {
224
+ example: 'curl https://api.henrylabs.ai/v1/cart \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
225
+ },
226
+ python: {
227
+ method: 'cart.list',
228
+ example:
229
+ '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)',
230
+ },
231
+ typescript: {
232
+ method: 'client.cart.list',
233
+ example:
234
+ "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);",
235
+ },
236
+ },
143
237
  },
144
238
  {
145
239
  name: 'delete',
@@ -153,16 +247,32 @@ const EMBEDDED_METHODS: MethodEntry[] = [
153
247
  response:
154
248
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
155
249
  markdown:
156
- "## 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```",
250
+ "## 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```",
251
+ perLanguage: {
252
+ http: {
253
+ example:
254
+ 'curl https://api.henrylabs.ai/v1/cart/$CART_ID \\\n -X DELETE \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
255
+ },
256
+ python: {
257
+ method: 'cart.delete',
258
+ example:
259
+ '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)',
260
+ },
261
+ typescript: {
262
+ method: 'client.cart.delete',
263
+ example:
264
+ "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);",
265
+ },
266
+ },
157
267
  },
158
268
  {
159
- name: 'update',
269
+ name: 'add',
160
270
  endpoint: '/cart/{cartId}/item',
161
- httpMethod: 'put',
162
- summary: 'Cart Update Item',
163
- description: 'Update an item in an existing cart.',
164
- stainlessPath: '(resource) cart.item > (method) update',
165
- qualified: 'client.cart.item.update',
271
+ httpMethod: 'post',
272
+ summary: 'Cart Add Item',
273
+ description: 'Add an item to an existing cart.',
274
+ stainlessPath: '(resource) cart.item > (method) add',
275
+ qualified: 'client.cart.item.add',
166
276
  params: [
167
277
  'cartId: string;',
168
278
  'item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; };',
@@ -170,16 +280,32 @@ const EMBEDDED_METHODS: MethodEntry[] = [
170
280
  response:
171
281
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
172
282
  markdown:
173
- "## 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```",
283
+ "## 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```",
284
+ perLanguage: {
285
+ http: {
286
+ example:
287
+ '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 }\'',
288
+ },
289
+ python: {
290
+ method: 'cart.item.add',
291
+ example:
292
+ '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)',
293
+ },
294
+ typescript: {
295
+ method: 'client.cart.item.add',
296
+ example:
297
+ "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);",
298
+ },
299
+ },
174
300
  },
175
301
  {
176
- name: 'add',
302
+ name: 'update',
177
303
  endpoint: '/cart/{cartId}/item',
178
- httpMethod: 'post',
179
- summary: 'Cart Add Item',
180
- description: 'Add an item to an existing cart.',
181
- stainlessPath: '(resource) cart.item > (method) add',
182
- qualified: 'client.cart.item.add',
304
+ httpMethod: 'put',
305
+ summary: 'Cart Update Item',
306
+ description: 'Update an item in an existing cart.',
307
+ stainlessPath: '(resource) cart.item > (method) update',
308
+ qualified: 'client.cart.item.update',
183
309
  params: [
184
310
  'cartId: string;',
185
311
  'item: { link: string; coupons?: string[]; metadata?: object; quantity?: number; shippingOption?: { id?: string; value?: string; }; variant?: string | object; };',
@@ -187,7 +313,23 @@ const EMBEDDED_METHODS: MethodEntry[] = [
187
313
  response:
188
314
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
189
315
  markdown:
190
- "## 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```",
316
+ "## 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```",
317
+ perLanguage: {
318
+ http: {
319
+ example:
320
+ '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 }\'',
321
+ },
322
+ python: {
323
+ method: 'cart.item.update',
324
+ example:
325
+ '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)',
326
+ },
327
+ typescript: {
328
+ method: 'client.cart.item.update',
329
+ example:
330
+ "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);",
331
+ },
332
+ },
191
333
  },
192
334
  {
193
335
  name: 'remove',
@@ -201,26 +343,60 @@ const EMBEDDED_METHODS: MethodEntry[] = [
201
343
  response:
202
344
  '{ data: { cartId: string; checkoutUrl: string; data: { items: object[]; settings?: object; tags?: object; }; metadata?: object; }; message: string; status: string; success: boolean; }',
203
345
  markdown:
204
- "## 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```",
346
+ "## 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```",
347
+ perLanguage: {
348
+ http: {
349
+ example:
350
+ 'curl https://api.henrylabs.ai/v1/cart/$CART_ID/item \\\n -X DELETE \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
351
+ },
352
+ python: {
353
+ method: 'cart.item.remove',
354
+ example:
355
+ '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)',
356
+ },
357
+ typescript: {
358
+ method: 'client.cart.item.remove',
359
+ example:
360
+ "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);",
361
+ },
362
+ },
205
363
  },
206
364
  {
207
365
  name: 'details',
208
366
  endpoint: '/cart/{cartId}/details',
209
367
  httpMethod: 'post',
210
368
  summary: 'Cart Details',
211
- description: 'Retrieve detailed information about a cart.',
369
+ description:
370
+ 'Retrieve detailed information about a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
212
371
  stainlessPath: '(resource) cart.checkout > (method) details',
213
372
  qualified: 'client.cart.checkout.details',
214
373
  params: [
215
374
  'cartId: string;',
216
- 'buyer: { shippingAddress: { city: string; countryCode: string; line1: string; postalCode: string; province: string; line2?: string; }; };',
375
+ '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; }; }; };',
217
376
  'coupons?: string[];',
218
377
  'metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; };',
378
+ "mode?: 'async' | 'sync';",
219
379
  ],
220
380
  response:
221
381
  "{ data: { jobs: { refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: object; }[]; metadata?: object; }; message: string; status: string; success: boolean; }",
222
382
  markdown:
223
- "## 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```",
383
+ "## 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```",
384
+ perLanguage: {
385
+ http: {
386
+ example:
387
+ '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 }\'',
388
+ },
389
+ python: {
390
+ method: 'cart.checkout.details',
391
+ example:
392
+ '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)',
393
+ },
394
+ typescript: {
395
+ method: 'client.cart.checkout.details',
396
+ example:
397
+ "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);",
398
+ },
399
+ },
224
400
  },
225
401
  {
226
402
  name: 'poll_details',
@@ -234,41 +410,91 @@ const EMBEDDED_METHODS: MethodEntry[] = [
234
410
  response:
235
411
  "{ refId: string; status: 'pending' | 'processing' | 'complete' | 'failed'; error?: object; result?: { items: { costs: object; shippingOptions: object[]; coupons?: object[]; metadata?: object; }[]; }; }",
236
412
  markdown:
237
- "## 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```",
238
- },
239
- {
240
- name: 'poll_purchase',
241
- endpoint: '/cart/purchase/status',
242
- httpMethod: 'get',
243
- summary: 'Cart Purchase Status',
244
- description: 'Check the status of a cart purchase job and get results when ready.',
245
- stainlessPath: '(resource) cart.checkout > (method) poll_purchase',
246
- qualified: 'client.cart.checkout.pollPurchase',
247
- params: ['refId: string;'],
248
- response:
249
- "{ 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; }[]; }; }",
250
- markdown:
251
- "## 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```",
413
+ "## 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```",
414
+ perLanguage: {
415
+ http: {
416
+ example:
417
+ 'curl https://api.henrylabs.ai/v1/cart/checkout/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
418
+ },
419
+ python: {
420
+ method: 'cart.checkout.poll_details',
421
+ example:
422
+ '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)',
423
+ },
424
+ typescript: {
425
+ method: 'client.cart.checkout.pollDetails',
426
+ example:
427
+ "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);",
428
+ },
429
+ },
252
430
  },
253
431
  {
254
432
  name: 'purchase',
255
433
  endpoint: '/cart/{cartId}/purchase',
256
434
  httpMethod: 'post',
257
435
  summary: 'Cart Purchase',
258
- description: 'Initiate the purchase process for a cart.',
436
+ description:
437
+ 'Initiate the purchase process for a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.',
259
438
  stainlessPath: '(resource) cart.checkout > (method) purchase',
260
439
  qualified: 'client.cart.checkout.purchase',
261
440
  params: [
262
441
  'cartId: string;',
263
- '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; };',
442
+ '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; };',
264
443
  'metadata?: { botAuth?: { forterToken?: string; }; userData?: { ipAddress?: string; userAgent?: string; }; };',
444
+ "mode?: 'async' | 'sync';",
265
445
  'overrideProducts?: object;',
266
446
  'settings?: { collectAddress?: boolean; collectEmail?: boolean; collectPhone?: boolean; };',
267
447
  ],
268
448
  response:
269
- "{ 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; }[]; }; }",
449
+ "{ 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; }[]; }; }",
450
+ markdown:
451
+ "## 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```",
452
+ perLanguage: {
453
+ http: {
454
+ example:
455
+ '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 }\'',
456
+ },
457
+ python: {
458
+ method: 'cart.checkout.purchase',
459
+ example:
460
+ '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)',
461
+ },
462
+ typescript: {
463
+ method: 'client.cart.checkout.purchase',
464
+ example:
465
+ "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);",
466
+ },
467
+ },
468
+ },
469
+ {
470
+ name: 'poll_purchase',
471
+ endpoint: '/cart/purchase/status',
472
+ httpMethod: 'get',
473
+ summary: 'Cart Purchase Status',
474
+ description: 'Check the status of a cart purchase job and get results when ready.',
475
+ stainlessPath: '(resource) cart.checkout > (method) poll_purchase',
476
+ qualified: 'client.cart.checkout.pollPurchase',
477
+ params: ['refId: string;'],
478
+ response:
479
+ "{ 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; }[]; }; }",
270
480
  markdown:
271
- "## 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```",
481
+ "## 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```",
482
+ perLanguage: {
483
+ http: {
484
+ example:
485
+ 'curl https://api.henrylabs.ai/v1/cart/purchase/status \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
486
+ },
487
+ python: {
488
+ method: 'cart.checkout.poll_purchase',
489
+ example:
490
+ '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)',
491
+ },
492
+ typescript: {
493
+ method: 'client.cart.checkout.pollPurchase',
494
+ example:
495
+ "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);",
496
+ },
497
+ },
272
498
  },
273
499
  {
274
500
  name: 'list',
@@ -287,7 +513,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [
287
513
  response:
288
514
  "{ 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; }",
289
515
  markdown:
290
- "## 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```",
516
+ "## 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```",
517
+ perLanguage: {
518
+ http: {
519
+ example: 'curl https://api.henrylabs.ai/v1/orders \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
520
+ },
521
+ python: {
522
+ method: 'orders.list',
523
+ example:
524
+ '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)',
525
+ },
526
+ typescript: {
527
+ method: 'client.orders.list',
528
+ example:
529
+ "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);",
530
+ },
531
+ },
291
532
  },
292
533
  {
293
534
  name: 'list',
@@ -307,7 +548,35 @@ const EMBEDDED_METHODS: MethodEntry[] = [
307
548
  response:
308
549
  '{ data: { categories: string[]; description: string; host: string; logo: { urls: object[]; }; name: string; website: { urls: object[]; }; }[]; message: string; status: string; success: boolean; }',
309
550
  markdown:
310
- "## 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```",
551
+ "## 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```",
552
+ perLanguage: {
553
+ http: {
554
+ example: 'curl https://api.henrylabs.ai/v1/merchants \\\n -H "x-api-key: $HENRY_SDK_API_KEY"',
555
+ },
556
+ python: {
557
+ method: 'merchants.list',
558
+ example:
559
+ '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)',
560
+ },
561
+ typescript: {
562
+ method: 'client.merchants.list',
563
+ example:
564
+ "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);",
565
+ },
566
+ },
567
+ },
568
+ ];
569
+
570
+ const EMBEDDED_READMES: { language: string; content: string }[] = [
571
+ {
572
+ language: 'python',
573
+ content:
574
+ '# 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',
575
+ },
576
+ {
577
+ language: 'typescript',
578
+ content:
579
+ "# 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",
311
580
  },
312
581
  ];
313
582
 
@@ -325,13 +594,15 @@ const INDEX_OPTIONS = {
325
594
  storeFields: ['kind', '_original'],
326
595
  searchOptions: {
327
596
  prefix: true,
328
- fuzzy: 0.2,
597
+ fuzzy: 0.1,
329
598
  boost: {
330
- name: 3,
331
- endpoint: 2,
599
+ name: 5,
600
+ stainlessPath: 3,
601
+ endpoint: 3,
602
+ qualified: 3,
332
603
  summary: 2,
333
- qualified: 2,
334
604
  content: 1,
605
+ description: 1,
335
606
  } as Record<string, number>,
336
607
  },
337
608
  };
@@ -353,14 +624,15 @@ export class LocalDocsSearch {
353
624
  static async create(opts?: { docsDir?: string }): Promise<LocalDocsSearch> {
354
625
  const instance = new LocalDocsSearch();
355
626
  instance.indexMethods(EMBEDDED_METHODS);
627
+ for (const readme of EMBEDDED_READMES) {
628
+ instance.indexProse(readme.content, `readme:${readme.language}`);
629
+ }
356
630
  if (opts?.docsDir) {
357
631
  await instance.loadDocsDirectory(opts.docsDir);
358
632
  }
359
633
  return instance;
360
634
  }
361
635
 
362
- // Note: Language is accepted for interface consistency with remote search, but currently has no
363
- // effect since this local search only supports TypeScript docs.
364
636
  search(props: {
365
637
  query: string;
366
638
  language?: string;
@@ -368,15 +640,29 @@ export class LocalDocsSearch {
368
640
  maxResults?: number;
369
641
  maxLength?: number;
370
642
  }): SearchResult {
371
- const { query, detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
643
+ const { query, language = 'typescript', detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
372
644
 
373
645
  const useMarkdown = detail === 'verbose' || detail === 'high';
374
646
 
375
- // Search both indices and merge results by score
647
+ // Search both indices and merge results by score.
648
+ // Filter prose hits so language-tagged content (READMEs and docs with
649
+ // frontmatter) only matches the requested language.
376
650
  const methodHits = this.methodIndex
377
651
  .search(query)
378
652
  .map((hit) => ({ ...hit, _kind: 'http_method' as const }));
379
- const proseHits = this.proseIndex.search(query).map((hit) => ({ ...hit, _kind: 'prose' as const }));
653
+ const proseHits = this.proseIndex
654
+ .search(query)
655
+ .filter((hit) => {
656
+ const source = ((hit as Record<string, unknown>)['_original'] as ProseChunk | undefined)?.source;
657
+ if (!source) return true;
658
+ // Check for language-tagged sources: "readme:<lang>" or "lang:<lang>:<filename>"
659
+ let taggedLang: string | undefined;
660
+ if (source.startsWith('readme:')) taggedLang = source.slice('readme:'.length);
661
+ else if (source.startsWith('lang:')) taggedLang = source.split(':')[1];
662
+ if (!taggedLang) return true;
663
+ return taggedLang === language || (language === 'javascript' && taggedLang === 'typescript');
664
+ })
665
+ .map((hit) => ({ ...hit, _kind: 'prose' as const }));
380
666
  const merged = [...methodHits, ...proseHits].sort((a, b) => b.score - a.score);
381
667
  const top = merged.slice(0, maxResults);
382
668
 
@@ -389,11 +675,16 @@ export class LocalDocsSearch {
389
675
  if (useMarkdown && m.markdown) {
390
676
  fullResults.push(m.markdown);
391
677
  } else {
678
+ // Use per-language data when available, falling back to the
679
+ // top-level fields (which are TypeScript-specific in the
680
+ // legacy codepath).
681
+ const langData = m.perLanguage?.[language];
392
682
  fullResults.push({
393
- method: m.qualified,
683
+ method: langData?.method ?? m.qualified,
394
684
  summary: m.summary,
395
685
  description: m.description,
396
686
  endpoint: `${m.httpMethod.toUpperCase()} ${m.endpoint}`,
687
+ ...(langData?.example ? { example: langData.example } : {}),
397
688
  ...(m.params ? { params: m.params } : {}),
398
689
  ...(m.response ? { response: m.response } : {}),
399
690
  });
@@ -464,7 +755,19 @@ export class LocalDocsSearch {
464
755
  this.indexProse(texts.join('\n\n'), file.name);
465
756
  }
466
757
  } else {
467
- this.indexProse(content, file.name);
758
+ // Parse optional YAML frontmatter for language tagging.
759
+ // Files with a "language" field in frontmatter will only
760
+ // surface in searches for that language.
761
+ //
762
+ // Example:
763
+ // ---
764
+ // language: python
765
+ // ---
766
+ // # Error handling in Python
767
+ // ...
768
+ const frontmatter = parseFrontmatter(content);
769
+ const source = frontmatter.language ? `lang:${frontmatter.language}:${file.name}` : file.name;
770
+ this.indexProse(content, source);
468
771
  }
469
772
  } catch (err) {
470
773
  getLogger().warn({ err, file: file.name }, 'Failed to index docs file');
@@ -542,3 +845,12 @@ function extractTexts(data: unknown, depth = 0): string[] {
542
845
  }
543
846
  return [];
544
847
  }
848
+
849
+ /** Parses YAML frontmatter from a markdown string, extracting the language field if present. */
850
+ function parseFrontmatter(markdown: string): { language?: string } {
851
+ const match = markdown.match(/^---\n([\s\S]*?)\n---/);
852
+ if (!match) return {};
853
+ const body = match[1] ?? '';
854
+ const langMatch = body.match(/^language:\s*(.+)$/m);
855
+ return langMatch ? { language: langMatch[1]!.trim() } : {};
856
+ }