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
@@ -1,45 +1,56 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ AI,
5
+ type AIAIQueryResponse,
6
+ type AIExtractProductResponse,
7
+ type AIExtractProductsResponse,
8
+ type AIAIQueryParams,
9
+ type AIExtractProductParams,
10
+ type AIExtractProductsParams,
11
+ } from './ai';
3
12
  export {
4
13
  Brand,
5
14
  type BrandRetrieveResponse,
6
- type BrandAIProductResponse,
7
- type BrandAIProductsResponse,
8
- type BrandAIQueryResponse,
9
- type BrandFontsResponse,
10
15
  type BrandIdentifyFromTransactionResponse,
11
- type BrandPrefetchResponse,
12
- type BrandPrefetchByEmailResponse,
13
16
  type BrandRetrieveByEmailResponse,
14
17
  type BrandRetrieveByIsinResponse,
15
18
  type BrandRetrieveByNameResponse,
16
19
  type BrandRetrieveByTickerResponse,
17
- type BrandRetrieveNaicsResponse,
18
20
  type BrandRetrieveSimplifiedResponse,
19
- type BrandScreenshotResponse,
20
- type BrandStyleguideResponse,
21
- type BrandWebScrapeHTMLResponse,
22
- type BrandWebScrapeImagesResponse,
23
- type BrandWebScrapeMdResponse,
24
- type BrandWebScrapeSitemapResponse,
25
21
  type BrandRetrieveParams,
26
- type BrandAIProductParams,
27
- type BrandAIProductsParams,
28
- type BrandAIQueryParams,
29
- type BrandFontsParams,
30
22
  type BrandIdentifyFromTransactionParams,
31
- type BrandPrefetchParams,
32
- type BrandPrefetchByEmailParams,
33
23
  type BrandRetrieveByEmailParams,
34
24
  type BrandRetrieveByIsinParams,
35
25
  type BrandRetrieveByNameParams,
36
26
  type BrandRetrieveByTickerParams,
37
- type BrandRetrieveNaicsParams,
38
27
  type BrandRetrieveSimplifiedParams,
39
- type BrandScreenshotParams,
40
- type BrandStyleguideParams,
41
- type BrandWebScrapeHTMLParams,
42
- type BrandWebScrapeImagesParams,
43
- type BrandWebScrapeMdParams,
44
- type BrandWebScrapeSitemapParams,
45
28
  } from './brand';
