screenshotone-api-sdk 1.1.15 → 1.1.16

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.
@@ -80,28 +80,29 @@ export declare class TakeOptions {
80
80
  /**
81
81
  * Selector is a CSS-like selector of the element to take a screenshot of.
82
82
  */
83
- selector(selector: string): this;
83
+ selector(selector: string): TakeOptions;
84
84
  /**
85
85
  * Available response types:
86
86
  * by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
87
87
  * empty — return only status or error. It is suitable when you want to upload the screenshot to storage and don't care about the results. It also speeds up the response since there are no networking costs involved.
88
+ * json — A method returns the response in the JSON format, but it is only suitable if you use options that are effective for JSON. By default, the JSON response will be empty. But for example, when you use caching, the JSON will be populated with additional data.
88
89
  * The default value is by_format.
89
90
  */
90
- responseType(responseType: string): this;
91
+ responseType(responseType: string): TakeOptions;
91
92
  /**
92
93
  * It determines the behavior of what to do when selector is not found.
93
94
  */
94
- errorOnSelectorNotFound(errorOn: boolean): this;
95
+ errorOnSelectorNotFound(errorOn: boolean): TakeOptions;
95
96
  /**
96
97
  * Capture beyond the viewport.
97
98
  */
98
- captureBeyondViewport(beyond: boolean): this;
99
+ captureBeyondViewport(beyond: boolean): TakeOptions;
99
100
  /**
100
101
  * When reduced_motion set to `true`,
101
102
  * the API will request the site to minimize the amount of non-essential motion it uses.
102
103
  * When the site supports it, it should use animations as least as possible.
103
104
  */
104
- reducedMotion(darkMode: boolean): TakeOptions;
105
+ reducedMotion(reducedMotion: boolean): TakeOptions;
105
106
  /**
106
107
  * If you want to request the page and it is supported to be rendered for printers, specify `print`.
107
108
  * If the page is by default rendered for printers and you want it to be rendered for screens,
@@ -122,7 +123,7 @@ export declare class TakeOptions {
122
123
  */
123
124
  hideSelectors(...selectors: string[]): TakeOptions;
124
125
  /**
125
- * The scripts_wain_until option allows you to wait until a given
126
+ * The scripts_wait_until option allows you to wait until a given
126
127
  * set of events after the scripts were executed.
127
128
  * It accepts the same values as wait_until and can have multiple values:
128
129
  * - `load`: the navigation is successful when the load even is fired;
@@ -134,11 +135,11 @@ export declare class TakeOptions {
134
135
  /**
135
136
  * Styles specifies custom CSS styles for the page.
136
137
  */
137
- styles(styles: string): this;
138
+ styles(styles: string): TakeOptions;
138
139
  /**
139
140
  * Scripts specifies custom scripts for the page.
140
141
  */
141
- scripts(scripts: string): this;
142
+ scripts(scripts: string): TakeOptions;
142
143
  /**
143
144
  * Renders the full page.
144
145
  */
@@ -148,7 +149,7 @@ export declare class TakeOptions {
148
149
  */
149
150
  fullPageMaxHeight(maxHeight: number): TakeOptions;
150
151
  /**
151
- * Sets response format, one of: "png", "jpeg", "webp" or "jpg".
152
+ * Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
152
153
  */
153
154
  format(format: string): TakeOptions;
154
155
  /**
@@ -176,7 +177,7 @@ export declare class TakeOptions {
176
177
  /**
177
178
  * Sets IP country code.
178
179
  */
179
- ipCountryCode(format: string): TakeOptions;
180
+ ipCountryCode(countryCode: string): TakeOptions;
180
181
  /**
181
182
  * Renders image with the specified quality. Available for the next formats: "jpeg" ("jpg"), "webp".
182
183
  */
@@ -369,6 +370,98 @@ export declare class TakeOptions {
369
370
  * Storage class allows you to specify the object storage class.
370
371
  */
371
372
  storageClass(storageClass: string): TakeOptions;
373
+ /**
374
+ * Sets the image width for thumbnail creation.
375
+ */
376
+ imageWidth(width: number): TakeOptions;
377
+ /**
378
+ * Sets the image height for thumbnail creation.
379
+ */
380
+ imageHeight(height: number): TakeOptions;
381
+ /**
382
+ * Sets whether to request GPU rendering.
383
+ */
384
+ requestGpuRendering(request: boolean): TakeOptions;
385
+ /**
386
+ * Sets whether to print background for PDF.
387
+ */
388
+ pdfPrintBackground(print: boolean): TakeOptions;
389
+ /**
390
+ * Sets whether to fit PDF to one page.
391
+ */
392
+ pdfFitOnePage(fit: boolean): TakeOptions;
393
+ /**
394
+ * Sets the OpenAI API key for vision integration.
395
+ */
396
+ openAiApiKey(key: string): TakeOptions;
397
+ /**
398
+ * Sets the vision prompt for OpenAI integration.
399
+ */
400
+ visionPrompt(prompt: string): TakeOptions;
401
+ /**
402
+ * Sets the maximum tokens for OpenAI vision response.
403
+ */
404
+ visionMaxTokens(tokens: number): TakeOptions;
405
+ /**
406
+ * Sets whether to bypass Content Security Policy.
407
+ */
408
+ bypassCsp(bypass: boolean): TakeOptions;
409
+ /**
410
+ * Sets whether to wait for a specific selector.
411
+ */
412
+ waitForSelector(selector: string): TakeOptions;
413
+ /**
414
+ * Sets whether to return the storage location.
415
+ */
416
+ storageReturnLocation(return_location: boolean): TakeOptions;
417
+ /**
418
+ * Sets whether to include image size metadata.
419
+ */
420
+ metadataImageSize(include: boolean): TakeOptions;
421
+ /**
422
+ * Sets whether to include fonts metadata.
423
+ */
424
+ metadataFonts(include: boolean): TakeOptions;
425
+ /**
426
+ * Sets whether to include Open Graph metadata.
427
+ */
428
+ metadataOpenGraph(include: boolean): TakeOptions;
429
+ /**
430
+ * Sets whether to include page title metadata.
431
+ */
432
+ metadataPageTitle(include: boolean): TakeOptions;
433
+ /**
434
+ * Sets whether to include content metadata.
435
+ */
436
+ metadataContent(include: boolean): TakeOptions;
437
+ /**
438
+ * Sets whether to include HTTP response status code metadata.
439
+ */
440
+ metadataHttpResponseStatusCode(include: boolean): TakeOptions;
441
+ /**
442
+ * Sets whether to include HTTP response headers metadata.
443
+ */
444
+ metadataHttpResponseHeaders(include: boolean): TakeOptions;
445
+ /**
446
+ * Sets whether to execute the request asynchronously.
447
+ */
448
+ async(isAsync: boolean): TakeOptions;
449
+ /**
450
+ * Sets the webhook URL for asynchronous requests.
451
+ */
452
+ webhookUrl(url: string): TakeOptions;
453
+ /**
454
+ * Sets whether to sign the webhook request.
455
+ */
456
+ webhookSign(sign: boolean): TakeOptions;
457
+ /**
458
+ * Sets the text to check for in the content to force request failure.
459
+ */
460
+ failIfContentContains(text: string): TakeOptions;
461
+ /**
462
+ * Sets whether to fail if GPU rendering fails.
463
+ */
464
+ failIfGpuRenderingFails(fail: boolean): TakeOptions;
372
465
  toQuery(): URLSearchParams;
373
466
  }
374
467
  /**
@@ -632,5 +725,81 @@ export declare class AnimateOptions {
632
725
  * for some reason, you need to render error pages.
633
726
  */
634
727
  ignoreHostErrors(ignore: boolean): AnimateOptions;
728
+ /**
729
+ * Sets whether to request GPU rendering.
730
+ */
731
+ requestGpuRendering(request: boolean): AnimateOptions;
732
+ /**
733
+ * Sets whether to bypass Content Security Policy.
734
+ */
735
+ bypassCsp(bypass: boolean): AnimateOptions;
736
+ /**
737
+ * Sets whether to wait for a specific selector.
738
+ */
739
+ waitForSelector(selector: string): AnimateOptions;
740
+ /**
741
+ * Sets whether to return the storage location.
742
+ */
743
+ storageReturnLocation(return_location: boolean): AnimateOptions;
744
+ /**
745
+ * Sets whether to execute the request asynchronously.
746
+ */
747
+ async(isAsync: boolean): AnimateOptions;
748
+ /**
749
+ * Sets the webhook URL for asynchronous requests.
750
+ */
751
+ webhookUrl(url: string): AnimateOptions;
752
+ /**
753
+ * Sets whether to sign the webhook request.
754
+ */
755
+ webhookSign(sign: boolean): AnimateOptions;
756
+ /**
757
+ * Sets the text to check for in the content to force request failure.
758
+ */
759
+ failIfContentContains(text: string): AnimateOptions;
760
+ /**
761
+ * Sets whether to fail if GPU rendering fails.
762
+ */
763
+ failIfGpuRenderingFails(fail: boolean): AnimateOptions;
764
+ /**
765
+ * Sets the width of the animation.
766
+ */
767
+ width(width: number): AnimateOptions;
768
+ /**
769
+ * Sets the height of the animation.
770
+ */
771
+ height(height: number): AnimateOptions;
772
+ /**
773
+ * Sets the aspect ratio of the animation.
774
+ */
775
+ aspectRatio(ratio: string): AnimateOptions;
776
+ /**
777
+ * Sets the scroll easing effect.
778
+ */
779
+ scrollEasing(easing: string): AnimateOptions;
780
+ /**
781
+ * Sets whether to navigate while scrolling and record the new opened page.
782
+ */
783
+ scrollTryNavigate(tryNavigate: boolean): AnimateOptions;
784
+ /**
785
+ * Sets when to navigate after scrolling (in milliseconds).
786
+ */
787
+ scrollNavigateAfter(duration: number): AnimateOptions;
788
+ /**
789
+ * Sets the URL to navigate to while scrolling.
790
+ */
791
+ scrollNavigateToURL(url: string): AnimateOptions;
792
+ /**
793
+ * Sets the link hints for navigation while scrolling.
794
+ */
795
+ scrollNavigateLinkHints(...hints: string[]): AnimateOptions;
796
+ /**
797
+ * Sets the scroll back algorithm.
798
+ */
799
+ scrollBackAlgorithm(algorithm: string): AnimateOptions;
800
+ /**
801
+ * Sets when to stop scrolling after the specified duration in milliseconds.
802
+ */
803
+ scrollStopAfterDuration(duration: number): AnimateOptions;
635
804
  toQuery(): URLSearchParams;
636
805
  }
package/dist/main.js CHANGED
@@ -202,6 +202,7 @@ class TakeOptions {
202
202
  * Available response types:
203
203
  * by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
204
204
  * empty — return only status or error. It is suitable when you want to upload the screenshot to storage and don't care about the results. It also speeds up the response since there are no networking costs involved.
205
+ * json — A method returns the response in the JSON format, but it is only suitable if you use options that are effective for JSON. By default, the JSON response will be empty. But for example, when you use caching, the JSON will be populated with additional data.
205
206
  * The default value is by_format.
206
207
  */
207
208
  responseType(responseType) {
@@ -227,8 +228,8 @@ class TakeOptions {
227
228
  * the API will request the site to minimize the amount of non-essential motion it uses.
228
229
  * When the site supports it, it should use animations as least as possible.
229
230
  */
230
- reducedMotion(darkMode) {
231
- this.put("reduced_motion", darkMode ? "true" : "false");
231
+ reducedMotion(reducedMotion) {
232
+ this.put("reduced_motion", reducedMotion ? "true" : "false");
232
233
  return this;
233
234
  }
234
235
  /**
@@ -260,7 +261,7 @@ class TakeOptions {
260
261
  return this;
261
262
  }
262
263
  /**
263
- * The scripts_wain_until option allows you to wait until a given
264
+ * The scripts_wait_until option allows you to wait until a given
264
265
  * set of events after the scripts were executed.
265
266
  * It accepts the same values as wait_until and can have multiple values:
266
267
  * - `load`: the navigation is successful when the load even is fired;
@@ -301,7 +302,7 @@ class TakeOptions {
301
302
  return this;
302
303
  }
303
304
  /**
304
- * Sets response format, one of: "png", "jpeg", "webp" or "jpg".
305
+ * Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
305
306
  */
306
307
  format(format) {
307
308
  this.put("format", format);
@@ -338,8 +339,8 @@ class TakeOptions {
338
339
  /**
339
340
  * Sets IP country code.
340
341
  */
341
- ipCountryCode(format) {
342
- this.put("ip_country_code", format);
342
+ ipCountryCode(countryCode) {
343
+ this.put("ip_country_code", countryCode);
343
344
  return this;
344
345
  }
345
346
  /**
@@ -666,6 +667,167 @@ class TakeOptions {
666
667
  this.put("storage_class", storageClass);
667
668
  return this;
668
669
  }
670
+ /**
671
+ * Sets the image width for thumbnail creation.
672
+ */
673
+ imageWidth(width) {
674
+ this.put("image_width", width.toString());
675
+ return this;
676
+ }
677
+ /**
678
+ * Sets the image height for thumbnail creation.
679
+ */
680
+ imageHeight(height) {
681
+ this.put("image_height", height.toString());
682
+ return this;
683
+ }
684
+ /**
685
+ * Sets whether to request GPU rendering.
686
+ */
687
+ requestGpuRendering(request) {
688
+ this.put("request_gpu_rendering", request ? "true" : "false");
689
+ return this;
690
+ }
691
+ /**
692
+ * Sets whether to print background for PDF.
693
+ */
694
+ pdfPrintBackground(print) {
695
+ this.put("pdf_print_background", print ? "true" : "false");
696
+ return this;
697
+ }
698
+ /**
699
+ * Sets whether to fit PDF to one page.
700
+ */
701
+ pdfFitOnePage(fit) {
702
+ this.put("pdf_fit_one_page", fit ? "true" : "false");
703
+ return this;
704
+ }
705
+ /**
706
+ * Sets the OpenAI API key for vision integration.
707
+ */
708
+ openAiApiKey(key) {
709
+ this.put("openai_api_key", key);
710
+ return this;
711
+ }
712
+ /**
713
+ * Sets the vision prompt for OpenAI integration.
714
+ */
715
+ visionPrompt(prompt) {
716
+ this.put("vision_prompt", prompt);
717
+ return this;
718
+ }
719
+ /**
720
+ * Sets the maximum tokens for OpenAI vision response.
721
+ */
722
+ visionMaxTokens(tokens) {
723
+ this.put("vision_max_tokens", tokens.toString());
724
+ return this;
725
+ }
726
+ /**
727
+ * Sets whether to bypass Content Security Policy.
728
+ */
729
+ bypassCsp(bypass) {
730
+ this.put("bypass_csp", bypass ? "true" : "false");
731
+ return this;
732
+ }
733
+ /**
734
+ * Sets whether to wait for a specific selector.
735
+ */
736
+ waitForSelector(selector) {
737
+ this.put("wait_for_selector", selector);
738
+ return this;
739
+ }
740
+ /**
741
+ * Sets whether to return the storage location.
742
+ */
743
+ storageReturnLocation(return_location) {
744
+ this.put("storage_return_location", return_location ? "true" : "false");
745
+ return this;
746
+ }
747
+ /**
748
+ * Sets whether to include image size metadata.
749
+ */
750
+ metadataImageSize(include) {
751
+ this.put("metadata_image_size", include ? "true" : "false");
752
+ return this;
753
+ }
754
+ /**
755
+ * Sets whether to include fonts metadata.
756
+ */
757
+ metadataFonts(include) {
758
+ this.put("metadata_fonts", include ? "true" : "false");
759
+ return this;
760
+ }
761
+ /**
762
+ * Sets whether to include Open Graph metadata.
763
+ */
764
+ metadataOpenGraph(include) {
765
+ this.put("metadata_open_graph", include ? "true" : "false");
766
+ return this;
767
+ }
768
+ /**
769
+ * Sets whether to include page title metadata.
770
+ */
771
+ metadataPageTitle(include) {
772
+ this.put("metadata_page_title", include ? "true" : "false");
773
+ return this;
774
+ }
775
+ /**
776
+ * Sets whether to include content metadata.
777
+ */
778
+ metadataContent(include) {
779
+ this.put("metadata_content", include ? "true" : "false");
780
+ return this;
781
+ }
782
+ /**
783
+ * Sets whether to include HTTP response status code metadata.
784
+ */
785
+ metadataHttpResponseStatusCode(include) {
786
+ this.put("metadata_http_response_status_code", include ? "true" : "false");
787
+ return this;
788
+ }
789
+ /**
790
+ * Sets whether to include HTTP response headers metadata.
791
+ */
792
+ metadataHttpResponseHeaders(include) {
793
+ this.put("metadata_http_response_headers", include ? "true" : "false");
794
+ return this;
795
+ }
796
+ /**
797
+ * Sets whether to execute the request asynchronously.
798
+ */
799
+ async(isAsync) {
800
+ this.put("async", isAsync ? "true" : "false");
801
+ return this;
802
+ }
803
+ /**
804
+ * Sets the webhook URL for asynchronous requests.
805
+ */
806
+ webhookUrl(url) {
807
+ this.put("webhook_url", url);
808
+ return this;
809
+ }
810
+ /**
811
+ * Sets whether to sign the webhook request.
812
+ */
813
+ webhookSign(sign) {
814
+ this.put("webhook_sign", sign ? "true" : "false");
815
+ return this;
816
+ }
817
+ /**
818
+ * Sets the text to check for in the content to force request failure.
819
+ */
820
+ failIfContentContains(text) {
821
+ this.put("fail_if_content_contains", text);
822
+ return this;
823
+ }
824
+ /**
825
+ * Sets whether to fail if GPU rendering fails.
826
+ */
827
+ failIfGpuRenderingFails(fail) {
828
+ this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
829
+ return this;
830
+ }
669
831
  toQuery() {
670
832
  return new URLSearchParams(this.query.toString());
671
833
  }
@@ -1126,6 +1288,139 @@ class AnimateOptions {
1126
1288
  this.put("ignore_host_errors", ignore ? "true" : "false");
1127
1289
  return this;
1128
1290
  }
1291
+ /**
1292
+ * Sets whether to request GPU rendering.
1293
+ */
1294
+ requestGpuRendering(request) {
1295
+ this.put("request_gpu_rendering", request ? "true" : "false");
1296
+ return this;
1297
+ }
1298
+ /**
1299
+ * Sets whether to bypass Content Security Policy.
1300
+ */
1301
+ bypassCsp(bypass) {
1302
+ this.put("bypass_csp", bypass ? "true" : "false");
1303
+ return this;
1304
+ }
1305
+ /**
1306
+ * Sets whether to wait for a specific selector.
1307
+ */
1308
+ waitForSelector(selector) {
1309
+ this.put("wait_for_selector", selector);
1310
+ return this;
1311
+ }
1312
+ /**
1313
+ * Sets whether to return the storage location.
1314
+ */
1315
+ storageReturnLocation(return_location) {
1316
+ this.put("storage_return_location", return_location ? "true" : "false");
1317
+ return this;
1318
+ }
1319
+ /**
1320
+ * Sets whether to execute the request asynchronously.
1321
+ */
1322
+ async(isAsync) {
1323
+ this.put("async", isAsync ? "true" : "false");
1324
+ return this;
1325
+ }
1326
+ /**
1327
+ * Sets the webhook URL for asynchronous requests.
1328
+ */
1329
+ webhookUrl(url) {
1330
+ this.put("webhook_url", url);
1331
+ return this;
1332
+ }
1333
+ /**
1334
+ * Sets whether to sign the webhook request.
1335
+ */
1336
+ webhookSign(sign) {
1337
+ this.put("webhook_sign", sign ? "true" : "false");
1338
+ return this;
1339
+ }
1340
+ /**
1341
+ * Sets the text to check for in the content to force request failure.
1342
+ */
1343
+ failIfContentContains(text) {
1344
+ this.put("fail_if_content_contains", text);
1345
+ return this;
1346
+ }
1347
+ /**
1348
+ * Sets whether to fail if GPU rendering fails.
1349
+ */
1350
+ failIfGpuRenderingFails(fail) {
1351
+ this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
1352
+ return this;
1353
+ }
1354
+ /**
1355
+ * Sets the width of the animation.
1356
+ */
1357
+ width(width) {
1358
+ this.put("width", width.toString());
1359
+ return this;
1360
+ }
1361
+ /**
1362
+ * Sets the height of the animation.
1363
+ */
1364
+ height(height) {
1365
+ this.put("height", height.toString());
1366
+ return this;
1367
+ }
1368
+ /**
1369
+ * Sets the aspect ratio of the animation.
1370
+ */
1371
+ aspectRatio(ratio) {
1372
+ this.put("aspect_ratio", ratio);
1373
+ return this;
1374
+ }
1375
+ /**
1376
+ * Sets the scroll easing effect.
1377
+ */
1378
+ scrollEasing(easing) {
1379
+ this.put("scroll_easing", easing);
1380
+ return this;
1381
+ }
1382
+ /**
1383
+ * Sets whether to navigate while scrolling and record the new opened page.
1384
+ */
1385
+ scrollTryNavigate(tryNavigate) {
1386
+ this.put("scroll_try_navigate", tryNavigate ? "true" : "false");
1387
+ return this;
1388
+ }
1389
+ /**
1390
+ * Sets when to navigate after scrolling (in milliseconds).
1391
+ */
1392
+ scrollNavigateAfter(duration) {
1393
+ this.put("scroll_navigate_after", duration.toString());
1394
+ return this;
1395
+ }
1396
+ /**
1397
+ * Sets the URL to navigate to while scrolling.
1398
+ */
1399
+ scrollNavigateToURL(url) {
1400
+ this.put("scroll_navigate_to_url", url);
1401
+ return this;
1402
+ }
1403
+ /**
1404
+ * Sets the link hints for navigation while scrolling.
1405
+ */
1406
+ scrollNavigateLinkHints(...hints) {
1407
+ this.put("scroll_navigate_link_hints", ...hints);
1408
+ return this;
1409
+ }
1410
+ /**
1411
+ * Sets the scroll back algorithm.
1412
+ */
1413
+ scrollBackAlgorithm(algorithm) {
1414
+ this.put("scroll_back_algorithm", algorithm);
1415
+ return this;
1416
+ }
1417
+ /**
1418
+ * Sets when to stop scrolling after the specified duration in milliseconds.
1419
+ */
1420
+ scrollStopAfterDuration(duration) {
1421
+ this.put("scroll_stop_after_duration", duration.toString());
1422
+ return this;
1423
+ }
1129
1424
  toQuery() {
1130
1425
  return new URLSearchParams(this.query.toString());
1131
1426
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "screenshotone-api-sdk",
3
3
  "homepage": "https://screenshotone.com",
4
- "version": "1.1.15",
4
+ "version": "1.1.16",
5
5
  "description": "Use ScreenshotOne.com API to generate screenshots of any website.",
6
6
  "repository": {
7
7
  "type": "git",
package/src/main.ts CHANGED
@@ -250,7 +250,7 @@ export class TakeOptions {
250
250
  /**
251
251
  * Selector is a CSS-like selector of the element to take a screenshot of.
252
252
  */
253
- selector(selector: string) {
253
+ selector(selector: string): TakeOptions {
254
254
  this.put("selector", selector);
255
255
 
256
256
  return this;
@@ -260,9 +260,10 @@ export class TakeOptions {
260
260
  * Available response types:
261
261
  * by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
262
262
  * empty — return only status or error. It is suitable when you want to upload the screenshot to storage and don't care about the results. It also speeds up the response since there are no networking costs involved.
263
+ * json — A method returns the response in the JSON format, but it is only suitable if you use options that are effective for JSON. By default, the JSON response will be empty. But for example, when you use caching, the JSON will be populated with additional data.
263
264
  * The default value is by_format.
264
265
  */
265
- responseType(responseType: string) {
266
+ responseType(responseType: string): TakeOptions {
266
267
  this.put("response_type", responseType);
267
268
 
268
269
  return this;
@@ -271,7 +272,7 @@ export class TakeOptions {
271
272
  /**
272
273
  * It determines the behavior of what to do when selector is not found.
273
274
  */
274
- errorOnSelectorNotFound(errorOn: boolean) {
275
+ errorOnSelectorNotFound(errorOn: boolean): TakeOptions {
275
276
  this.put("error_on_selector_not_found", errorOn ? "true" : "false");
276
277
 
277
278
  return this;
@@ -280,7 +281,7 @@ export class TakeOptions {
280
281
  /**
281
282
  * Capture beyond the viewport.
282
283
  */
283
- captureBeyondViewport(beyond: boolean) {
284
+ captureBeyondViewport(beyond: boolean): TakeOptions {
284
285
  this.put("capture_beyond_viewport", beyond ? "true" : "false");
285
286
 
286
287
  return this;
@@ -291,8 +292,8 @@ export class TakeOptions {
291
292
  * the API will request the site to minimize the amount of non-essential motion it uses.
292
293
  * When the site supports it, it should use animations as least as possible.
293
294
  */
294
- reducedMotion(darkMode: boolean): TakeOptions {
295
- this.put("reduced_motion", darkMode ? "true" : "false");
295
+ reducedMotion(reducedMotion: boolean): TakeOptions {
296
+ this.put("reduced_motion", reducedMotion ? "true" : "false");
296
297
 
297
298
  return this;
298
299
  }
@@ -332,7 +333,7 @@ export class TakeOptions {
332
333
  }
333
334
 
334
335
  /**
335
- * The scripts_wain_until option allows you to wait until a given
336
+ * The scripts_wait_until option allows you to wait until a given
336
337
  * set of events after the scripts were executed.
337
338
  * It accepts the same values as wait_until and can have multiple values:
338
339
  * - `load`: the navigation is successful when the load even is fired;
@@ -349,7 +350,7 @@ export class TakeOptions {
349
350
  /**
350
351
  * Styles specifies custom CSS styles for the page.
351
352
  */
352
- styles(styles: string) {
353
+ styles(styles: string): TakeOptions {
353
354
  this.put("styles", styles);
354
355
 
355
356
  return this;
@@ -358,7 +359,7 @@ export class TakeOptions {
358
359
  /**
359
360
  * Scripts specifies custom scripts for the page.
360
361
  */
361
- scripts(scripts: string) {
362
+ scripts(scripts: string): TakeOptions {
362
363
  this.put("scripts", scripts);
363
364
 
364
365
  return this;
@@ -383,7 +384,7 @@ export class TakeOptions {
383
384
  }
384
385
 
385
386
  /**
386
- * Sets response format, one of: "png", "jpeg", "webp" or "jpg".
387
+ * Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
387
388
  */
388
389
  format(format: string): TakeOptions {
389
390
  this.put("format", format);
@@ -426,8 +427,8 @@ export class TakeOptions {
426
427
  /**
427
428
  * Sets IP country code.
428
429
  */
429
- ipCountryCode(format: string): TakeOptions {
430
- this.put("ip_country_code", format);
430
+ ipCountryCode(countryCode: string): TakeOptions {
431
+ this.put("ip_country_code", countryCode);
431
432
 
432
433
  return this;
433
434
  }
@@ -850,6 +851,213 @@ export class TakeOptions {
850
851
  return this;
851
852
  }
852
853
 
854
+ /**
855
+ * Sets the image width for thumbnail creation.
856
+ */
857
+ imageWidth(width: number): TakeOptions {
858
+ this.put("image_width", width.toString());
859
+
860
+ return this;
861
+ }
862
+
863
+ /**
864
+ * Sets the image height for thumbnail creation.
865
+ */
866
+ imageHeight(height: number): TakeOptions {
867
+ this.put("image_height", height.toString());
868
+
869
+ return this;
870
+ }
871
+
872
+ /**
873
+ * Sets whether to request GPU rendering.
874
+ */
875
+ requestGpuRendering(request: boolean): TakeOptions {
876
+ this.put("request_gpu_rendering", request ? "true" : "false");
877
+
878
+ return this;
879
+ }
880
+
881
+ /**
882
+ * Sets whether to print background for PDF.
883
+ */
884
+ pdfPrintBackground(print: boolean): TakeOptions {
885
+ this.put("pdf_print_background", print ? "true" : "false");
886
+
887
+ return this;
888
+ }
889
+
890
+ /**
891
+ * Sets whether to fit PDF to one page.
892
+ */
893
+ pdfFitOnePage(fit: boolean): TakeOptions {
894
+ this.put("pdf_fit_one_page", fit ? "true" : "false");
895
+
896
+ return this;
897
+ }
898
+
899
+ /**
900
+ * Sets the OpenAI API key for vision integration.
901
+ */
902
+ openAiApiKey(key: string): TakeOptions {
903
+ this.put("openai_api_key", key);
904
+
905
+ return this;
906
+ }
907
+
908
+ /**
909
+ * Sets the vision prompt for OpenAI integration.
910
+ */
911
+ visionPrompt(prompt: string): TakeOptions {
912
+ this.put("vision_prompt", prompt);
913
+
914
+ return this;
915
+ }
916
+
917
+ /**
918
+ * Sets the maximum tokens for OpenAI vision response.
919
+ */
920
+ visionMaxTokens(tokens: number): TakeOptions {
921
+ this.put("vision_max_tokens", tokens.toString());
922
+
923
+ return this;
924
+ }
925
+
926
+ /**
927
+ * Sets whether to bypass Content Security Policy.
928
+ */
929
+ bypassCsp(bypass: boolean): TakeOptions {
930
+ this.put("bypass_csp", bypass ? "true" : "false");
931
+
932
+ return this;
933
+ }
934
+
935
+ /**
936
+ * Sets whether to wait for a specific selector.
937
+ */
938
+ waitForSelector(selector: string): TakeOptions {
939
+ this.put("wait_for_selector", selector);
940
+
941
+ return this;
942
+ }
943
+
944
+ /**
945
+ * Sets whether to return the storage location.
946
+ */
947
+ storageReturnLocation(return_location: boolean): TakeOptions {
948
+ this.put("storage_return_location", return_location ? "true" : "false");
949
+
950
+ return this;
951
+ }
952
+
953
+ /**
954
+ * Sets whether to include image size metadata.
955
+ */
956
+ metadataImageSize(include: boolean): TakeOptions {
957
+ this.put("metadata_image_size", include ? "true" : "false");
958
+
959
+ return this;
960
+ }
961
+
962
+ /**
963
+ * Sets whether to include fonts metadata.
964
+ */
965
+ metadataFonts(include: boolean): TakeOptions {
966
+ this.put("metadata_fonts", include ? "true" : "false");
967
+
968
+ return this;
969
+ }
970
+
971
+ /**
972
+ * Sets whether to include Open Graph metadata.
973
+ */
974
+ metadataOpenGraph(include: boolean): TakeOptions {
975
+ this.put("metadata_open_graph", include ? "true" : "false");
976
+
977
+ return this;
978
+ }
979
+
980
+ /**
981
+ * Sets whether to include page title metadata.
982
+ */
983
+ metadataPageTitle(include: boolean): TakeOptions {
984
+ this.put("metadata_page_title", include ? "true" : "false");
985
+
986
+ return this;
987
+ }
988
+
989
+ /**
990
+ * Sets whether to include content metadata.
991
+ */
992
+ metadataContent(include: boolean): TakeOptions {
993
+ this.put("metadata_content", include ? "true" : "false");
994
+
995
+ return this;
996
+ }
997
+
998
+ /**
999
+ * Sets whether to include HTTP response status code metadata.
1000
+ */
1001
+ metadataHttpResponseStatusCode(include: boolean): TakeOptions {
1002
+ this.put("metadata_http_response_status_code", include ? "true" : "false");
1003
+
1004
+ return this;
1005
+ }
1006
+
1007
+ /**
1008
+ * Sets whether to include HTTP response headers metadata.
1009
+ */
1010
+ metadataHttpResponseHeaders(include: boolean): TakeOptions {
1011
+ this.put("metadata_http_response_headers", include ? "true" : "false");
1012
+
1013
+ return this;
1014
+ }
1015
+
1016
+ /**
1017
+ * Sets whether to execute the request asynchronously.
1018
+ */
1019
+ async(isAsync: boolean): TakeOptions {
1020
+ this.put("async", isAsync ? "true" : "false");
1021
+
1022
+ return this;
1023
+ }
1024
+
1025
+ /**
1026
+ * Sets the webhook URL for asynchronous requests.
1027
+ */
1028
+ webhookUrl(url: string): TakeOptions {
1029
+ this.put("webhook_url", url);
1030
+
1031
+ return this;
1032
+ }
1033
+
1034
+ /**
1035
+ * Sets whether to sign the webhook request.
1036
+ */
1037
+ webhookSign(sign: boolean): TakeOptions {
1038
+ this.put("webhook_sign", sign ? "true" : "false");
1039
+
1040
+ return this;
1041
+ }
1042
+
1043
+ /**
1044
+ * Sets the text to check for in the content to force request failure.
1045
+ */
1046
+ failIfContentContains(text: string): TakeOptions {
1047
+ this.put("fail_if_content_contains", text);
1048
+
1049
+ return this;
1050
+ }
1051
+
1052
+ /**
1053
+ * Sets whether to fail if GPU rendering fails.
1054
+ */
1055
+ failIfGpuRenderingFails(fail: boolean): TakeOptions {
1056
+ this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
1057
+
1058
+ return this;
1059
+ }
1060
+
853
1061
  toQuery(): URLSearchParams {
854
1062
  return new URLSearchParams(this.query.toString());
855
1063
  }
@@ -1441,6 +1649,178 @@ export class AnimateOptions {
1441
1649
  return this;
1442
1650
  }
1443
1651
 
1652
+ /**
1653
+ * Sets whether to request GPU rendering.
1654
+ */
1655
+ requestGpuRendering(request: boolean): AnimateOptions {
1656
+ this.put("request_gpu_rendering", request ? "true" : "false");
1657
+
1658
+ return this;
1659
+ }
1660
+
1661
+ /**
1662
+ * Sets whether to bypass Content Security Policy.
1663
+ */
1664
+ bypassCsp(bypass: boolean): AnimateOptions {
1665
+ this.put("bypass_csp", bypass ? "true" : "false");
1666
+
1667
+ return this;
1668
+ }
1669
+
1670
+ /**
1671
+ * Sets whether to wait for a specific selector.
1672
+ */
1673
+ waitForSelector(selector: string): AnimateOptions {
1674
+ this.put("wait_for_selector", selector);
1675
+
1676
+ return this;
1677
+ }
1678
+
1679
+ /**
1680
+ * Sets whether to return the storage location.
1681
+ */
1682
+ storageReturnLocation(return_location: boolean): AnimateOptions {
1683
+ this.put("storage_return_location", return_location ? "true" : "false");
1684
+
1685
+ return this;
1686
+ }
1687
+
1688
+ /**
1689
+ * Sets whether to execute the request asynchronously.
1690
+ */
1691
+ async(isAsync: boolean): AnimateOptions {
1692
+ this.put("async", isAsync ? "true" : "false");
1693
+
1694
+ return this;
1695
+ }
1696
+
1697
+ /**
1698
+ * Sets the webhook URL for asynchronous requests.
1699
+ */
1700
+ webhookUrl(url: string): AnimateOptions {
1701
+ this.put("webhook_url", url);
1702
+
1703
+ return this;
1704
+ }
1705
+
1706
+ /**
1707
+ * Sets whether to sign the webhook request.
1708
+ */
1709
+ webhookSign(sign: boolean): AnimateOptions {
1710
+ this.put("webhook_sign", sign ? "true" : "false");
1711
+
1712
+ return this;
1713
+ }
1714
+
1715
+ /**
1716
+ * Sets the text to check for in the content to force request failure.
1717
+ */
1718
+ failIfContentContains(text: string): AnimateOptions {
1719
+ this.put("fail_if_content_contains", text);
1720
+
1721
+ return this;
1722
+ }
1723
+
1724
+ /**
1725
+ * Sets whether to fail if GPU rendering fails.
1726
+ */
1727
+ failIfGpuRenderingFails(fail: boolean): AnimateOptions {
1728
+ this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
1729
+
1730
+ return this;
1731
+ }
1732
+
1733
+
1734
+ /**
1735
+ * Sets the width of the animation.
1736
+ */
1737
+ width(width: number): AnimateOptions {
1738
+ this.put("width", width.toString());
1739
+
1740
+ return this;
1741
+ }
1742
+
1743
+ /**
1744
+ * Sets the height of the animation.
1745
+ */
1746
+ height(height: number): AnimateOptions {
1747
+ this.put("height", height.toString());
1748
+
1749
+ return this;
1750
+ }
1751
+
1752
+ /**
1753
+ * Sets the aspect ratio of the animation.
1754
+ */
1755
+ aspectRatio(ratio: string): AnimateOptions {
1756
+ this.put("aspect_ratio", ratio);
1757
+
1758
+ return this;
1759
+ }
1760
+
1761
+ /**
1762
+ * Sets the scroll easing effect.
1763
+ */
1764
+ scrollEasing(easing: string): AnimateOptions {
1765
+ this.put("scroll_easing", easing);
1766
+
1767
+ return this;
1768
+ }
1769
+
1770
+ /**
1771
+ * Sets whether to navigate while scrolling and record the new opened page.
1772
+ */
1773
+ scrollTryNavigate(tryNavigate: boolean): AnimateOptions {
1774
+ this.put("scroll_try_navigate", tryNavigate ? "true" : "false");
1775
+
1776
+ return this;
1777
+ }
1778
+
1779
+ /**
1780
+ * Sets when to navigate after scrolling (in milliseconds).
1781
+ */
1782
+ scrollNavigateAfter(duration: number): AnimateOptions {
1783
+ this.put("scroll_navigate_after", duration.toString());
1784
+
1785
+ return this;
1786
+ }
1787
+
1788
+ /**
1789
+ * Sets the URL to navigate to while scrolling.
1790
+ */
1791
+ scrollNavigateToURL(url: string): AnimateOptions {
1792
+ this.put("scroll_navigate_to_url", url);
1793
+
1794
+ return this;
1795
+ }
1796
+
1797
+ /**
1798
+ * Sets the link hints for navigation while scrolling.
1799
+ */
1800
+ scrollNavigateLinkHints(...hints: string[]): AnimateOptions {
1801
+ this.put("scroll_navigate_link_hints", ...hints);
1802
+
1803
+ return this;
1804
+ }
1805
+
1806
+ /**
1807
+ * Sets the scroll back algorithm.
1808
+ */
1809
+ scrollBackAlgorithm(algorithm: string): AnimateOptions {
1810
+ this.put("scroll_back_algorithm", algorithm);
1811
+
1812
+ return this;
1813
+ }
1814
+
1815
+ /**
1816
+ * Sets when to stop scrolling after the specified duration in milliseconds.
1817
+ */
1818
+ scrollStopAfterDuration(duration: number): AnimateOptions {
1819
+ this.put("scroll_stop_after_duration", duration.toString());
1820
+ return this;
1821
+ }
1822
+
1823
+
1444
1824
  toQuery(): URLSearchParams {
1445
1825
  return new URLSearchParams(this.query.toString());
1446
1826
  }