screenshotone-api-sdk 1.1.18 → 1.1.20
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 +5 -0
- package/dist/main.js +13 -2
- package/package.json +1 -1
- package/src/main.ts +34 -12
package/dist/@types/main.d.ts
CHANGED
|
@@ -374,6 +374,11 @@ export declare class TakeOptions {
|
|
|
374
374
|
* Secret access key. It overrides the one specified in the dashboard configuration.
|
|
375
375
|
*/
|
|
376
376
|
storageSecretAccessKey(secretAccessKey: string): TakeOptions;
|
|
377
|
+
/**
|
|
378
|
+
* Leave empty for Amazon S3, specify only when needed. Any S3-compatible storage is supported,
|
|
379
|
+
* e.g. "https://<accountId>.r2.cloudflarestorage.com" for Cloudlfare R2 storage.
|
|
380
|
+
*/
|
|
381
|
+
storageEndpoint(endpoint: string): TakeOptions;
|
|
377
382
|
/**
|
|
378
383
|
* Storage class allows you to specify the object storage class.
|
|
379
384
|
*/
|
package/dist/main.js
CHANGED
|
@@ -82,9 +82,12 @@ class Client {
|
|
|
82
82
|
}
|
|
83
83
|
try {
|
|
84
84
|
const data = await response.json();
|
|
85
|
-
throw new
|
|
85
|
+
throw new errors_1.default(`Failed to generate screenshot, response returned ${response.status} (${response.statusText}): ${data?.error_message}`, response.status, data?.error_code, data?.error_message, data?.documentation_url);
|
|
86
86
|
}
|
|
87
87
|
catch (e) {
|
|
88
|
+
if (e instanceof errors_1.default) {
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
88
91
|
throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}`);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -145,7 +148,7 @@ class Client {
|
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
150
|
const data = await response.json();
|
|
148
|
-
throw new
|
|
151
|
+
throw new errors_1.default(`Failed to generate animation, response returned ${response.status} (${response.statusText}): ${data?.error_message}`, response.status, data?.error_code, data?.error_message, data?.documentation_url);
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
exports.Client = Client;
|
|
@@ -674,6 +677,14 @@ class TakeOptions {
|
|
|
674
677
|
this.put("storage_secret_access_key", secretAccessKey);
|
|
675
678
|
return this;
|
|
676
679
|
}
|
|
680
|
+
/**
|
|
681
|
+
* Leave empty for Amazon S3, specify only when needed. Any S3-compatible storage is supported,
|
|
682
|
+
* e.g. "https://<accountId>.r2.cloudflarestorage.com" for Cloudlfare R2 storage.
|
|
683
|
+
*/
|
|
684
|
+
storageEndpoint(endpoint) {
|
|
685
|
+
this.put("storage_endpoint", endpoint);
|
|
686
|
+
return this;
|
|
687
|
+
}
|
|
677
688
|
/**
|
|
678
689
|
* Storage class allows you to specify the object storage class.
|
|
679
690
|
*/
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -97,10 +97,18 @@ export class Client {
|
|
|
97
97
|
try {
|
|
98
98
|
const data = await response.json();
|
|
99
99
|
|
|
100
|
-
throw new
|
|
101
|
-
`
|
|
100
|
+
throw new APIError(
|
|
101
|
+
`Failed to generate screenshot, response returned ${response.status} (${response.statusText}): ${data?.error_message}`,
|
|
102
|
+
response.status,
|
|
103
|
+
data?.error_code,
|
|
104
|
+
data?.error_message,
|
|
105
|
+
data?.documentation_url
|
|
102
106
|
);
|
|
103
107
|
} catch (e) {
|
|
108
|
+
if (e instanceof APIError) {
|
|
109
|
+
throw e;
|
|
110
|
+
}
|
|
111
|
+
|
|
104
112
|
throw new Error(
|
|
105
113
|
`failed to take screenshot, response returned ${response.status} ${response.statusText}`
|
|
106
114
|
);
|
|
@@ -129,7 +137,7 @@ export class Client {
|
|
|
129
137
|
data?.error_code,
|
|
130
138
|
data?.error_message,
|
|
131
139
|
data?.documentation_url
|
|
132
|
-
);
|
|
140
|
+
);
|
|
133
141
|
} catch (e) {
|
|
134
142
|
if (e instanceof APIError) {
|
|
135
143
|
throw e;
|
|
@@ -189,8 +197,12 @@ export class Client {
|
|
|
189
197
|
|
|
190
198
|
const data = await response.json();
|
|
191
199
|
|
|
192
|
-
throw new
|
|
193
|
-
`
|
|
200
|
+
throw new APIError(
|
|
201
|
+
`Failed to generate animation, response returned ${response.status} (${response.statusText}): ${data?.error_message}`,
|
|
202
|
+
response.status,
|
|
203
|
+
data?.error_code,
|
|
204
|
+
data?.error_message,
|
|
205
|
+
data?.documentation_url
|
|
194
206
|
);
|
|
195
207
|
}
|
|
196
208
|
}
|
|
@@ -392,7 +404,6 @@ export class TakeOptions {
|
|
|
392
404
|
return this;
|
|
393
405
|
}
|
|
394
406
|
|
|
395
|
-
|
|
396
407
|
/**
|
|
397
408
|
* Set `true` to scroll the page to the bottom.
|
|
398
409
|
*/
|
|
@@ -861,6 +872,16 @@ export class TakeOptions {
|
|
|
861
872
|
return this;
|
|
862
873
|
}
|
|
863
874
|
|
|
875
|
+
/**
|
|
876
|
+
* Leave empty for Amazon S3, specify only when needed. Any S3-compatible storage is supported,
|
|
877
|
+
* e.g. "https://<accountId>.r2.cloudflarestorage.com" for Cloudlfare R2 storage.
|
|
878
|
+
*/
|
|
879
|
+
storageEndpoint(endpoint: string): TakeOptions {
|
|
880
|
+
this.put("storage_endpoint", endpoint);
|
|
881
|
+
|
|
882
|
+
return this;
|
|
883
|
+
}
|
|
884
|
+
|
|
864
885
|
/**
|
|
865
886
|
* Storage class allows you to specify the object storage class.
|
|
866
887
|
*/
|
|
@@ -1018,7 +1039,10 @@ export class TakeOptions {
|
|
|
1018
1039
|
* Sets whether to include HTTP response status code metadata.
|
|
1019
1040
|
*/
|
|
1020
1041
|
metadataHttpResponseStatusCode(include: boolean): TakeOptions {
|
|
1021
|
-
this.put(
|
|
1042
|
+
this.put(
|
|
1043
|
+
"metadata_http_response_status_code",
|
|
1044
|
+
include ? "true" : "false"
|
|
1045
|
+
);
|
|
1022
1046
|
|
|
1023
1047
|
return this;
|
|
1024
1048
|
}
|
|
@@ -1073,7 +1097,7 @@ export class TakeOptions {
|
|
|
1073
1097
|
*/
|
|
1074
1098
|
failIfGpuRenderingFails(fail: boolean): TakeOptions {
|
|
1075
1099
|
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1076
|
-
|
|
1100
|
+
|
|
1077
1101
|
return this;
|
|
1078
1102
|
}
|
|
1079
1103
|
|
|
@@ -1625,7 +1649,7 @@ export class AnimateOptions {
|
|
|
1625
1649
|
|
|
1626
1650
|
scrollBack(scrollBack: boolean): AnimateOptions {
|
|
1627
1651
|
this.put("scroll_back", scrollBack ? "true" : "false");
|
|
1628
|
-
|
|
1652
|
+
|
|
1629
1653
|
return this;
|
|
1630
1654
|
}
|
|
1631
1655
|
|
|
@@ -1673,7 +1697,7 @@ export class AnimateOptions {
|
|
|
1673
1697
|
*/
|
|
1674
1698
|
requestGpuRendering(request: boolean): AnimateOptions {
|
|
1675
1699
|
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
1676
|
-
|
|
1700
|
+
|
|
1677
1701
|
return this;
|
|
1678
1702
|
}
|
|
1679
1703
|
|
|
@@ -1749,7 +1773,6 @@ export class AnimateOptions {
|
|
|
1749
1773
|
return this;
|
|
1750
1774
|
}
|
|
1751
1775
|
|
|
1752
|
-
|
|
1753
1776
|
/**
|
|
1754
1777
|
* Sets the width of the animation.
|
|
1755
1778
|
*/
|
|
@@ -1839,7 +1862,6 @@ export class AnimateOptions {
|
|
|
1839
1862
|
return this;
|
|
1840
1863
|
}
|
|
1841
1864
|
|
|
1842
|
-
|
|
1843
1865
|
toQuery(): URLSearchParams {
|
|
1844
1866
|
return new URLSearchParams(this.query.toString());
|
|
1845
1867
|
}
|