context.dev 0.2.0 → 0.3.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 (79) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/client.d.mts +17 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +17 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai.d.mts +331 -0
  12. package/resources/ai.d.mts.map +1 -0
  13. package/resources/ai.d.ts +331 -0
  14. package/resources/ai.d.ts.map +1 -0
  15. package/resources/ai.js +33 -0
  16. package/resources/ai.js.map +1 -0
  17. package/resources/ai.mjs +29 -0
  18. package/resources/ai.mjs.map +1 -0
  19. package/resources/brand.d.mts +7 -1056
  20. package/resources/brand.d.mts.map +1 -1
  21. package/resources/brand.d.ts +7 -1056
  22. package/resources/brand.d.ts.map +1 -1
  23. package/resources/brand.js +0 -106
  24. package/resources/brand.js.map +1 -1
  25. package/resources/brand.mjs +0 -106
  26. package/resources/brand.mjs.map +1 -1
  27. package/resources/index.d.mts +6 -1
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +6 -1
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +11 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +5 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/industry.d.mts +70 -0
  36. package/resources/industry.d.mts.map +1 -0
  37. package/resources/industry.d.ts +70 -0
  38. package/resources/industry.d.ts.map +1 -0
  39. package/resources/industry.js +15 -0
  40. package/resources/industry.js.map +1 -0
  41. package/resources/industry.mjs +11 -0
  42. package/resources/industry.mjs.map +1 -0
  43. package/resources/style.d.mts +386 -0
  44. package/resources/style.d.mts.map +1 -0
  45. package/resources/style.d.ts +386 -0
  46. package/resources/style.d.ts.map +1 -0
  47. package/resources/style.js +25 -0
  48. package/resources/style.js.map +1 -0
  49. package/resources/style.mjs +21 -0
  50. package/resources/style.mjs.map +1 -0
  51. package/resources/utility.d.mts +79 -0
  52. package/resources/utility.d.mts.map +1 -0
  53. package/resources/utility.d.ts +79 -0
  54. package/resources/utility.d.ts.map +1 -0
  55. package/resources/utility.js +29 -0
  56. package/resources/utility.js.map +1 -0
  57. package/resources/utility.mjs +25 -0
  58. package/resources/utility.mjs.map +1 -0
  59. package/resources/web.d.mts +228 -0
  60. package/resources/web.d.mts.map +1 -0
  61. package/resources/web.d.ts +228 -0
  62. package/resources/web.d.ts.map +1 -0
  63. package/resources/web.js +49 -0
  64. package/resources/web.js.map +1 -0
  65. package/resources/web.mjs +45 -0
  66. package/resources/web.mjs.map +1 -0
  67. package/src/client.ts +93 -52
  68. package/src/resources/ai.ts +417 -0
  69. package/src/resources/brand.ts +66 -1417
  70. package/src/resources/index.ts +37 -26
  71. package/src/resources/industry.ts +92 -0
  72. package/src/resources/style.ts +522 -0
  73. package/src/resources/utility.ts +105 -0
  74. package/src/resources/web.ts +302 -0
  75. package/src/version.ts +1 -1
  76. package/version.d.mts +1 -1
  77. package/version.d.ts +1 -1
  78. package/version.js +1 -1
  79. package/version.mjs +1 -1