29
+ export { Industry, type IndustryRetrieveNaicsResponse, type IndustryRetrieveNaicsParams } from './industry';
30
+ export {
31
+ Style,
32
+ type StyleExtractFontsResponse,
33
+ type StyleExtractStyleguideResponse,
34
+ type StyleExtractFontsParams,
35
+ type StyleExtractStyleguideParams,
36
+ } from './style';
37
+ export {
38
+ Utility,
39
+ type UtilityPrefetchResponse,
40
+ type UtilityPrefetchByEmailResponse,
41
+ type UtilityPrefetchParams,
42
+ type UtilityPrefetchByEmailParams,
43
+ } from './utility';
44
+ export {
45
+ Web,
46
+ type WebScreenshotResponse,
47
+ type WebWebScrapeHTMLResponse,
48
+ type WebWebScrapeImagesResponse,
49
+ type WebWebScrapeMdResponse,
50
+ type WebWebScrapeSitemapResponse,
51
+ type WebScreenshotParams,
52
+ type WebWebScrapeHTMLParams,
53
+ type WebWebScrapeImagesParams,
54
+ type WebWebScrapeMdParams,
55
+ type WebWebScrapeSitemapParams,
56
+ } from './web';
@@ -0,0 +1,92 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Industry extends APIResource {
8
+ /**
9
+ * Endpoint to classify any brand into a 2022 NAICS code.
10
+ */
11
+ retrieveNaics(
12
+ query: IndustryRetrieveNaicsParams,
13
+ options?: RequestOptions,
14
+ ): APIPromise<IndustryRetrieveNaicsResponse> {
15
+ return this._client.get('/brand/naics', { query, ...options });
16
+ }
17
+ }
18
+
19
+ export interface IndustryRetrieveNaicsResponse {
20
+ /**
21
+ * Array of NAICS codes and titles.
22
+ */
23
+ codes?: Array<IndustryRetrieveNaicsResponse.Code>;
24
+
25
+ /**
26
+ * Domain found for the brand
27
+ */
28
+ domain?: string;
29
+
30
+ /**
31
+ * Status of the response, e.g., 'ok'
32
+ */
33
+ status?: string;
34
+
35
+ /**
36
+ * Industry classification type, for naics api it will be `naics`
37
+ */
38
+ type?: string;
39
+ }
40
+
41
+ export namespace IndustryRetrieveNaicsResponse {
42
+ export interface Code {
43
+ /**
44
+ * NAICS code
45
+ */
46
+ code: string;
47
+
48
+ /**
49
+ * Confidence level for how well this NAICS code matches the company description
50
+ */
51
+ confidence: 'high' | 'medium' | 'low';
52
+
53
+ /**
54
+ * NAICS title
55
+ */
56
+ name: string;
57
+ }
58
+ }
59
+
60
+ export interface IndustryRetrieveNaicsParams {
61
+ /**
62
+ * Brand domain or title to retrieve NAICS code for. If a valid domain is provided
63
+ * in `input`, it will be used for classification, otherwise, we will search for
64
+ * the brand using the provided title.
65
+ */
66
+ input: string;
67
+
68
+ /**
69
+ * Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults
70
+ * to 5.
71
+ */
72
+ maxResults?: number;
73
+
74
+ /**
75
+ * Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1.
76
+ */
77
+ minResults?: number;
78
+
79
+ /**
80
+ * Optional timeout in milliseconds for the request. If the request takes longer
81
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
82
+ * value is 300000ms (5 minutes).
83
+ */
84
+ timeoutMS?: number;
85
+ }
86
+
87
+ export declare namespace Industry {
88
+ export {
89
+ type IndustryRetrieveNaicsResponse as IndustryRetrieveNaicsResponse,
90
+ type IndustryRetrieveNaicsParams as IndustryRetrieveNaicsParams,
91
+ };
92
+ }
@@ -0,0 +1,522 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Style extends APIResource {
8
+ /**
9
+ * Extract font information from a brand's website including font families, usage
10
+ * statistics, fallbacks, and element/word counts.
11
+ */
12
+ extractFonts(
13
+ query: StyleExtractFontsParams,
14
+ options?: RequestOptions,
15
+ ): APIPromise<StyleExtractFontsResponse> {
16
+ return this._client.get('/brand/fonts', { query, ...options });
17
+ }
18
+
19
+ /**
20
+ * Automatically extract comprehensive design system information from a brand's
21
+ * website including colors, typography, spacing, shadows, and UI components.
22
+ * Either 'domain' or 'directUrl' must be provided as a query parameter, but not
23
+ * both.
24
+ */
25
+ extractStyleguide(
26
+ query: StyleExtractStyleguideParams | null | undefined = {},
27
+ options?: RequestOptions,
28
+ ): APIPromise<StyleExtractStyleguideResponse> {
29
+ return this._client.get('/brand/styleguide', { query, ...options });
30
+ }
31
+ }
32
+
33
+ export interface StyleExtractFontsResponse {
34
+ /**
35
+ * HTTP status code, e.g., 200
36
+ */
37
+ code: number;
38
+
39
+ /**
40
+ * The normalized domain that was processed
41
+ */
42
+ domain: string;
43
+
44
+ /**
45
+ * Array of font usage information
46
+ */
47
+ fonts: Array<StyleExtractFontsResponse.Font>;
48
+
49
+ /**
50
+ * Status of the response, e.g., 'ok'
51
+ */
52
+ status: string;
53
+ }
54
+
55
+ export namespace StyleExtractFontsResponse {
56
+ export interface Font {
57
+ /**
58
+ * Array of fallback font families
59
+ */
60
+ fallbacks: Array<string>;
61
+
62
+ /**
63
+ * Font family name
64
+ */
65
+ font: string;
66
+
67
+ /**
68
+ * Number of elements using this font
69
+ */
70
+ num_elements: number;
71
+
72
+ /**
73
+ * Number of words using this font
74
+ */
75
+ num_words: number;
76
+
77
+ /**
78
+ * Percentage of elements using this font
79
+ */
80
+ percent_elements: number;
81
+
82
+ /**
83
+ * Percentage of words using this font
84
+ */
85
+ percent_words: number;
86
+
87
+ /**
88
+ * Array of CSS selectors or element types where this font is used
89
+ */
90
+ uses: Array<string>;
91
+ }
92
+ }
93
+
94
+ export interface StyleExtractStyleguideResponse {
95
+ /**
96
+ * HTTP status code
97
+ */
98
+ code?: number;
99
+
100
+ /**
101
+ * The normalized domain that was processed
102
+ */
103
+ domain?: string;
104
+
105
+ /**
106
+ * Status of the response, e.g., 'ok'
107
+ */
108
+ status?: string;
109
+
110
+ /**
111
+ * Comprehensive styleguide data extracted from the website
112
+ */
113
+ styleguide?: StyleExtractStyleguideResponse.Styleguide;
114
+ }
115
+
116
+ export namespace StyleExtractStyleguideResponse {
117
+ /**
118
+ * Comprehensive styleguide data extracted from the website
119
+ */
120
+ export interface Styleguide {
121
+ /**
122
+ * Primary colors used on the website
123
+ */
124
+ colors?: Styleguide.Colors;
125
+
126
+ /**
127
+ * UI component styles
128
+ */
129
+ components?: Styleguide.Components;
130
+
131
+ /**
132
+ * Spacing system used on the website
133
+ */
134
+ elementSpacing?: Styleguide.ElementSpacing;
135
+
136
+ /**
137
+ * The primary color mode of the website design
138
+ */
139
+ mode?: 'light' | 'dark';
140
+
141
+ /**
142
+ * Shadow styles used on the website
143
+ */
144
+ shadows?: Styleguide.Shadows;
145
+
146
+ /**
147
+ * Typography styles used on the website
148
+ */
149
+ typography?: Styleguide.Typography;
150
+ }
151
+
152
+ export namespace Styleguide {
153
+ /**
154
+ * Primary colors used on the website
155
+ */
156
+ export interface Colors {
157
+ /**
158
+ * Accent color of the website (hex format)
159
+ */
160
+ accent?: string;
161
+
162
+ /**
163
+ * Background color of the website (hex format)
164
+ */
165
+ background?: string;
166
+
167
+ /**
168
+ * Text color of the website (hex format)
169
+ */
170
+ text?: string;
171
+ }
172
+
173
+ /**
174
+ * UI component styles
175
+ */
176
+ export interface Components {
177
+ /**
178
+ * Button component styles
179
+ */
180
+ button?: Components.Button;
181
+
182
+ /**
183
+ * Card component style
184
+ */
185
+ card?: Components.Card;
186
+ }
187
+
188
+ export namespace Components {
189
+ /**
190
+ * Button component styles
191
+ */
192
+ export interface Button {
193
+ /**
194
+ * Link button style
195
+ */
196
+ link?: Button.Link;
197
+
198
+ /**
199
+ * Primary button style
200
+ */
201
+ primary?: Button.Primary;
202
+
203
+ /**
204
+ * Secondary button style
205
+ */
206
+ secondary?: Button.Secondary;
207
+ }
208
+
209
+ export namespace Button {
210
+ /**
211
+ * Link button style
212
+ */
213
+ export interface Link {
214
+ backgroundColor?: string;
215
+
216
+ borderColor?: string;
217
+
218
+ borderRadius?: string;
219
+
220
+ borderStyle?: string;
221
+
222
+ borderWidth?: string;
223
+
224
+ boxShadow?: string;
225
+
226
+ color?: string;
227
+
228
+ fontSize?: string;
229
+
230
+ fontWeight?: number;
231
+
232
+ padding?: string;
233
+
234
+ textDecoration?: string;
235
+ }
236
+
237
+ /**
238
+ * Primary button style
239
+ */
240
+ export interface Primary {
241
+ backgroundColor?: string;
242
+
243
+ borderColor?: string;
244
+
245
+ borderRadius?: string;
246
+
247
+ borderStyle?: string;
248
+
249
+ borderWidth?: string;
250
+
251
+ boxShadow?: string;
252
+
253
+ color?: string;
254
+
255
+ fontSize?: string;
256
+
257
+ fontWeight?: number;
258
+
259
+ padding?: string;
260
+
261
+ textDecoration?: string;
262
+ }
263
+
264
+ /**
265
+ * Secondary button style
266
+ */
267
+ export interface Secondary {
268
+ backgroundColor?: string;
269
+
270
+ borderColor?: string;
271
+
272
+ borderRadius?: string;
273
+
274
+ borderStyle?: string;
275
+
276
+ borderWidth?: string;
277
+
278
+ boxShadow?: string;
279
+
280
+ color?: string;
281
+
282
+ fontSize?: string;
283
+
284
+ fontWeight?: number;
285
+
286
+ padding?: string;
287
+
288
+ textDecoration?: string;
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Card component style
294
+ */
295
+ export interface Card {
296
+ backgroundColor?: string;
297
+
298
+ borderColor?: string;
299
+
300
+ borderRadius?: string;
301
+
302
+ borderStyle?: string;
303
+
304
+ borderWidth?: string;
305
+
306
+ boxShadow?: string;
307
+
308
+ padding?: string;
309
+
310
+ textColor?: string;
311
+ }
312
+ }
313
+
314
+ /**
315
+ * Spacing system used on the website
316
+ */
317
+ export interface ElementSpacing {
318
+ /**
319
+ * Large spacing value
320
+ */
321
+ lg?: string;
322
+
323
+ /**
324
+ * Medium spacing value
325
+ */
326
+ md?: string;
327
+
328
+ /**
329
+ * Small spacing value
330
+ */
331
+ sm?: string;
332
+
333
+ /**
334
+ * Extra large spacing value
335
+ */
336
+ xl?: string;
337
+
338
+ /**
339
+ * Extra small spacing value
340
+ */
341
+ xs?: string;
342
+ }
343
+
344
+ /**
345
+ * Shadow styles used on the website
346
+ */
347
+ export interface Shadows {
348
+ /**
349
+ * Inner shadow value
350
+ */
351
+ inner?: string;
352
+
353
+ /**
354
+ * Large shadow value
355
+ */
356
+ lg?: string;
357
+
358
+ /**
359
+ * Medium shadow value
360
+ */
361
+ md?: string;
362
+
363
+ /**
364
+ * Small shadow value
365
+ */
366
+ sm?: string;
367
+
368
+ /**
369
+ * Extra large shadow value
370
+ */
371
+ xl?: string;
372
+ }
373
+
374
+ /**
375
+ * Typography styles used on the website
376
+ */
377
+ export interface Typography {
378
+ /**
379
+ * Heading styles
380
+ */
381
+ headings?: Typography.Headings;
382
+
383
+ /**
384
+ * Paragraph text styles
385
+ */
386
+ p?: Typography.P;
387
+ }
388
+
389
+ export namespace Typography {
390
+ /**
391
+ * Heading styles
392
+ */
393
+ export interface Headings {
394
+ h1?: Headings.H1;
395
+
396
+ h2?: Headings.H2;
397
+
398
+ h3?: Headings.H3;
399
+
400
+ h4?: Headings.H4;
401
+ }
402
+
403
+ export namespace Headings {
404
+ export interface H1 {
405
+ fontFamily?: string;
406
+
407
+ fontSize?: string;
408
+
409
+ fontWeight?: number;
410
+
411
+ letterSpacing?: string;
412
+
413
+ lineHeight?: string;
414
+ }
415
+
416
+ export interface H2 {
417
+ fontFamily?: string;
418
+
419
+ fontSize?: string;
420
+
421
+ fontWeight?: number;
422
+
423
+ letterSpacing?: string;
424
+
425
+ lineHeight?: string;
426
+ }
427
+
428
+ export interface H3 {
429
+ fontFamily?: string;
430
+
431
+ fontSize?: string;
432
+
433
+ fontWeight?: number;
434
+
435
+ letterSpacing?: string;
436
+
437
+ lineHeight?: string;
438
+ }
439
+
440
+ export interface H4 {
441
+ fontFamily?: string;
442
+
443
+ fontSize?: string;
444
+
445
+ fontWeight?: number;
446
+
447
+ letterSpacing?: string;
448
+
449
+ lineHeight?: string;
450
+ }
451
+ }
452
+
453
+ /**
454
+ * Paragraph text styles
455
+ */
456
+ export interface P {
457
+ fontFamily?: string;
458
+
459
+ fontSize?: string;
460
+
461
+ fontWeight?: number;
462
+
463
+ letterSpacing?: string;
464
+
465
+ lineHeight?: string;
466
+ }
467
+ }
468
+ }
469
+ }
470
+
471
+ export interface StyleExtractFontsParams {
472
+ /**
473
+ * Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
474
+ * domain will be automatically normalized and validated.
475
+ */
476
+ domain: string;
477
+
478
+ /**
479
+ * Optional timeout in milliseconds for the request. If the request takes longer
480
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
481
+ * value is 300000ms (5 minutes).
482
+ */
483
+ timeoutMS?: number;
484
+ }
485
+
486
+ export interface StyleExtractStyleguideParams {
487
+ /**
488
+ * A specific URL to fetch the styleguide from directly, bypassing domain
489
+ * resolution (e.g., 'https://example.com/design-system').
490
+ */
491
+ directUrl?: string;
492
+
493
+ /**
494
+ * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
495
+ * domain will be automatically normalized and validated.
496
+ */
497
+ domain?: string;
498
+
499
+ /**
500
+ * Optional parameter to prioritize screenshot capture for styleguide extraction.
501
+ * If 'speed', optimizes for faster capture with basic quality. If 'quality',
502
+ * optimizes for higher quality with longer wait times. Defaults to 'quality' if
503
+ * not provided.
504
+ */
505
+ prioritize?: 'speed' | 'quality';
506
+
507
+ /**
508
+ * Optional timeout in milliseconds for the request. If the request takes longer
509
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
510
+ * value is 300000ms (5 minutes).
511
+ */
512
+ timeoutMS?: number;
513
+ }
514
+
515
+ export declare namespace Style {
516
+ export {
517
+ type StyleExtractFontsResponse as StyleExtractFontsResponse,
518
+ type StyleExtractStyleguideResponse as StyleExtractStyleguideResponse,
519
+ type StyleExtractFontsParams as StyleExtractFontsParams,
520
+ type StyleExtractStyleguideParams as StyleExtractStyleguideParams,
521
+ };
522
+ }