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,105 @@
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 Utility extends APIResource {
8
+ /**
9
+ * Signal that you may fetch brand data for a particular domain soon to improve
10
+ * latency. This endpoint does not charge credits and is available for paid
11
+ * customers to optimize future requests. [You must be on a paid plan to use this
12
+ * endpoint]
13
+ */
14
+ prefetch(body: UtilityPrefetchParams, options?: RequestOptions): APIPromise<UtilityPrefetchResponse> {
15
+ return this._client.post('/brand/prefetch', { body, ...options });
16
+ }
17
+
18
+ /**
19
+ * Signal that you may fetch brand data for a particular domain soon to improve
20
+ * latency. This endpoint accepts an email address, extracts the domain from it,
21
+ * validates that it's not a disposable or free email provider, and queues the
22
+ * domain for prefetching. This endpoint does not charge credits and is available
23
+ * for paid customers to optimize future requests. [You must be on a paid plan to
24
+ * use this endpoint]
25
+ */
26
+ prefetchByEmail(
27
+ body: UtilityPrefetchByEmailParams,
28
+ options?: RequestOptions,
29
+ ): APIPromise<UtilityPrefetchByEmailResponse> {
30
+ return this._client.post('/brand/prefetch-by-email', { body, ...options });
31
+ }
32
+ }
33
+
34
+ export interface UtilityPrefetchResponse {
35
+ /**
36
+ * The domain that was queued for prefetching
37
+ */
38
+ domain?: string;
39
+
40
+ /**
41
+ * Success message
42
+ */
43
+ message?: string;
44
+
45
+ /**
46
+ * Status of the response, e.g., 'ok'
47
+ */
48
+ status?: string;
49
+ }
50
+
51
+ export interface UtilityPrefetchByEmailResponse {
52
+ /**
53
+ * The domain that was queued for prefetching
54
+ */
55
+ domain?: string;
56
+
57
+ /**
58
+ * Success message
59
+ */
60
+ message?: string;
61
+
62
+ /**
63
+ * Status of the response, e.g., 'ok'
64
+ */
65
+ status?: string;
66
+ }
67
+
68
+ export interface UtilityPrefetchParams {
69
+ /**
70
+ * Domain name to prefetch brand data for
71
+ */
72
+ domain: string;
73
+
74
+ /**
75
+ * Optional timeout in milliseconds for the request. If the request takes longer
76
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
77
+ * value is 300000ms (5 minutes).
78
+ */
79
+ timeoutMS?: number;
80
+ }
81
+
82
+ export interface UtilityPrefetchByEmailParams {
83
+ /**
84
+ * Email address to prefetch brand data for. The domain will be extracted from the
85
+ * email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
86
+ * addresses are not allowed.
87
+ */
88
+ email: string;
89
+
90
+ /**
91
+ * Optional timeout in milliseconds for the request. If the request takes longer
92
+ * than this value, it will be aborted with a 408 status code. Maximum allowed
93
+ * value is 300000ms (5 minutes).
94
+ */
95
+ timeoutMS?: number;
96
+ }
97
+
98
+ export declare namespace Utility {
99
+ export {
100
+ type UtilityPrefetchResponse as UtilityPrefetchResponse,
101
+ type UtilityPrefetchByEmailResponse as UtilityPrefetchByEmailResponse,
102
+ type UtilityPrefetchParams as UtilityPrefetchParams,
103
+ type UtilityPrefetchByEmailParams as UtilityPrefetchByEmailParams,
104
+ };
105
+ }
@@ -0,0 +1,302 @@
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 Web extends APIResource {
8
+ /**
9
+ * Capture a screenshot of a website. Supports both viewport (standard browser
10
+ * view) and full-page screenshots. Can also screenshot specific page types (login,
11
+ * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
12
+ * the uploaded screenshot image hosted on our CDN.
13
+ */
14
+ screenshot(query: WebScreenshotParams, options?: RequestOptions): APIPromise<WebScreenshotResponse> {
15
+ return this._client.get('/brand/screenshot', { query, ...options });
16
+ }
17
+
18
+ /**
19
+ * Scrapes the given URL and returns the raw HTML content of the page. Uses
20
+ * automatic proxy escalation to handle blocked sites.
21
+ */
22
+ webScrapeHTML(
23
+ query: WebWebScrapeHTMLParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<WebWebScrapeHTMLResponse> {
26
+ return this._client.get('/web/scrape/html', { query, ...options });
27
+ }
28
+
29
+ /**
30
+ * Scrapes all images from the given URL. Extracts images from img, svg,
31
+ * picture/source, link, and video elements including inline SVGs, base64 data
32
+ * URIs, and standard URLs.
33
+ */
34
+ webScrapeImages(
35
+ query: WebWebScrapeImagesParams,
36
+ options?: RequestOptions,
37
+ ): APIPromise<WebWebScrapeImagesResponse> {
38
+ return this._client.get('/web/scrape/images', { query, ...options });
39
+ }
40
+
41
+ /**
42
+ * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
43
+ * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
44
+ * sites.
45
+ */
46
+ webScrapeMd(query: WebWebScrapeMdParams, options?: RequestOptions): APIPromise<WebWebScrapeMdResponse> {
47
+ return this._client.get('/web/scrape/markdown', { query, ...options });
48
+ }
49
+
50
+ /**
51
+ * Crawls the sitemap of the given domain and returns all discovered page URLs.
52
+ * Supports sitemap index files (recursive), parallel fetching with concurrency
53
+ * control, deduplication, and filters out non-page resources (images, PDFs, etc.).
54
+ */
55
+ webScrapeSitemap(
56
+ query: WebWebScrapeSitemapParams,
57
+ options?: RequestOptions,
58
+ ): APIPromise<WebWebScrapeSitemapResponse> {
59
+ return this._client.get('/web/scrape/sitemap', { query, ...options });
60
+ }
61
+ }
62
+
63
+ export interface WebScreenshotResponse {
64
+ /**
65
+ * HTTP status code
66
+ */
67
+ code?: number;
68
+
69
+ /**
70
+ * The normalized domain that was processed
71
+ */
72
+ domain?: string;
73
+
74
+ /**
75
+ * Public URL of the uploaded screenshot image
76
+ */
77
+ screenshot?: string;
78
+
79
+ /**
80
+ * Type of screenshot that was captured
81
+ */
82
+ screenshotType?: 'viewport' | 'fullPage';
83
+
84
+ /**
85
+ * Status of the response, e.g., 'ok'
86
+ */
87
+ status?: string;
88
+ }
89
+
90
+ export interface WebWebScrapeHTMLResponse {
91
+ /**
92
+ * Raw HTML content of the page
93
+ */
94
+ html: string;
95
+
96
+ /**
97
+ * Indicates success
98
+ */
99
+ success: true;
100
+
101
+ /**
102
+ * The URL that was scraped
103
+ */
104
+ url: string;
105
+ }
106
+
107
+ export interface WebWebScrapeImagesResponse {
108
+ /**
109
+ * Array of scraped images
110
+ */
111
+ images: Array<WebWebScrapeImagesResponse.Image>;
112
+
113
+ /**
114
+ * Indicates success
115
+ */
116
+ success: true;
117
+
118
+ /**
119
+ * The URL that was scraped
120
+ */
121
+ url: string;
122
+ }
123
+
124
+ export namespace WebWebScrapeImagesResponse {
125
+ export interface Image {
126
+ /**
127
+ * Alt text of the image, or null if not present
128
+ */
129
+ alt: string | null;
130
+
131
+ /**
132
+ * The HTML element the image was found in
133
+ */
134
+ element: 'img' | 'svg' | 'link' | 'source' | 'video';
135
+
136
+ /**
137
+ * The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI
138
+ */
139
+ src: string;
140
+
141
+ /**
142
+ * The type/format of the src value
143
+ */
144
+ type: 'url' | 'html' | 'base64';
145
+ }
146
+ }
147
+
148
+ export interface WebWebScrapeMdResponse {
149
+ /**
150
+ * Page content converted to GitHub Flavored Markdown
151
+ */
152
+ markdown: string;
153
+
154
+ /**
155
+ * Indicates success
156
+ */
157
+ success: true;
158
+
159
+ /**
160
+ * The URL that was scraped
161
+ */
162
+ url: string;
163
+ }
164
+
165
+ export interface WebWebScrapeSitemapResponse {
166
+ /**
167
+ * The normalized domain that was crawled
168
+ */
169
+ domain: string;
170
+
171
+ /**
172
+ * Metadata about the sitemap crawl operation
173
+ */
174
+ meta: WebWebScrapeSitemapResponse.Meta;
175
+
176
+ /**
177
+ * Indicates success
178
+ */
179
+ success: true;
180
+
181
+ /**
182
+ * Array of discovered page URLs from the sitemap (max 500)
183
+ */
184
+ urls: Array<string>;
185
+ }
186
+
187
+ export namespace WebWebScrapeSitemapResponse {
188
+ /**
189
+ * Metadata about the sitemap crawl operation
190
+ */
191
+ export interface Meta {
192
+ /**
193
+ * Number of errors encountered during crawling
194
+ */
195
+ errors: number;
196
+
197
+ /**
198
+ * Total number of sitemap files discovered
199
+ */
200
+ sitemapsDiscovered: number;
201
+
202
+ /**
203
+ * Number of sitemap files successfully fetched and parsed
204
+ */
205
+ sitemapsFetched: number;
206
+
207
+ /**
208
+ * Number of sitemap files skipped (due to errors, timeouts, or limits)
209
+ */
210
+ sitemapsSkipped: number;
211
+ }
212
+ }
213
+
214
+ export interface WebScreenshotParams {
215
+ /**
216
+ * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
217
+ * domain will be automatically normalized and validated.
218
+ */
219
+ domain: string;
220
+
221
+ /**
222
+ * Optional parameter to determine screenshot type. If 'true', takes a full page
223
+ * screenshot capturing all content. If 'false' or not provided, takes a viewport
224
+ * screenshot (standard browser view).
225
+ */
226
+ fullScreenshot?: 'true' | 'false';
227
+
228
+ /**
229
+ * Optional parameter to specify which page type to screenshot. If provided, the
230
+ * system will scrape the domain's links and use heuristics to find the most
231
+ * appropriate URL for the specified page type (30 supported languages). If not
232
+ * provided, screenshots the main domain landing page.
233
+ */
234
+ page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact';
235
+
236
+ /**
237
+ * Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
238
+ * faster capture with basic quality. If 'quality', optimizes for higher quality
239
+ * with longer wait times. Defaults to 'quality' if not provided.
240
+ */
241
+ prioritize?: 'speed' | 'quality';
242
+ }
243
+
244
+ export interface WebWebScrapeHTMLParams {
245
+ /**
246
+ * Full URL to scrape (must include http:// or https:// protocol)
247
+ */
248
+ url: string;
249
+ }
250
+
251
+ export interface WebWebScrapeImagesParams {
252
+ /**
253
+ * Full URL to scrape images from (must include http:// or https:// protocol)
254
+ */
255
+ url: string;
256
+ }
257
+
258
+ export interface WebWebScrapeMdParams {
259
+ /**
260
+ * Full URL to scrape and convert to markdown (must include http:// or https://
261
+ * protocol)
262
+ */
263
+ url: string;
264
+
265
+ /**
266
+ * Include image references in Markdown output
267
+ */
268
+ includeImages?: boolean;
269
+
270
+ /**
271
+ * Preserve hyperlinks in Markdown output
272
+ */
273
+ includeLinks?: boolean;
274
+
275
+ /**
276
+ * Shorten base64-encoded image data in the Markdown output
277
+ */
278
+ shortenBase64Images?: boolean;
279
+ }
280
+
281
+ export interface WebWebScrapeSitemapParams {
282
+ /**
283
+ * Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
284
+ * automatically normalized and validated.
285
+ */
286
+ domain: string;
287
+ }
288
+
289
+ export declare namespace Web {
290
+ export {
291
+ type WebScreenshotResponse as WebScreenshotResponse,
292
+ type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse,
293
+ type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse,
294
+ type WebWebScrapeMdResponse as WebWebScrapeMdResponse,
295
+ type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse,
296
+ type WebScreenshotParams as WebScreenshotParams,
297
+ type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams,
298
+ type WebWebScrapeImagesParams as WebWebScrapeImagesParams,
299
+ type WebWebScrapeMdParams as WebWebScrapeMdParams,
300
+ type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams,
301
+ };
302
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.0'; // x-release-please-version
4
+ exports.VERSION = '0.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map