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 @@
1
+ {"version":3,"file":"utility.mjs","sourceRoot":"","sources":["../src/resources/utility.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,IAA2B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CACb,IAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF"}
@@ -0,0 +1,228 @@
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 Web extends APIResource {
5
+ /**
6
+ * Capture a screenshot of a website. Supports both viewport (standard browser
7
+ * view) and full-page screenshots. Can also screenshot specific page types (login,
8
+ * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
9
+ * the uploaded screenshot image hosted on our CDN.
10
+ */
11
+ screenshot(query: WebScreenshotParams, options?: RequestOptions): APIPromise<WebScreenshotResponse>;
12
+ /**
13
+ * Scrapes the given URL and returns the raw HTML content of the page. Uses
14
+ * automatic proxy escalation to handle blocked sites.
15
+ */
16
+ webScrapeHTML(query: WebWebScrapeHTMLParams, options?: RequestOptions): APIPromise<WebWebScrapeHTMLResponse>;
17
+ /**
18
+ * Scrapes all images from the given URL. Extracts images from img, svg,
19
+ * picture/source, link, and video elements including inline SVGs, base64 data
20
+ * URIs, and standard URLs.
21
+ */
22
+ webScrapeImages(query: WebWebScrapeImagesParams, options?: RequestOptions): APIPromise<WebWebScrapeImagesResponse>;
23
+ /**
24
+ * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
25
+ * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
26
+ * sites.
27
+ */
28
+ webScrapeMd(query: WebWebScrapeMdParams, options?: RequestOptions): APIPromise<WebWebScrapeMdResponse>;
29
+ /**
30
+ * Crawls the sitemap of the given domain and returns all discovered page URLs.
31
+ * Supports sitemap index files (recursive), parallel fetching with concurrency
32
+ * control, deduplication, and filters out non-page resources (images, PDFs, etc.).
33
+ */
34
+ webScrapeSitemap(query: WebWebScrapeSitemapParams, options?: RequestOptions): APIPromise<WebWebScrapeSitemapResponse>;
35
+ }
36
+ export interface WebScreenshotResponse {
37
+ /**
38
+ * HTTP status code
39
+ */
40
+ code?: number;
41
+ /**
42
+ * The normalized domain that was processed
43
+ */
44
+ domain?: string;
45
+ /**
46
+ * Public URL of the uploaded screenshot image
47
+ */
48
+ screenshot?: string;
49
+ /**
50
+ * Type of screenshot that was captured
51
+ */
52
+ screenshotType?: 'viewport' | 'fullPage';
53
+ /**
54
+ * Status of the response, e.g., 'ok'
55
+ */
56
+ status?: string;
57
+ }
58
+ export interface WebWebScrapeHTMLResponse {
59
+ /**
60
+ * Raw HTML content of the page
61
+ */
62
+ html: string;
63
+ /**
64
+ * Indicates success
65
+ */
66
+ success: true;
67
+ /**
68
+ * The URL that was scraped
69
+ */
70
+ url: string;
71
+ }
72
+ export interface WebWebScrapeImagesResponse {
73
+ /**
74
+ * Array of scraped images
75
+ */
76
+ images: Array<WebWebScrapeImagesResponse.Image>;
77
+ /**
78
+ * Indicates success
79
+ */
80
+ success: true;
81
+ /**
82
+ * The URL that was scraped
83
+ */
84
+ url: string;
85
+ }
86
+ export declare namespace WebWebScrapeImagesResponse {
87
+ interface Image {
88
+ /**
89
+ * Alt text of the image, or null if not present
90
+ */
91
+ alt: string | null;
92
+ /**
93
+ * The HTML element the image was found in
94
+ */
95
+ element: 'img' | 'svg' | 'link' | 'source' | 'video';
96
+ /**
97
+ * The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI
98
+ */
99
+ src: string;
100
+ /**
101
+ * The type/format of the src value
102
+ */
103
+ type: 'url' | 'html' | 'base64';
104
+ }
105
+ }
106
+ export interface WebWebScrapeMdResponse {
107
+ /**
108
+ * Page content converted to GitHub Flavored Markdown
109
+ */
110
+ markdown: string;
111
+ /**
112
+ * Indicates success
113
+ */
114
+ success: true;
115
+ /**
116
+ * The URL that was scraped
117
+ */
118
+ url: string;
119
+ }
120
+ export interface WebWebScrapeSitemapResponse {
121
+ /**
122
+ * The normalized domain that was crawled
123
+ */
124
+ domain: string;
125
+ /**
126
+ * Metadata about the sitemap crawl operation
127
+ */
128
+ meta: WebWebScrapeSitemapResponse.Meta;
129
+ /**
130
+ * Indicates success
131
+ */
132
+ success: true;
133
+ /**
134
+ * Array of discovered page URLs from the sitemap (max 500)
135
+ */
136
+ urls: Array<string>;
137
+ }
138
+ export declare namespace WebWebScrapeSitemapResponse {
139
+ /**
140
+ * Metadata about the sitemap crawl operation
141
+ */
142
+ interface Meta {
143
+ /**
144
+ * Number of errors encountered during crawling
145
+ */
146
+ errors: number;
147
+ /**
148
+ * Total number of sitemap files discovered
149
+ */
150
+ sitemapsDiscovered: number;
151
+ /**
152
+ * Number of sitemap files successfully fetched and parsed
153
+ */
154
+ sitemapsFetched: number;
155
+ /**
156
+ * Number of sitemap files skipped (due to errors, timeouts, or limits)
157
+ */
158
+ sitemapsSkipped: number;
159
+ }
160
+ }
161
+ export interface WebScreenshotParams {
162
+ /**
163
+ * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
164
+ * domain will be automatically normalized and validated.
165
+ */
166
+ domain: string;
167
+ /**
168
+ * Optional parameter to determine screenshot type. If 'true', takes a full page
169
+ * screenshot capturing all content. If 'false' or not provided, takes a viewport
170
+ * screenshot (standard browser view).
171
+ */
172
+ fullScreenshot?: 'true' | 'false';
173
+ /**
174
+ * Optional parameter to specify which page type to screenshot. If provided, the
175
+ * system will scrape the domain's links and use heuristics to find the most
176
+ * appropriate URL for the specified page type (30 supported languages). If not
177
+ * provided, screenshots the main domain landing page.
178
+ */
179
+ page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact';
180
+ /**
181
+ * Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
182
+ * faster capture with basic quality. If 'quality', optimizes for higher quality
183
+ * with longer wait times. Defaults to 'quality' if not provided.
184
+ */
185
+ prioritize?: 'speed' | 'quality';
186
+ }
187
+ export interface WebWebScrapeHTMLParams {
188
+ /**
189
+ * Full URL to scrape (must include http:// or https:// protocol)
190
+ */
191
+ url: string;
192
+ }
193
+ export interface WebWebScrapeImagesParams {
194
+ /**
195
+ * Full URL to scrape images from (must include http:// or https:// protocol)
196
+ */
197
+ url: string;
198
+ }
199
+ export interface WebWebScrapeMdParams {
200
+ /**
201
+ * Full URL to scrape and convert to markdown (must include http:// or https://
202
+ * protocol)
203
+ */
204
+ url: string;
205
+ /**
206
+ * Include image references in Markdown output
207
+ */
208
+ includeImages?: boolean;
209
+ /**
210
+ * Preserve hyperlinks in Markdown output
211
+ */
212
+ includeLinks?: boolean;
213
+ /**
214
+ * Shorten base64-encoded image data in the Markdown output
215
+ */
216
+ shortenBase64Images?: boolean;
217
+ }
218
+ export interface WebWebScrapeSitemapParams {
219
+ /**
220
+ * Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
221
+ * automatically normalized and validated.
222
+ */
223
+ domain: string;
224
+ }
225
+ export declare namespace Web {
226
+ export { type WebScreenshotResponse as WebScreenshotResponse, type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, type WebWebScrapeMdResponse as WebWebScrapeMdResponse, type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, type WebScreenshotParams as WebScreenshotParams, type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, type WebWebScrapeImagesParams as WebWebScrapeImagesParams, type WebWebScrapeMdParams as WebWebScrapeMdParams, type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams, };
227
+ }
228
+ //# sourceMappingURL=web.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.mts","sourceRoot":"","sources":["../src/resources/web.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,GAAI,SAAQ,WAAW;IAClC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAInG;;;OAGG;IACH,aAAa,CACX,KAAK,EAAE,sBAAsB,EAC7B,OAAO,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M,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
@@ -0,0 +1,228 @@
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 Web extends APIResource {
5
+ /**
6
+ * Capture a screenshot of a website. Supports both viewport (standard browser
7
+ * view) and full-page screenshots. Can also screenshot specific page types (login,
8
+ * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
9
+ * the uploaded screenshot image hosted on our CDN.
10
+ */
11
+ screenshot(query: WebScreenshotParams, options?: RequestOptions): APIPromise<WebScreenshotResponse>;
12
+ /**
13
+ * Scrapes the given URL and returns the raw HTML content of the page. Uses
14
+ * automatic proxy escalation to handle blocked sites.
15
+ */
16
+ webScrapeHTML(query: WebWebScrapeHTMLParams, options?: RequestOptions): APIPromise<WebWebScrapeHTMLResponse>;
17
+ /**
18
+ * Scrapes all images from the given URL. Extracts images from img, svg,
19
+ * picture/source, link, and video elements including inline SVGs, base64 data
20
+ * URIs, and standard URLs.
21
+ */
22
+ webScrapeImages(query: WebWebScrapeImagesParams, options?: RequestOptions): APIPromise<WebWebScrapeImagesResponse>;
23
+ /**
24
+ * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
25
+ * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
26
+ * sites.
27
+ */
28
+ webScrapeMd(query: WebWebScrapeMdParams, options?: RequestOptions): APIPromise<WebWebScrapeMdResponse>;
29
+ /**
30
+ * Crawls the sitemap of the given domain and returns all discovered page URLs.
31
+ * Supports sitemap index files (recursive), parallel fetching with concurrency
32
+ * control, deduplication, and filters out non-page resources (images, PDFs, etc.).
33
+ */
34
+ webScrapeSitemap(query: WebWebScrapeSitemapParams, options?: RequestOptions): APIPromise<WebWebScrapeSitemapResponse>;
35
+ }
36
+ export interface WebScreenshotResponse {
37
+ /**
38
+ * HTTP status code
39
+ */
40
+ code?: number;
41
+ /**
42
+ * The normalized domain that was processed
43
+ */
44
+ domain?: string;
45
+ /**
46
+ * Public URL of the uploaded screenshot image
47
+ */
48
+ screenshot?: string;
49
+ /**
50
+ * Type of screenshot that was captured
51
+ */
52
+ screenshotType?: 'viewport' | 'fullPage';
53
+ /**
54
+ * Status of the response, e.g., 'ok'
55
+ */
56
+ status?: string;
57
+ }
58
+ export interface WebWebScrapeHTMLResponse {
59
+ /**
60
+ * Raw HTML content of the page
61
+ */
62
+ html: string;
63
+ /**
64
+ * Indicates success
65
+ */
66
+ success: true;
67
+ /**
68
+ * The URL that was scraped
69
+ */
70
+ url: string;
71
+ }
72
+ export interface WebWebScrapeImagesResponse {
73
+ /**
74
+ * Array of scraped images
75
+ */
76
+ images: Array<WebWebScrapeImagesResponse.Image>;
77
+ /**
78
+ * Indicates success
79
+ */
80
+ success: true;
81
+ /**
82
+ * The URL that was scraped
83
+ */
84
+ url: string;
85
+ }
86
+ export declare namespace WebWebScrapeImagesResponse {
87
+ interface Image {
88
+ /**
89
+ * Alt text of the image, or null if not present
90
+ */
91
+ alt: string | null;
92
+ /**
93
+ * The HTML element the image was found in
94
+ */
95
+ element: 'img' | 'svg' | 'link' | 'source' | 'video';
96
+ /**
97
+ * The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI
98
+ */
99
+ src: string;
100
+ /**
101
+ * The type/format of the src value
102
+ */
103
+ type: 'url' | 'html' | 'base64';
104
+ }
105
+ }
106
+ export interface WebWebScrapeMdResponse {
107
+ /**
108
+ * Page content converted to GitHub Flavored Markdown
109
+ */
110
+ markdown: string;
111
+ /**
112
+ * Indicates success
113
+ */
114
+ success: true;
115
+ /**
116
+ * The URL that was scraped
117
+ */
118
+ url: string;
119
+ }
120
+ export interface WebWebScrapeSitemapResponse {
121
+ /**
122
+ * The normalized domain that was crawled
123
+ */
124
+ domain: string;
125
+ /**
126
+ * Metadata about the sitemap crawl operation
127
+ */
128
+ meta: WebWebScrapeSitemapResponse.Meta;
129
+ /**
130
+ * Indicates success
131
+ */
132
+ success: true;
133
+ /**
134
+ * Array of discovered page URLs from the sitemap (max 500)
135
+ */
136
+ urls: Array<string>;
137
+ }
138
+ export declare namespace WebWebScrapeSitemapResponse {
139
+ /**
140
+ * Metadata about the sitemap crawl operation
141
+ */
142
+ interface Meta {
143
+ /**
144
+ * Number of errors encountered during crawling
145
+ */
146
+ errors: number;
147
+ /**
148
+ * Total number of sitemap files discovered
149
+ */
150
+ sitemapsDiscovered: number;
151
+ /**
152
+ * Number of sitemap files successfully fetched and parsed
153
+ */
154
+ sitemapsFetched: number;
155
+ /**
156
+ * Number of sitemap files skipped (due to errors, timeouts, or limits)
157
+ */
158
+ sitemapsSkipped: number;
159
+ }
160
+ }
161
+ export interface WebScreenshotParams {
162
+ /**
163
+ * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
164
+ * domain will be automatically normalized and validated.
165
+ */
166
+ domain: string;
167
+ /**
168
+ * Optional parameter to determine screenshot type. If 'true', takes a full page
169
+ * screenshot capturing all content. If 'false' or not provided, takes a viewport
170
+ * screenshot (standard browser view).
171
+ */
172
+ fullScreenshot?: 'true' | 'false';
173
+ /**
174
+ * Optional parameter to specify which page type to screenshot. If provided, the
175
+ * system will scrape the domain's links and use heuristics to find the most
176
+ * appropriate URL for the specified page type (30 supported languages). If not
177
+ * provided, screenshots the main domain landing page.
178
+ */
179
+ page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact';
180
+ /**
181
+ * Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
182
+ * faster capture with basic quality. If 'quality', optimizes for higher quality
183
+ * with longer wait times. Defaults to 'quality' if not provided.
184
+ */
185
+ prioritize?: 'speed' | 'quality';
186
+ }
187
+ export interface WebWebScrapeHTMLParams {
188
+ /**
189
+ * Full URL to scrape (must include http:// or https:// protocol)
190
+ */
191
+ url: string;
192
+ }
193
+ export interface WebWebScrapeImagesParams {
194
+ /**
195
+ * Full URL to scrape images from (must include http:// or https:// protocol)
196
+ */
197
+ url: string;
198
+ }
199
+ export interface WebWebScrapeMdParams {
200
+ /**
201
+ * Full URL to scrape and convert to markdown (must include http:// or https://
202
+ * protocol)
203
+ */
204
+ url: string;
205
+ /**
206
+ * Include image references in Markdown output
207
+ */
208
+ includeImages?: boolean;
209
+ /**
210
+ * Preserve hyperlinks in Markdown output
211
+ */
212
+ includeLinks?: boolean;
213
+ /**
214
+ * Shorten base64-encoded image data in the Markdown output
215
+ */
216
+ shortenBase64Images?: boolean;
217
+ }
218
+ export interface WebWebScrapeSitemapParams {
219
+ /**
220
+ * Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
221
+ * automatically normalized and validated.
222
+ */
223
+ domain: string;
224
+ }
225
+ export declare namespace Web {
226
+ export { type WebScreenshotResponse as WebScreenshotResponse, type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, type WebWebScrapeMdResponse as WebWebScrapeMdResponse, type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, type WebScreenshotParams as WebScreenshotParams, type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, type WebWebScrapeImagesParams as WebWebScrapeImagesParams, type WebWebScrapeMdParams as WebWebScrapeMdParams, type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams, };
227
+ }
228
+ //# sourceMappingURL=web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/resources/web.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,GAAI,SAAQ,WAAW;IAClC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAInG;;;OAGG;IACH,aAAa,CACX,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;OAIG;IACH,eAAe,CACb,KAAK,EAAE,wBAAwB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,0BAA0B,CAAC;IAIzC;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAItG;;;;OAIG;IACH,gBAAgB,CACd,KAAK,EAAE,yBAAyB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2BAA2B,CAAC;CAG3C;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAA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BAAmB,EAC/C,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Web = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ class Web extends resource_1.APIResource {
7
+ /**
8
+ * Capture a screenshot of a website. Supports both viewport (standard browser
9
+ * view) and full-page screenshots. Can also screenshot specific page types (login,
10
+ * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
11
+ * the uploaded screenshot image hosted on our CDN.
12
+ */
13
+ screenshot(query, options) {
14
+ return this._client.get('/brand/screenshot', { query, ...options });
15
+ }
16
+ /**
17
+ * Scrapes the given URL and returns the raw HTML content of the page. Uses
18
+ * automatic proxy escalation to handle blocked sites.
19
+ */
20
+ webScrapeHTML(query, options) {
21
+ return this._client.get('/web/scrape/html', { query, ...options });
22
+ }
23
+ /**
24
+ * Scrapes all images from the given URL. Extracts images from img, svg,
25
+ * picture/source, link, and video elements including inline SVGs, base64 data
26
+ * URIs, and standard URLs.
27
+ */
28
+ webScrapeImages(query, options) {
29
+ return this._client.get('/web/scrape/images', { query, ...options });
30
+ }
31
+ /**
32
+ * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
33
+ * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
34
+ * sites.
35
+ */
36
+ webScrapeMd(query, options) {
37
+ return this._client.get('/web/scrape/markdown', { query, ...options });
38
+ }
39
+ /**
40
+ * Crawls the sitemap of the given domain and returns all discovered page URLs.
41
+ * Supports sitemap index files (recursive), parallel fetching with concurrency
42
+ * control, deduplication, and filters out non-page resources (images, PDFs, etc.).
43
+ */
44
+ webScrapeSitemap(query, options) {
45
+ return this._client.get('/web/scrape/sitemap', { query, ...options });
46
+ }
47
+ }
48
+ exports.Web = Web;
49
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../src/resources/web.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,GAAI,SAAQ,sBAAW;IAClC;;;;;OAKG;IACH,UAAU,CAAC,KAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,aAAa,CACX,KAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,eAAe,CACb,KAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,KAA2B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CACd,KAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF;AAtDD,kBAsDC"}
@@ -0,0 +1,45 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class Web extends APIResource {
4
+ /**
5
+ * Capture a screenshot of a website. Supports both viewport (standard browser
6
+ * view) and full-page screenshots. Can also screenshot specific page types (login,
7
+ * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
8
+ * the uploaded screenshot image hosted on our CDN.
9
+ */
10
+ screenshot(query, options) {
11
+ return this._client.get('/brand/screenshot', { query, ...options });
12
+ }
13
+ /**
14
+ * Scrapes the given URL and returns the raw HTML content of the page. Uses
15
+ * automatic proxy escalation to handle blocked sites.
16
+ */
17
+ webScrapeHTML(query, options) {
18
+ return this._client.get('/web/scrape/html', { query, ...options });
19
+ }
20
+ /**
21
+ * Scrapes all images from the given URL. Extracts images from img, svg,
22
+ * picture/source, link, and video elements including inline SVGs, base64 data
23
+ * URIs, and standard URLs.
24
+ */
25
+ webScrapeImages(query, options) {
26
+ return this._client.get('/web/scrape/images', { query, ...options });
27
+ }
28
+ /**
29
+ * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
30
+ * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
31
+ * sites.
32
+ */
33
+ webScrapeMd(query, options) {
34
+ return this._client.get('/web/scrape/markdown', { query, ...options });
35
+ }
36
+ /**
37
+ * Crawls the sitemap of the given domain and returns all discovered page URLs.
38
+ * Supports sitemap index files (recursive), parallel fetching with concurrency
39
+ * control, deduplication, and filters out non-page resources (images, PDFs, etc.).
40
+ */
41
+ webScrapeSitemap(query, options) {
42
+ return this._client.get('/web/scrape/sitemap', { query, ...options });
43
+ }
44
+ }
45
+ //# sourceMappingURL=web.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.mjs","sourceRoot":"","sources":["../src/resources/web.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,GAAI,SAAQ,WAAW;IAClC;;;;;OAKG;IACH,UAAU,CAAC,KAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,aAAa,CACX,KAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,eAAe,CACb,KAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,KAA2B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CACd,KAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF"}