screenshotone-api-sdk 1.1.15 → 1.1.17
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.
- package/dist/@types/main.d.ts +183 -10
- package/dist/main.js +308 -6
- package/package.json +1 -1
- package/src/main.ts +401 -12
package/dist/@types/main.d.ts
CHANGED
|
@@ -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):
|
|
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):
|
|
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):
|
|
95
|
+
errorOnSelectorNotFound(errorOn: boolean): TakeOptions;
|
|
95
96
|
/**
|
|
96
97
|
* Capture beyond the viewport.
|
|
97
98
|
*/
|
|
98
|
-
captureBeyondViewport(beyond: boolean):
|
|
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(
|
|
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
|
|
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):
|
|
138
|
+
styles(styles: string): TakeOptions;
|
|
138
139
|
/**
|
|
139
140
|
* Scripts specifies custom scripts for the page.
|
|
140
141
|
*/
|
|
141
|
-
scripts(scripts: string):
|
|
142
|
+
scripts(scripts: string): TakeOptions;
|
|
142
143
|
/**
|
|
143
144
|
* Renders the full page.
|
|
144
145
|
*/
|
|
@@ -148,7 +149,11 @@ export declare class TakeOptions {
|
|
|
148
149
|
*/
|
|
149
150
|
fullPageMaxHeight(maxHeight: number): TakeOptions;
|
|
150
151
|
/**
|
|
151
|
-
* Sets
|
|
152
|
+
* Sets the algorithm to use for full page screenshot—"by_sections" or ""/"default".
|
|
153
|
+
*/
|
|
154
|
+
fullPageAlgorithm(algorithm: string): TakeOptions;
|
|
155
|
+
/**
|
|
156
|
+
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
152
157
|
*/
|
|
153
158
|
format(format: string): TakeOptions;
|
|
154
159
|
/**
|
|
@@ -176,7 +181,7 @@ export declare class TakeOptions {
|
|
|
176
181
|
/**
|
|
177
182
|
* Sets IP country code.
|
|
178
183
|
*/
|
|
179
|
-
ipCountryCode(
|
|
184
|
+
ipCountryCode(countryCode: string): TakeOptions;
|
|
180
185
|
/**
|
|
181
186
|
* Renders image with the specified quality. Available for the next formats: "jpeg" ("jpg"), "webp".
|
|
182
187
|
*/
|
|
@@ -369,6 +374,98 @@ export declare class TakeOptions {
|
|
|
369
374
|
* Storage class allows you to specify the object storage class.
|
|
370
375
|
*/
|
|
371
376
|
storageClass(storageClass: string): TakeOptions;
|
|
377
|
+
/**
|
|
378
|
+
* Sets the image width for thumbnail creation.
|
|
379
|
+
*/
|
|
380
|
+
imageWidth(width: number): TakeOptions;
|
|
381
|
+
/**
|
|
382
|
+
* Sets the image height for thumbnail creation.
|
|
383
|
+
*/
|
|
384
|
+
imageHeight(height: number): TakeOptions;
|
|
385
|
+
/**
|
|
386
|
+
* Sets whether to request GPU rendering.
|
|
387
|
+
*/
|
|
388
|
+
requestGpuRendering(request: boolean): TakeOptions;
|
|
389
|
+
/**
|
|
390
|
+
* Sets whether to print background for PDF.
|
|
391
|
+
*/
|
|
392
|
+
pdfPrintBackground(print: boolean): TakeOptions;
|
|
393
|
+
/**
|
|
394
|
+
* Sets whether to fit PDF to one page.
|
|
395
|
+
*/
|
|
396
|
+
pdfFitOnePage(fit: boolean): TakeOptions;
|
|
397
|
+
/**
|
|
398
|
+
* Sets the OpenAI API key for vision integration.
|
|
399
|
+
*/
|
|
400
|
+
openAiApiKey(key: string): TakeOptions;
|
|
401
|
+
/**
|
|
402
|
+
* Sets the vision prompt for OpenAI integration.
|
|
403
|
+
*/
|
|
404
|
+
visionPrompt(prompt: string): TakeOptions;
|
|
405
|
+
/**
|
|
406
|
+
* Sets the maximum tokens for OpenAI vision response.
|
|
407
|
+
*/
|
|
408
|
+
visionMaxTokens(tokens: number): TakeOptions;
|
|
409
|
+
/**
|
|
410
|
+
* Sets whether to bypass Content Security Policy.
|
|
411
|
+
*/
|
|
412
|
+
bypassCsp(bypass: boolean): TakeOptions;
|
|
413
|
+
/**
|
|
414
|
+
* Sets whether to wait for a specific selector.
|
|
415
|
+
*/
|
|
416
|
+
waitForSelector(selector: string): TakeOptions;
|
|
417
|
+
/**
|
|
418
|
+
* Sets whether to return the storage location.
|
|
419
|
+
*/
|
|
420
|
+
storageReturnLocation(return_location: boolean): TakeOptions;
|
|
421
|
+
/**
|
|
422
|
+
* Sets whether to include image size metadata.
|
|
423
|
+
*/
|
|
424
|
+
metadataImageSize(include: boolean): TakeOptions;
|
|
425
|
+
/**
|
|
426
|
+
* Sets whether to include fonts metadata.
|
|
427
|
+
*/
|
|
428
|
+
metadataFonts(include: boolean): TakeOptions;
|
|
429
|
+
/**
|
|
430
|
+
* Sets whether to include Open Graph metadata.
|
|
431
|
+
*/
|
|
432
|
+
metadataOpenGraph(include: boolean): TakeOptions;
|
|
433
|
+
/**
|
|
434
|
+
* Sets whether to include page title metadata.
|
|
435
|
+
*/
|
|
436
|
+
metadataPageTitle(include: boolean): TakeOptions;
|
|
437
|
+
/**
|
|
438
|
+
* Sets whether to include content metadata.
|
|
439
|
+
*/
|
|
440
|
+
metadataContent(include: boolean): TakeOptions;
|
|
441
|
+
/**
|
|
442
|
+
* Sets whether to include HTTP response status code metadata.
|
|
443
|
+
*/
|
|
444
|
+
metadataHttpResponseStatusCode(include: boolean): TakeOptions;
|
|
445
|
+
/**
|
|
446
|
+
* Sets whether to include HTTP response headers metadata.
|
|
447
|
+
*/
|
|
448
|
+
metadataHttpResponseHeaders(include: boolean): TakeOptions;
|
|
449
|
+
/**
|
|
450
|
+
* Sets whether to execute the request asynchronously.
|
|
451
|
+
*/
|
|
452
|
+
async(isAsync: boolean): TakeOptions;
|
|
453
|
+
/**
|
|
454
|
+
* Sets the webhook URL for asynchronous requests.
|
|
455
|
+
*/
|
|
456
|
+
webhookUrl(url: string): TakeOptions;
|
|
457
|
+
/**
|
|
458
|
+
* Sets whether to sign the webhook request.
|
|
459
|
+
*/
|
|
460
|
+
webhookSign(sign: boolean): TakeOptions;
|
|
461
|
+
/**
|
|
462
|
+
* Sets the text to check for in the content to force request failure.
|
|
463
|
+
*/
|
|
464
|
+
failIfContentContains(text: string): TakeOptions;
|
|
465
|
+
/**
|
|
466
|
+
* Sets whether to fail if GPU rendering fails.
|
|
467
|
+
*/
|
|
468
|
+
failIfGpuRenderingFails(fail: boolean): TakeOptions;
|
|
372
469
|
toQuery(): URLSearchParams;
|
|
373
470
|
}
|
|
374
471
|
/**
|
|
@@ -632,5 +729,81 @@ export declare class AnimateOptions {
|
|
|
632
729
|
* for some reason, you need to render error pages.
|
|
633
730
|
*/
|
|
634
731
|
ignoreHostErrors(ignore: boolean): AnimateOptions;
|
|
732
|
+
/**
|
|
733
|
+
* Sets whether to request GPU rendering.
|
|
734
|
+
*/
|
|
735
|
+
requestGpuRendering(request: boolean): AnimateOptions;
|
|
736
|
+
/**
|
|
737
|
+
* Sets whether to bypass Content Security Policy.
|
|
738
|
+
*/
|
|
739
|
+
bypassCsp(bypass: boolean): AnimateOptions;
|
|
740
|
+
/**
|
|
741
|
+
* Sets whether to wait for a specific selector.
|
|
742
|
+
*/
|
|
743
|
+
waitForSelector(selector: string): AnimateOptions;
|
|
744
|
+
/**
|
|
745
|
+
* Sets whether to return the storage location.
|
|
746
|
+
*/
|
|
747
|
+
storageReturnLocation(return_location: boolean): AnimateOptions;
|
|
748
|
+
/**
|
|
749
|
+
* Sets whether to execute the request asynchronously.
|
|
750
|
+
*/
|
|
751
|
+
async(isAsync: boolean): AnimateOptions;
|
|
752
|
+
/**
|
|
753
|
+
* Sets the webhook URL for asynchronous requests.
|
|
754
|
+
*/
|
|
755
|
+
webhookUrl(url: string): AnimateOptions;
|
|
756
|
+
/**
|
|
757
|
+
* Sets whether to sign the webhook request.
|
|
758
|
+
*/
|
|
759
|
+
webhookSign(sign: boolean): AnimateOptions;
|
|
760
|
+
/**
|
|
761
|
+
* Sets the text to check for in the content to force request failure.
|
|
762
|
+
*/
|
|
763
|
+
failIfContentContains(text: string): AnimateOptions;
|
|
764
|
+
/**
|
|
765
|
+
* Sets whether to fail if GPU rendering fails.
|
|
766
|
+
*/
|
|
767
|
+
failIfGpuRenderingFails(fail: boolean): AnimateOptions;
|
|
768
|
+
/**
|
|
769
|
+
* Sets the width of the animation.
|
|
770
|
+
*/
|
|
771
|
+
width(width: number): AnimateOptions;
|
|
772
|
+
/**
|
|
773
|
+
* Sets the height of the animation.
|
|
774
|
+
*/
|
|
775
|
+
height(height: number): AnimateOptions;
|
|
776
|
+
/**
|
|
777
|
+
* Sets the aspect ratio of the animation.
|
|
778
|
+
*/
|
|
779
|
+
aspectRatio(ratio: string): AnimateOptions;
|
|
780
|
+
/**
|
|
781
|
+
* Sets the scroll easing effect.
|
|
782
|
+
*/
|
|
783
|
+
scrollEasing(easing: string): AnimateOptions;
|
|
784
|
+
/**
|
|
785
|
+
* Sets whether to navigate while scrolling and record the new opened page.
|
|
786
|
+
*/
|
|
787
|
+
scrollTryNavigate(tryNavigate: boolean): AnimateOptions;
|
|
788
|
+
/**
|
|
789
|
+
* Sets when to navigate after scrolling (in milliseconds).
|
|
790
|
+
*/
|
|
791
|
+
scrollNavigateAfter(duration: number): AnimateOptions;
|
|
792
|
+
/**
|
|
793
|
+
* Sets the URL to navigate to while scrolling.
|
|
794
|
+
*/
|
|
795
|
+
scrollNavigateToURL(url: string): AnimateOptions;
|
|
796
|
+
/**
|
|
797
|
+
* Sets the link hints for navigation while scrolling.
|
|
798
|
+
*/
|
|
799
|
+
scrollNavigateLinkHints(...hints: string[]): AnimateOptions;
|
|
800
|
+
/**
|
|
801
|
+
* Sets the scroll back algorithm.
|
|
802
|
+
*/
|
|
803
|
+
scrollBackAlgorithm(algorithm: string): AnimateOptions;
|
|
804
|
+
/**
|
|
805
|
+
* Sets when to stop scrolling after the specified duration in milliseconds.
|
|
806
|
+
*/
|
|
807
|
+
scrollStopAfterDuration(duration: number): AnimateOptions;
|
|
635
808
|
toQuery(): URLSearchParams;
|
|
636
809
|
}
|
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(
|
|
231
|
-
this.put("reduced_motion",
|
|
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
|
|
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,14 @@ class TakeOptions {
|
|
|
301
302
|
return this;
|
|
302
303
|
}
|
|
303
304
|
/**
|
|
304
|
-
* Sets
|
|
305
|
+
* Sets the algorithm to use for full page screenshot—"by_sections" or ""/"default".
|
|
306
|
+
*/
|
|
307
|
+
fullPageAlgorithm(algorithm) {
|
|
308
|
+
this.put("full_page_algorithm", algorithm);
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
305
313
|
*/
|
|
306
314
|
format(format) {
|
|
307
315
|
this.put("format", format);
|
|
@@ -338,8 +346,8 @@ class TakeOptions {
|
|
|
338
346
|
/**
|
|
339
347
|
* Sets IP country code.
|
|
340
348
|
*/
|
|
341
|
-
ipCountryCode(
|
|
342
|
-
this.put("ip_country_code",
|
|
349
|
+
ipCountryCode(countryCode) {
|
|
350
|
+
this.put("ip_country_code", countryCode);
|
|
343
351
|
return this;
|
|
344
352
|
}
|
|
345
353
|
/**
|
|
@@ -666,6 +674,167 @@ class TakeOptions {
|
|
|
666
674
|
this.put("storage_class", storageClass);
|
|
667
675
|
return this;
|
|
668
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Sets the image width for thumbnail creation.
|
|
679
|
+
*/
|
|
680
|
+
imageWidth(width) {
|
|
681
|
+
this.put("image_width", width.toString());
|
|
682
|
+
return this;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Sets the image height for thumbnail creation.
|
|
686
|
+
*/
|
|
687
|
+
imageHeight(height) {
|
|
688
|
+
this.put("image_height", height.toString());
|
|
689
|
+
return this;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Sets whether to request GPU rendering.
|
|
693
|
+
*/
|
|
694
|
+
requestGpuRendering(request) {
|
|
695
|
+
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
696
|
+
return this;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Sets whether to print background for PDF.
|
|
700
|
+
*/
|
|
701
|
+
pdfPrintBackground(print) {
|
|
702
|
+
this.put("pdf_print_background", print ? "true" : "false");
|
|
703
|
+
return this;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Sets whether to fit PDF to one page.
|
|
707
|
+
*/
|
|
708
|
+
pdfFitOnePage(fit) {
|
|
709
|
+
this.put("pdf_fit_one_page", fit ? "true" : "false");
|
|
710
|
+
return this;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Sets the OpenAI API key for vision integration.
|
|
714
|
+
*/
|
|
715
|
+
openAiApiKey(key) {
|
|
716
|
+
this.put("openai_api_key", key);
|
|
717
|
+
return this;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Sets the vision prompt for OpenAI integration.
|
|
721
|
+
*/
|
|
722
|
+
visionPrompt(prompt) {
|
|
723
|
+
this.put("vision_prompt", prompt);
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Sets the maximum tokens for OpenAI vision response.
|
|
728
|
+
*/
|
|
729
|
+
visionMaxTokens(tokens) {
|
|
730
|
+
this.put("vision_max_tokens", tokens.toString());
|
|
731
|
+
return this;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Sets whether to bypass Content Security Policy.
|
|
735
|
+
*/
|
|
736
|
+
bypassCsp(bypass) {
|
|
737
|
+
this.put("bypass_csp", bypass ? "true" : "false");
|
|
738
|
+
return this;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Sets whether to wait for a specific selector.
|
|
742
|
+
*/
|
|
743
|
+
waitForSelector(selector) {
|
|
744
|
+
this.put("wait_for_selector", selector);
|
|
745
|
+
return this;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Sets whether to return the storage location.
|
|
749
|
+
*/
|
|
750
|
+
storageReturnLocation(return_location) {
|
|
751
|
+
this.put("storage_return_location", return_location ? "true" : "false");
|
|
752
|
+
return this;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Sets whether to include image size metadata.
|
|
756
|
+
*/
|
|
757
|
+
metadataImageSize(include) {
|
|
758
|
+
this.put("metadata_image_size", include ? "true" : "false");
|
|
759
|
+
return this;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Sets whether to include fonts metadata.
|
|
763
|
+
*/
|
|
764
|
+
metadataFonts(include) {
|
|
765
|
+
this.put("metadata_fonts", include ? "true" : "false");
|
|
766
|
+
return this;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Sets whether to include Open Graph metadata.
|
|
770
|
+
*/
|
|
771
|
+
metadataOpenGraph(include) {
|
|
772
|
+
this.put("metadata_open_graph", include ? "true" : "false");
|
|
773
|
+
return this;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Sets whether to include page title metadata.
|
|
777
|
+
*/
|
|
778
|
+
metadataPageTitle(include) {
|
|
779
|
+
this.put("metadata_page_title", include ? "true" : "false");
|
|
780
|
+
return this;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Sets whether to include content metadata.
|
|
784
|
+
*/
|
|
785
|
+
metadataContent(include) {
|
|
786
|
+
this.put("metadata_content", include ? "true" : "false");
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Sets whether to include HTTP response status code metadata.
|
|
791
|
+
*/
|
|
792
|
+
metadataHttpResponseStatusCode(include) {
|
|
793
|
+
this.put("metadata_http_response_status_code", include ? "true" : "false");
|
|
794
|
+
return this;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Sets whether to include HTTP response headers metadata.
|
|
798
|
+
*/
|
|
799
|
+
metadataHttpResponseHeaders(include) {
|
|
800
|
+
this.put("metadata_http_response_headers", include ? "true" : "false");
|
|
801
|
+
return this;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Sets whether to execute the request asynchronously.
|
|
805
|
+
*/
|
|
806
|
+
async(isAsync) {
|
|
807
|
+
this.put("async", isAsync ? "true" : "false");
|
|
808
|
+
return this;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Sets the webhook URL for asynchronous requests.
|
|
812
|
+
*/
|
|
813
|
+
webhookUrl(url) {
|
|
814
|
+
this.put("webhook_url", url);
|
|
815
|
+
return this;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Sets whether to sign the webhook request.
|
|
819
|
+
*/
|
|
820
|
+
webhookSign(sign) {
|
|
821
|
+
this.put("webhook_sign", sign ? "true" : "false");
|
|
822
|
+
return this;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Sets the text to check for in the content to force request failure.
|
|
826
|
+
*/
|
|
827
|
+
failIfContentContains(text) {
|
|
828
|
+
this.put("fail_if_content_contains", text);
|
|
829
|
+
return this;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Sets whether to fail if GPU rendering fails.
|
|
833
|
+
*/
|
|
834
|
+
failIfGpuRenderingFails(fail) {
|
|
835
|
+
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
836
|
+
return this;
|
|
837
|
+
}
|
|
669
838
|
toQuery() {
|
|
670
839
|
return new URLSearchParams(this.query.toString());
|
|
671
840
|
}
|
|
@@ -1126,6 +1295,139 @@ class AnimateOptions {
|
|
|
1126
1295
|
this.put("ignore_host_errors", ignore ? "true" : "false");
|
|
1127
1296
|
return this;
|
|
1128
1297
|
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Sets whether to request GPU rendering.
|
|
1300
|
+
*/
|
|
1301
|
+
requestGpuRendering(request) {
|
|
1302
|
+
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
1303
|
+
return this;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Sets whether to bypass Content Security Policy.
|
|
1307
|
+
*/
|
|
1308
|
+
bypassCsp(bypass) {
|
|
1309
|
+
this.put("bypass_csp", bypass ? "true" : "false");
|
|
1310
|
+
return this;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Sets whether to wait for a specific selector.
|
|
1314
|
+
*/
|
|
1315
|
+
waitForSelector(selector) {
|
|
1316
|
+
this.put("wait_for_selector", selector);
|
|
1317
|
+
return this;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Sets whether to return the storage location.
|
|
1321
|
+
*/
|
|
1322
|
+
storageReturnLocation(return_location) {
|
|
1323
|
+
this.put("storage_return_location", return_location ? "true" : "false");
|
|
1324
|
+
return this;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Sets whether to execute the request asynchronously.
|
|
1328
|
+
*/
|
|
1329
|
+
async(isAsync) {
|
|
1330
|
+
this.put("async", isAsync ? "true" : "false");
|
|
1331
|
+
return this;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Sets the webhook URL for asynchronous requests.
|
|
1335
|
+
*/
|
|
1336
|
+
webhookUrl(url) {
|
|
1337
|
+
this.put("webhook_url", url);
|
|
1338
|
+
return this;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Sets whether to sign the webhook request.
|
|
1342
|
+
*/
|
|
1343
|
+
webhookSign(sign) {
|
|
1344
|
+
this.put("webhook_sign", sign ? "true" : "false");
|
|
1345
|
+
return this;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Sets the text to check for in the content to force request failure.
|
|
1349
|
+
*/
|
|
1350
|
+
failIfContentContains(text) {
|
|
1351
|
+
this.put("fail_if_content_contains", text);
|
|
1352
|
+
return this;
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Sets whether to fail if GPU rendering fails.
|
|
1356
|
+
*/
|
|
1357
|
+
failIfGpuRenderingFails(fail) {
|
|
1358
|
+
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Sets the width of the animation.
|
|
1363
|
+
*/
|
|
1364
|
+
width(width) {
|
|
1365
|
+
this.put("width", width.toString());
|
|
1366
|
+
return this;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Sets the height of the animation.
|
|
1370
|
+
*/
|
|
1371
|
+
height(height) {
|
|
1372
|
+
this.put("height", height.toString());
|
|
1373
|
+
return this;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Sets the aspect ratio of the animation.
|
|
1377
|
+
*/
|
|
1378
|
+
aspectRatio(ratio) {
|
|
1379
|
+
this.put("aspect_ratio", ratio);
|
|
1380
|
+
return this;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Sets the scroll easing effect.
|
|
1384
|
+
*/
|
|
1385
|
+
scrollEasing(easing) {
|
|
1386
|
+
this.put("scroll_easing", easing);
|
|
1387
|
+
return this;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Sets whether to navigate while scrolling and record the new opened page.
|
|
1391
|
+
*/
|
|
1392
|
+
scrollTryNavigate(tryNavigate) {
|
|
1393
|
+
this.put("scroll_try_navigate", tryNavigate ? "true" : "false");
|
|
1394
|
+
return this;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Sets when to navigate after scrolling (in milliseconds).
|
|
1398
|
+
*/
|
|
1399
|
+
scrollNavigateAfter(duration) {
|
|
1400
|
+
this.put("scroll_navigate_after", duration.toString());
|
|
1401
|
+
return this;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Sets the URL to navigate to while scrolling.
|
|
1405
|
+
*/
|
|
1406
|
+
scrollNavigateToURL(url) {
|
|
1407
|
+
this.put("scroll_navigate_to_url", url);
|
|
1408
|
+
return this;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Sets the link hints for navigation while scrolling.
|
|
1412
|
+
*/
|
|
1413
|
+
scrollNavigateLinkHints(...hints) {
|
|
1414
|
+
this.put("scroll_navigate_link_hints", ...hints);
|
|
1415
|
+
return this;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Sets the scroll back algorithm.
|
|
1419
|
+
*/
|
|
1420
|
+
scrollBackAlgorithm(algorithm) {
|
|
1421
|
+
this.put("scroll_back_algorithm", algorithm);
|
|
1422
|
+
return this;
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Sets when to stop scrolling after the specified duration in milliseconds.
|
|
1426
|
+
*/
|
|
1427
|
+
scrollStopAfterDuration(duration) {
|
|
1428
|
+
this.put("scroll_stop_after_duration", duration.toString());
|
|
1429
|
+
return this;
|
|
1430
|
+
}
|
|
1129
1431
|
toQuery() {
|
|
1130
1432
|
return new URLSearchParams(this.query.toString());
|
|
1131
1433
|
}
|
package/package.json
CHANGED
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(
|
|
295
|
-
this.put("reduced_motion",
|
|
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
|
|
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,16 @@ export class TakeOptions {
|
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
/**
|
|
386
|
-
* Sets
|
|
387
|
+
* Sets the algorithm to use for full page screenshot—"by_sections" or ""/"default".
|
|
388
|
+
*/
|
|
389
|
+
fullPageAlgorithm(algorithm: string): TakeOptions {
|
|
390
|
+
this.put("full_page_algorithm", algorithm);
|
|
391
|
+
|
|
392
|
+
return this;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
387
397
|
*/
|
|
388
398
|
format(format: string): TakeOptions {
|
|
389
399
|
this.put("format", format);
|
|
@@ -426,8 +436,8 @@ export class TakeOptions {
|
|
|
426
436
|
/**
|
|
427
437
|
* Sets IP country code.
|
|
428
438
|
*/
|
|
429
|
-
ipCountryCode(
|
|
430
|
-
this.put("ip_country_code",
|
|
439
|
+
ipCountryCode(countryCode: string): TakeOptions {
|
|
440
|
+
this.put("ip_country_code", countryCode);
|
|
431
441
|
|
|
432
442
|
return this;
|
|
433
443
|
}
|
|
@@ -850,6 +860,213 @@ export class TakeOptions {
|
|
|
850
860
|
return this;
|
|
851
861
|
}
|
|
852
862
|
|
|
863
|
+
/**
|
|
864
|
+
* Sets the image width for thumbnail creation.
|
|
865
|
+
*/
|
|
866
|
+
imageWidth(width: number): TakeOptions {
|
|
867
|
+
this.put("image_width", width.toString());
|
|
868
|
+
|
|
869
|
+
return this;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Sets the image height for thumbnail creation.
|
|
874
|
+
*/
|
|
875
|
+
imageHeight(height: number): TakeOptions {
|
|
876
|
+
this.put("image_height", height.toString());
|
|
877
|
+
|
|
878
|
+
return this;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Sets whether to request GPU rendering.
|
|
883
|
+
*/
|
|
884
|
+
requestGpuRendering(request: boolean): TakeOptions {
|
|
885
|
+
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
886
|
+
|
|
887
|
+
return this;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Sets whether to print background for PDF.
|
|
892
|
+
*/
|
|
893
|
+
pdfPrintBackground(print: boolean): TakeOptions {
|
|
894
|
+
this.put("pdf_print_background", print ? "true" : "false");
|
|
895
|
+
|
|
896
|
+
return this;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Sets whether to fit PDF to one page.
|
|
901
|
+
*/
|
|
902
|
+
pdfFitOnePage(fit: boolean): TakeOptions {
|
|
903
|
+
this.put("pdf_fit_one_page", fit ? "true" : "false");
|
|
904
|
+
|
|
905
|
+
return this;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Sets the OpenAI API key for vision integration.
|
|
910
|
+
*/
|
|
911
|
+
openAiApiKey(key: string): TakeOptions {
|
|
912
|
+
this.put("openai_api_key", key);
|
|
913
|
+
|
|
914
|
+
return this;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Sets the vision prompt for OpenAI integration.
|
|
919
|
+
*/
|
|
920
|
+
visionPrompt(prompt: string): TakeOptions {
|
|
921
|
+
this.put("vision_prompt", prompt);
|
|
922
|
+
|
|
923
|
+
return this;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Sets the maximum tokens for OpenAI vision response.
|
|
928
|
+
*/
|
|
929
|
+
visionMaxTokens(tokens: number): TakeOptions {
|
|
930
|
+
this.put("vision_max_tokens", tokens.toString());
|
|
931
|
+
|
|
932
|
+
return this;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Sets whether to bypass Content Security Policy.
|
|
937
|
+
*/
|
|
938
|
+
bypassCsp(bypass: boolean): TakeOptions {
|
|
939
|
+
this.put("bypass_csp", bypass ? "true" : "false");
|
|
940
|
+
|
|
941
|
+
return this;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Sets whether to wait for a specific selector.
|
|
946
|
+
*/
|
|
947
|
+
waitForSelector(selector: string): TakeOptions {
|
|
948
|
+
this.put("wait_for_selector", selector);
|
|
949
|
+
|
|
950
|
+
return this;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Sets whether to return the storage location.
|
|
955
|
+
*/
|
|
956
|
+
storageReturnLocation(return_location: boolean): TakeOptions {
|
|
957
|
+
this.put("storage_return_location", return_location ? "true" : "false");
|
|
958
|
+
|
|
959
|
+
return this;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Sets whether to include image size metadata.
|
|
964
|
+
*/
|
|
965
|
+
metadataImageSize(include: boolean): TakeOptions {
|
|
966
|
+
this.put("metadata_image_size", include ? "true" : "false");
|
|
967
|
+
|
|
968
|
+
return this;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Sets whether to include fonts metadata.
|
|
973
|
+
*/
|
|
974
|
+
metadataFonts(include: boolean): TakeOptions {
|
|
975
|
+
this.put("metadata_fonts", include ? "true" : "false");
|
|
976
|
+
|
|
977
|
+
return this;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Sets whether to include Open Graph metadata.
|
|
982
|
+
*/
|
|
983
|
+
metadataOpenGraph(include: boolean): TakeOptions {
|
|
984
|
+
this.put("metadata_open_graph", include ? "true" : "false");
|
|
985
|
+
|
|
986
|
+
return this;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Sets whether to include page title metadata.
|
|
991
|
+
*/
|
|
992
|
+
metadataPageTitle(include: boolean): TakeOptions {
|
|
993
|
+
this.put("metadata_page_title", include ? "true" : "false");
|
|
994
|
+
|
|
995
|
+
return this;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Sets whether to include content metadata.
|
|
1000
|
+
*/
|
|
1001
|
+
metadataContent(include: boolean): TakeOptions {
|
|
1002
|
+
this.put("metadata_content", include ? "true" : "false");
|
|
1003
|
+
|
|
1004
|
+
return this;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Sets whether to include HTTP response status code metadata.
|
|
1009
|
+
*/
|
|
1010
|
+
metadataHttpResponseStatusCode(include: boolean): TakeOptions {
|
|
1011
|
+
this.put("metadata_http_response_status_code", include ? "true" : "false");
|
|
1012
|
+
|
|
1013
|
+
return this;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Sets whether to include HTTP response headers metadata.
|
|
1018
|
+
*/
|
|
1019
|
+
metadataHttpResponseHeaders(include: boolean): TakeOptions {
|
|
1020
|
+
this.put("metadata_http_response_headers", include ? "true" : "false");
|
|
1021
|
+
|
|
1022
|
+
return this;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Sets whether to execute the request asynchronously.
|
|
1027
|
+
*/
|
|
1028
|
+
async(isAsync: boolean): TakeOptions {
|
|
1029
|
+
this.put("async", isAsync ? "true" : "false");
|
|
1030
|
+
|
|
1031
|
+
return this;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Sets the webhook URL for asynchronous requests.
|
|
1036
|
+
*/
|
|
1037
|
+
webhookUrl(url: string): TakeOptions {
|
|
1038
|
+
this.put("webhook_url", url);
|
|
1039
|
+
|
|
1040
|
+
return this;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Sets whether to sign the webhook request.
|
|
1045
|
+
*/
|
|
1046
|
+
webhookSign(sign: boolean): TakeOptions {
|
|
1047
|
+
this.put("webhook_sign", sign ? "true" : "false");
|
|
1048
|
+
|
|
1049
|
+
return this;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Sets the text to check for in the content to force request failure.
|
|
1054
|
+
*/
|
|
1055
|
+
failIfContentContains(text: string): TakeOptions {
|
|
1056
|
+
this.put("fail_if_content_contains", text);
|
|
1057
|
+
|
|
1058
|
+
return this;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Sets whether to fail if GPU rendering fails.
|
|
1063
|
+
*/
|
|
1064
|
+
failIfGpuRenderingFails(fail: boolean): TakeOptions {
|
|
1065
|
+
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1066
|
+
|
|
1067
|
+
return this;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
853
1070
|
toQuery(): URLSearchParams {
|
|
854
1071
|
return new URLSearchParams(this.query.toString());
|
|
855
1072
|
}
|
|
@@ -1441,6 +1658,178 @@ export class AnimateOptions {
|
|
|
1441
1658
|
return this;
|
|
1442
1659
|
}
|
|
1443
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* Sets whether to request GPU rendering.
|
|
1663
|
+
*/
|
|
1664
|
+
requestGpuRendering(request: boolean): AnimateOptions {
|
|
1665
|
+
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
1666
|
+
|
|
1667
|
+
return this;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* Sets whether to bypass Content Security Policy.
|
|
1672
|
+
*/
|
|
1673
|
+
bypassCsp(bypass: boolean): AnimateOptions {
|
|
1674
|
+
this.put("bypass_csp", bypass ? "true" : "false");
|
|
1675
|
+
|
|
1676
|
+
return this;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Sets whether to wait for a specific selector.
|
|
1681
|
+
*/
|
|
1682
|
+
waitForSelector(selector: string): AnimateOptions {
|
|
1683
|
+
this.put("wait_for_selector", selector);
|
|
1684
|
+
|
|
1685
|
+
return this;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Sets whether to return the storage location.
|
|
1690
|
+
*/
|
|
1691
|
+
storageReturnLocation(return_location: boolean): AnimateOptions {
|
|
1692
|
+
this.put("storage_return_location", return_location ? "true" : "false");
|
|
1693
|
+
|
|
1694
|
+
return this;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* Sets whether to execute the request asynchronously.
|
|
1699
|
+
*/
|
|
1700
|
+
async(isAsync: boolean): AnimateOptions {
|
|
1701
|
+
this.put("async", isAsync ? "true" : "false");
|
|
1702
|
+
|
|
1703
|
+
return this;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Sets the webhook URL for asynchronous requests.
|
|
1708
|
+
*/
|
|
1709
|
+
webhookUrl(url: string): AnimateOptions {
|
|
1710
|
+
this.put("webhook_url", url);
|
|
1711
|
+
|
|
1712
|
+
return this;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Sets whether to sign the webhook request.
|
|
1717
|
+
*/
|
|
1718
|
+
webhookSign(sign: boolean): AnimateOptions {
|
|
1719
|
+
this.put("webhook_sign", sign ? "true" : "false");
|
|
1720
|
+
|
|
1721
|
+
return this;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Sets the text to check for in the content to force request failure.
|
|
1726
|
+
*/
|
|
1727
|
+
failIfContentContains(text: string): AnimateOptions {
|
|
1728
|
+
this.put("fail_if_content_contains", text);
|
|
1729
|
+
|
|
1730
|
+
return this;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
/**
|
|
1734
|
+
* Sets whether to fail if GPU rendering fails.
|
|
1735
|
+
*/
|
|
1736
|
+
failIfGpuRenderingFails(fail: boolean): AnimateOptions {
|
|
1737
|
+
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1738
|
+
|
|
1739
|
+
return this;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* Sets the width of the animation.
|
|
1745
|
+
*/
|
|
1746
|
+
width(width: number): AnimateOptions {
|
|
1747
|
+
this.put("width", width.toString());
|
|
1748
|
+
|
|
1749
|
+
return this;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Sets the height of the animation.
|
|
1754
|
+
*/
|
|
1755
|
+
height(height: number): AnimateOptions {
|
|
1756
|
+
this.put("height", height.toString());
|
|
1757
|
+
|
|
1758
|
+
return this;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Sets the aspect ratio of the animation.
|
|
1763
|
+
*/
|
|
1764
|
+
aspectRatio(ratio: string): AnimateOptions {
|
|
1765
|
+
this.put("aspect_ratio", ratio);
|
|
1766
|
+
|
|
1767
|
+
return this;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Sets the scroll easing effect.
|
|
1772
|
+
*/
|
|
1773
|
+
scrollEasing(easing: string): AnimateOptions {
|
|
1774
|
+
this.put("scroll_easing", easing);
|
|
1775
|
+
|
|
1776
|
+
return this;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* Sets whether to navigate while scrolling and record the new opened page.
|
|
1781
|
+
*/
|
|
1782
|
+
scrollTryNavigate(tryNavigate: boolean): AnimateOptions {
|
|
1783
|
+
this.put("scroll_try_navigate", tryNavigate ? "true" : "false");
|
|
1784
|
+
|
|
1785
|
+
return this;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Sets when to navigate after scrolling (in milliseconds).
|
|
1790
|
+
*/
|
|
1791
|
+
scrollNavigateAfter(duration: number): AnimateOptions {
|
|
1792
|
+
this.put("scroll_navigate_after", duration.toString());
|
|
1793
|
+
|
|
1794
|
+
return this;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Sets the URL to navigate to while scrolling.
|
|
1799
|
+
*/
|
|
1800
|
+
scrollNavigateToURL(url: string): AnimateOptions {
|
|
1801
|
+
this.put("scroll_navigate_to_url", url);
|
|
1802
|
+
|
|
1803
|
+
return this;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Sets the link hints for navigation while scrolling.
|
|
1808
|
+
*/
|
|
1809
|
+
scrollNavigateLinkHints(...hints: string[]): AnimateOptions {
|
|
1810
|
+
this.put("scroll_navigate_link_hints", ...hints);
|
|
1811
|
+
|
|
1812
|
+
return this;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Sets the scroll back algorithm.
|
|
1817
|
+
*/
|
|
1818
|
+
scrollBackAlgorithm(algorithm: string): AnimateOptions {
|
|
1819
|
+
this.put("scroll_back_algorithm", algorithm);
|
|
1820
|
+
|
|
1821
|
+
return this;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Sets when to stop scrolling after the specified duration in milliseconds.
|
|
1826
|
+
*/
|
|
1827
|
+
scrollStopAfterDuration(duration: number): AnimateOptions {
|
|
1828
|
+
this.put("scroll_stop_after_duration", duration.toString());
|
|
1829
|
+
return this;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
|
|
1444
1833
|
toQuery(): URLSearchParams {
|
|
1445
1834
|
return new URLSearchParams(this.query.toString());
|
|
1446
1835
|
}
|