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