@@ -0,0 +1,331 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class AI extends APIResource {
5
+ /**
6
+ * Use AI to extract specific data points from a brand's website. The AI will crawl
7
+ * the website and extract the requested information based on the provided data
8
+ * points.
9
+ */
10
+ aiQuery(body: AIAIQueryParams, options?: RequestOptions): APIPromise<AIAIQueryResponse>;
11
+ /**
12
+ * Beta feature: Given a single URL, determines if it is a product detail page,
13
+ * classifies the platform/product type, and extracts the product information.
14
+ * Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
15
+ */
16
+ extractProduct(body: AIExtractProductParams, options?: RequestOptions): APIPromise<AIExtractProductResponse>;
17
+ /**
18
+ * Beta feature: Extract product information from a brand's website. Brand.dev will
19
+ * analyze the website and return a list of products with details such as name,
20
+ * description, image, pricing, features, and more.
21
+ */
22
+ extractProducts(body: AIExtractProductsParams, options?: RequestOptions): APIPromise<AIExtractProductsResponse>;
23
+ }
24
+ export interface AIAIQueryResponse {
25
+ /**
26
+ * Array of extracted data points
27
+ */
28
+ data_extracted?: Array<AIAIQueryResponse.DataExtracted>;
29
+ /**
30
+ * The domain that was analyzed
31
+ */
32
+ domain?: string;
33
+ /**
34
+ * Status of the response, e.g., 'ok'
35
+ */
36
+ status?: string;
37
+ /**
38
+ * List of URLs that were analyzed
39
+ */
40
+ urls_analyzed?: Array<string>;
41
+ }
42
+ export declare namespace AIAIQueryResponse {
43
+ interface DataExtracted {
44
+ /**
45
+ * Name of the extracted data point
46
+ */
47
+ datapoint_name?: string;
48
+ /**
49
+ * Value of the extracted data point. Can be a primitive type, an array of
50
+ * primitives, or an array of objects when datapoint_list_type is 'object'.
51
+ */
52
+ datapoint_value?: string | number | boolean | Array<string> | Array<number> | Array<unknown>;
53
+ }
54
+ }
55
+ export interface AIExtractProductResponse {
56
+ /**
57
+ * Whether the given URL is a product detail page
58
+ */
59
+ is_product_page?: boolean;
60
+ /**
61
+ * The detected ecommerce platform, or null if not a product page
62
+ */
63
+ platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic' | null;
64
+ /**
65
+ * The extracted product data, or null if not a product page
66
+ */
67
+ product?: AIExtractProductResponse.Product | null;
68
+ }
69
+ export declare namespace AIExtractProductResponse {
70
+ /**
71
+ * The extracted product data, or null if not a product page
72
+ */
73
+ interface Product {
74
+ /**
75
+ * Description of the product
76
+ */
77
+ description: string;
78
+ /**
79
+ * List of product features
80
+ */
81
+ features: Array<string>;
82
+ /**
83
+ * URLs to product images on the page (up to 7)
84
+ */
85
+ images: Array<string>;
86
+ /**
87
+ * Name of the product
88
+ */
89
+ name: string;
90
+ /**
91
+ * Tags associated with the product
92
+ */
93
+ tags: Array<string>;
94
+ /**
95
+ * Target audience for the product (array of strings)
96
+ */
97
+ target_audience: Array<string>;
98
+ /**
99
+ * Billing frequency for the product
100
+ */
101
+ billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null;
102
+ /**
103
+ * Category of the product
104
+ */
105
+ category?: string | null;
106
+ /**
107
+ * Currency code for the price (e.g., USD, EUR)
108
+ */
109
+ currency?: string | null;
110
+ /**
111
+ * URL to the product image
112
+ */
113
+ image_url?: string | null;
114
+ /**
115
+ * Price of the product
116
+ */
117
+ price?: number | null;
118
+ /**
119
+ * Pricing model for the product
120
+ */
121
+ pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null;
122
+ /**
123
+ * URL to the product page
124
+ */
125
+ url?: string | null;
126
+ }
127
+ }
128
+ export interface AIExtractProductsResponse {
129
+ /**
130
+ * Array of products extracted from the website
131
+ */
132
+ products?: Array<AIExtractProductsResponse.Product>;
133
+ }
134
+ export declare namespace AIExtractProductsResponse {
135
+ interface Product {
136
+ /**
137
+ * Description of the product
138
+ */
139
+ description: string;
140
+ /**
141
+ * List of product features
142
+ */
143
+ features: Array<string>;
144
+ /**
145
+ * URLs to product images on the page (up to 7)
146
+ */
147
+ images: Array<string>;
148
+ /**
149
+ * Name of the product
150
+ */
151
+ name: string;
152
+ /**
153
+ * Tags associated with the product
154
+ */
155
+ tags: Array<string>;
156
+ /**
157
+ * Target audience for the product (array of strings)
158
+ */
159
+ target_audience: Array<string>;
160
+ /**
161
+ * Billing frequency for the product
162
+ */
163
+ billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null;
164
+ /**
165
+ * Category of the product
166
+ */
167
+ category?: string | null;
168
+ /**
169
+ * Currency code for the price (e.g., USD, EUR)
170
+ */
171
+ currency?: string | null;
172
+ /**
173
+ * URL to the product image
174
+ */
175
+ image_url?: string | null;
176
+ /**
177
+ * Price of the product
178
+ */
179
+ price?: number | null;
180
+ /**
181
+ * Pricing model for the product
182
+ */
183
+ pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null;
184
+ /**
185
+ * URL to the product page
186
+ */
187
+ url?: string | null;
188
+ }
189
+ }
190
+ export interface AIAIQueryParams {
191
+ /**
192
+ * Array of data points to extract from the website
193
+ */
194
+ data_to_extract: Array<AIAIQueryParams.DataToExtract>;
195
+ /**
196
+ * The domain name to analyze
197
+ */
198
+ domain: string;
199
+ /**
200
+ * Optional object specifying which pages to analyze
201
+ */
202
+ specific_pages?: AIAIQueryParams.SpecificPages;
203
+ /**
204
+ * Optional timeout in milliseconds for the request. If the request takes longer
205
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
206
+ * value is 300000ms (5 minutes).
207
+ */
208
+ timeoutMS?: number;
209
+ }
210
+ export declare namespace AIAIQueryParams {
211
+ interface DataToExtract {
212
+ /**
213
+ * Description of what to extract
214
+ */
215
+ datapoint_description: string;
216
+ /**
217
+ * Example of the expected value
218
+ */
219
+ datapoint_example: string;
220
+ /**
221
+ * Name of the data point to extract
222
+ */
223
+ datapoint_name: string;
224
+ /**
225
+ * Type of the data point
226
+ */
227
+ datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url';
228
+ /**
229
+ * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'.
230
+ * Use 'object' to extract an array of objects matching a schema.
231
+ */
232
+ datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object';
233
+ /**
234
+ * Schema definition for objects when datapoint_list_type is 'object'. Provide a
235
+ * map of field names to their scalar types.
236
+ */
237
+ datapoint_object_schema?: {
238
+ [key: string]: 'string' | 'number' | 'date' | 'boolean';
239
+ };
240
+ }
241
+ /**
242
+ * Optional object specifying which pages to analyze
243
+ */
244
+ interface SpecificPages {
245
+ /**
246
+ * Whether to analyze the about us page
247
+ */
248
+ about_us?: boolean;
249
+ /**
250
+ * Whether to analyze the blog
251
+ */
252
+ blog?: boolean;
253
+ /**
254
+ * Whether to analyze the careers page
255
+ */
256
+ careers?: boolean;
257
+ /**
258
+ * Whether to analyze the contact us page
259
+ */
260
+ contact_us?: boolean;
261
+ /**
262
+ * Whether to analyze the FAQ page
263
+ */
264
+ faq?: boolean;
265
+ /**
266
+ * Whether to analyze the home page
267
+ */
268
+ home_page?: boolean;
269
+ /**
270
+ * Whether to analyze the pricing page
271
+ */
272
+ pricing?: boolean;
273
+ /**
274
+ * Whether to analyze the privacy policy page
275
+ */
276
+ privacy_policy?: boolean;
277
+ /**
278
+ * Whether to analyze the terms and conditions page
279
+ */
280
+ terms_and_conditions?: boolean;
281
+ }
282
+ }
283
+ export interface AIExtractProductParams {
284
+ /**
285
+ * The product page URL to extract product data from.
286
+ */
287
+ url: string;
288
+ /**
289
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
290
+ * 300000ms (5 minutes).
291
+ */
292
+ timeoutMS?: number;
293
+ }
294
+ export type AIExtractProductsParams = AIExtractProductsParams.ByDomain | AIExtractProductsParams.ByDirectURL;
295
+ export declare namespace AIExtractProductsParams {
296
+ interface ByDomain {
297
+ /**
298
+ * The domain name to analyze.
299
+ */
300
+ domain: string;
301
+ /**
302
+ * Maximum number of products to extract.
303
+ */
304
+ maxProducts?: number;
305
+ /**
306
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
307
+ * 300000ms (5 minutes).
308
+ */
309
+ timeoutMS?: number;
310
+ }
311
+ interface ByDirectURL {
312
+ /**
313
+ * A specific URL to use directly as the starting point for extraction without
314
+ * domain resolution.
315
+ */
316
+ directUrl: string;
317
+ /**
318
+ * Maximum number of products to extract.
319
+ */
320
+ maxProducts?: number;
321
+ /**
322
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
323
+ * 300000ms (5 minutes).
324
+ */
325
+ timeoutMS?: number;
326
+ }
327
+ }
328
+ export declare namespace AI {
329
+ export { type AIAIQueryResponse as AIAIQueryResponse, type AIExtractProductResponse as AIExtractProductResponse, type AIExtractProductsResponse as AIExtractProductsResponse, type AIAIQueryParams as AIAIQueryParams, type AIExtractProductParams as AIExtractProductParams, type AIExtractProductsParams as AIExtractProductsParams, };
330
+ }
331
+ //# sourceMappingURL=ai.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.mts","sourceRoot":"","sources":["../src/resources/ai.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,EAAG,SAAQ,WAAW;IACjC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAIvF;;;;OAIG;IACH,cAAc,CACZ,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;OAIG;IACH,eAAe,CACb,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;CAGzC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAExD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,aAAa;QAC5B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB;;;WAGG;QACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9F;CACF;AAED,MAAM,WA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AW,CAAC;AAE7G,MAAM,CAAC,OAAO,WAAW,uBAAuB,CAAC;IAC/C,UAAiB,QAAQ;QACvB;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,WAAW;QAC1B;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B,OAAO,EACL,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,331 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class AI extends APIResource {
5
+ /**
6
+ * Use AI to extract specific data points from a brand's website. The AI will crawl
7
+ * the website and extract the requested information based on the provided data
8
+ * points.
9
+ */
10
+ aiQuery(body: AIAIQueryParams, options?: RequestOptions): APIPromise<AIAIQueryResponse>;
11
+ /**
12
+ * Beta feature: Given a single URL, determines if it is a product detail page,
13
+ * classifies the platform/product type, and extracts the product information.
14
+ * Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
15
+ */
16
+ extractProduct(body: AIExtractProductParams, options?: RequestOptions): APIPromise<AIExtractProductResponse>;
17
+ /**
18
+ * Beta feature: Extract product information from a brand's website. Brand.dev will
19
+ * analyze the website and return a list of products with details such as name,
20
+ * description, image, pricing, features, and more.
21
+ */
22
+ extractProducts(body: AIExtractProductsParams, options?: RequestOptions): APIPromise<AIExtractProductsResponse>;
23
+ }
24
+ export interface AIAIQueryResponse {
25
+ /**
26
+ * Array of extracted data points
27
+ */
28
+ data_extracted?: Array<AIAIQueryResponse.DataExtracted>;
29
+ /**
30
+ * The domain that was analyzed
31
+ */
32
+ domain?: string;
33
+ /**
34
+ * Status of the response, e.g., 'ok'
35
+ */
36
+ status?: string;
37
+ /**
38
+ * List of URLs that were analyzed
39
+ */
40
+ urls_analyzed?: Array<string>;
41
+ }
42
+ export declare namespace AIAIQueryResponse {
43
+ interface DataExtracted {
44
+ /**
45
+ * Name of the extracted data point
46
+ */
47
+ datapoint_name?: string;
48
+ /**
49
+ * Value of the extracted data point. Can be a primitive type, an array of
50
+ * primitives, or an array of objects when datapoint_list_type is 'object'.
51
+ */
52
+ datapoint_value?: string | number | boolean | Array<string> | Array<number> | Array<unknown>;
53
+ }
54
+ }
55
+ export interface AIExtractProductResponse {
56
+ /**
57
+ * Whether the given URL is a product detail page
58
+ */
59
+ is_product_page?: boolean;
60
+ /**
61
+ * The detected ecommerce platform, or null if not a product page
62
+ */
63
+ platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic' | null;
64
+ /**
65
+ * The extracted product data, or null if not a product page
66
+ */
67
+ product?: AIExtractProductResponse.Product | null;
68
+ }
69
+ export declare namespace AIExtractProductResponse {
70
+ /**
71
+ * The extracted product data, or null if not a product page
72
+ */
73
+ interface Product {
74
+ /**
75
+ * Description of the product
76
+ */
77
+ description: string;
78
+ /**
79
+ * List of product features
80
+ */
81
+ features: Array<string>;
82
+ /**
83
+ * URLs to product images on the page (up to 7)
84
+ */
85
+ images: Array<string>;
86
+ /**
87
+ * Name of the product
88
+ */
89
+ name: string;
90
+ /**
91
+ * Tags associated with the product
92
+ */
93
+ tags: Array<string>;
94
+ /**
95
+ * Target audience for the product (array of strings)
96
+ */
97
+ target_audience: Array<string>;
98
+ /**
99
+ * Billing frequency for the product
100
+ */
101
+ billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null;
102
+ /**
103
+ * Category of the product
104
+ */
105
+ category?: string | null;
106
+ /**
107
+ * Currency code for the price (e.g., USD, EUR)
108
+ */
109
+ currency?: string | null;
110
+ /**
111
+ * URL to the product image
112
+ */
113
+ image_url?: string | null;
114
+ /**
115
+ * Price of the product
116
+ */
117
+ price?: number | null;
118
+ /**
119
+ * Pricing model for the product
120
+ */
121
+ pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null;
122
+ /**
123
+ * URL to the product page
124
+ */
125
+ url?: string | null;
126
+ }
127
+ }
128
+ export interface AIExtractProductsResponse {
129
+ /**
130
+ * Array of products extracted from the website
131
+ */
132
+ products?: Array<AIExtractProductsResponse.Product>;
133
+ }
134
+ export declare namespace AIExtractProductsResponse {
135
+ interface Product {
136
+ /**
137
+ * Description of the product
138
+ */
139
+ description: string;
140
+ /**
141
+ * List of product features
142
+ */
143
+ features: Array<string>;
144
+ /**
145
+ * URLs to product images on the page (up to 7)
146
+ */
147
+ images: Array<string>;
148
+ /**
149
+ * Name of the product
150
+ */
151
+ name: string;
152
+ /**
153
+ * Tags associated with the product
154
+ */
155
+ tags: Array<string>;
156
+ /**
157
+ * Target audience for the product (array of strings)
158
+ */
159
+ target_audience: Array<string>;
160
+ /**
161
+ * Billing frequency for the product
162
+ */
163
+ billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null;
164
+ /**
165
+ * Category of the product
166
+ */
167
+ category?: string | null;
168
+ /**
169
+ * Currency code for the price (e.g., USD, EUR)
170
+ */
171
+ currency?: string | null;
172
+ /**
173
+ * URL to the product image
174
+ */
175
+ image_url?: string | null;
176
+ /**
177
+ * Price of the product
178
+ */
179
+ price?: number | null;
180
+ /**
181
+ * Pricing model for the product
182
+ */
183
+ pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null;
184
+ /**
185
+ * URL to the product page
186
+ */
187
+ url?: string | null;
188
+ }
189
+ }
190
+ export interface AIAIQueryParams {
191
+ /**
192
+ * Array of data points to extract from the website
193
+ */
194
+ data_to_extract: Array<AIAIQueryParams.DataToExtract>;
195
+ /**
196
+ * The domain name to analyze
197
+ */
198
+ domain: string;
199
+ /**
200
+ * Optional object specifying which pages to analyze
201
+ */
202
+ specific_pages?: AIAIQueryParams.SpecificPages;
203
+ /**
204
+ * Optional timeout in milliseconds for the request. If the request takes longer
205
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
206
+ * value is 300000ms (5 minutes).
207
+ */
208
+ timeoutMS?: number;
209
+ }
210
+ export declare namespace AIAIQueryParams {
211
+ interface DataToExtract {
212
+ /**
213
+ * Description of what to extract
214
+ */
215
+ datapoint_description: string;
216
+ /**
217
+ * Example of the expected value
218
+ */
219
+ datapoint_example: string;
220
+ /**
221
+ * Name of the data point to extract
222
+ */
223
+ datapoint_name: string;
224
+ /**
225
+ * Type of the data point
226
+ */
227
+ datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url';
228
+ /**
229
+ * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'.
230
+ * Use 'object' to extract an array of objects matching a schema.
231
+ */
232
+ datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object';
233
+ /**
234
+ * Schema definition for objects when datapoint_list_type is 'object'. Provide a
235
+ * map of field names to their scalar types.
236
+ */
237
+ datapoint_object_schema?: {
238
+ [key: string]: 'string' | 'number' | 'date' | 'boolean';
239
+ };
240
+ }
241
+ /**
242
+ * Optional object specifying which pages to analyze
243
+ */
244
+ interface SpecificPages {
245
+ /**
246
+ * Whether to analyze the about us page
247
+ */
248
+ about_us?: boolean;
249
+ /**
250
+ * Whether to analyze the blog
251
+ */
252
+ blog?: boolean;
253
+ /**
254
+ * Whether to analyze the careers page
255
+ */
256
+ careers?: boolean;
257
+ /**
258
+ * Whether to analyze the contact us page
259
+ */
260
+ contact_us?: boolean;
261
+ /**
262
+ * Whether to analyze the FAQ page
263
+ */
264
+ faq?: boolean;
265
+ /**
266
+ * Whether to analyze the home page
267
+ */
268
+ home_page?: boolean;
269
+ /**
270
+ * Whether to analyze the pricing page
271
+ */
272
+ pricing?: boolean;
273
+ /**
274
+ * Whether to analyze the privacy policy page
275
+ */
276
+ privacy_policy?: boolean;
277
+ /**
278
+ * Whether to analyze the terms and conditions page
279
+ */
280
+ terms_and_conditions?: boolean;
281
+ }
282
+ }
283
+ export interface AIExtractProductParams {
284
+ /**
285
+ * The product page URL to extract product data from.
286
+ */
287
+ url: string;
288
+ /**
289
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
290
+ * 300000ms (5 minutes).
291
+ */
292
+ timeoutMS?: number;
293
+ }
294
+ export type AIExtractProductsParams = AIExtractProductsParams.ByDomain | AIExtractProductsParams.ByDirectURL;
295
+ export declare namespace AIExtractProductsParams {
296
+ interface ByDomain {
297
+ /**
298
+ * The domain name to analyze.
299
+ */
300
+ domain: string;
301
+ /**
302
+ * Maximum number of products to extract.
303
+ */
304
+ maxProducts?: number;
305
+ /**
306
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
307
+ * 300000ms (5 minutes).
308
+ */
309
+ timeoutMS?: number;
310
+ }
311
+ interface ByDirectURL {
312
+ /**
313
+ * A specific URL to use directly as the starting point for extraction without
314
+ * domain resolution.
315
+ */
316
+ directUrl: string;
317
+ /**
318
+ * Maximum number of products to extract.
319
+ */
320
+ maxProducts?: number;
321
+ /**
322
+ * Optional timeout in milliseconds for the request. Maximum allowed value is
323
+ * 300000ms (5 minutes).
324
+ */
325
+ timeoutMS?: number;
326
+ }
327
+ }
328
+ export declare namespace AI {
329
+ export { type AIAIQueryResponse as AIAIQueryResponse, type AIExtractProductResponse as AIExtractProductResponse, type AIExtractProductsResponse as AIExtractProductsResponse, type AIAIQueryParams as AIAIQueryParams, type AIExtractProductParams as AIExtractProductParams, type AIExtractProductsParams as AIExtractProductsParams, };
330
+ }
331
+ //# sourceMapping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