screenshotone-api-sdk 1.1.17 → 1.1.19
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 +4 -0
- package/dist/main.js +12 -2
- package/package.json +1 -1
- package/src/main.ts +33 -11
package/dist/@types/main.d.ts
CHANGED
|
@@ -152,6 +152,10 @@ export declare class TakeOptions {
|
|
|
152
152
|
* Sets the algorithm to use for full page screenshot—"by_sections" or ""/"default".
|
|
153
153
|
*/
|
|
154
154
|
fullPageAlgorithm(algorithm: string): TakeOptions;
|
|
155
|
+
/**
|
|
156
|
+
* Set `true` to scroll the page to the bottom.
|
|
157
|
+
*/
|
|
158
|
+
fullPageScroll(scroll: boolean): TakeOptions;
|
|
155
159
|
/**
|
|
156
160
|
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
157
161
|
*/
|
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;
|
|
@@ -308,6 +311,13 @@ class TakeOptions {
|
|
|
308
311
|
this.put("full_page_algorithm", algorithm);
|
|
309
312
|
return this;
|
|
310
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Set `true` to scroll the page to the bottom.
|
|
316
|
+
*/
|
|
317
|
+
fullPageScroll(scroll) {
|
|
318
|
+
this.put("full_page_scroll", scroll ? "true" : "false");
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
311
321
|
/**
|
|
312
322
|
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
313
323
|
*/
|
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,6 +404,15 @@ export class TakeOptions {
|
|
|
392
404
|
return this;
|
|
393
405
|
}
|
|
394
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Set `true` to scroll the page to the bottom.
|
|
409
|
+
*/
|
|
410
|
+
fullPageScroll(scroll: boolean): TakeOptions {
|
|
411
|
+
this.put("full_page_scroll", scroll ? "true" : "false");
|
|
412
|
+
|
|
413
|
+
return this;
|
|
414
|
+
}
|
|
415
|
+
|
|
395
416
|
/**
|
|
396
417
|
* Sets response format, one of: "png", "jpeg", "webp", "jpg", "gif", "jp2", "tiff", "avif", "heif", "pdf", "html".
|
|
397
418
|
*/
|
|
@@ -1008,7 +1029,10 @@ export class TakeOptions {
|
|
|
1008
1029
|
* Sets whether to include HTTP response status code metadata.
|
|
1009
1030
|
*/
|
|
1010
1031
|
metadataHttpResponseStatusCode(include: boolean): TakeOptions {
|
|
1011
|
-
this.put(
|
|
1032
|
+
this.put(
|
|
1033
|
+
"metadata_http_response_status_code",
|
|
1034
|
+
include ? "true" : "false"
|
|
1035
|
+
);
|
|
1012
1036
|
|
|
1013
1037
|
return this;
|
|
1014
1038
|
}
|
|
@@ -1063,7 +1087,7 @@ export class TakeOptions {
|
|
|
1063
1087
|
*/
|
|
1064
1088
|
failIfGpuRenderingFails(fail: boolean): TakeOptions {
|
|
1065
1089
|
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1066
|
-
|
|
1090
|
+
|
|
1067
1091
|
return this;
|
|
1068
1092
|
}
|
|
1069
1093
|
|
|
@@ -1615,7 +1639,7 @@ export class AnimateOptions {
|
|
|
1615
1639
|
|
|
1616
1640
|
scrollBack(scrollBack: boolean): AnimateOptions {
|
|
1617
1641
|
this.put("scroll_back", scrollBack ? "true" : "false");
|
|
1618
|
-
|
|
1642
|
+
|
|
1619
1643
|
return this;
|
|
1620
1644
|
}
|
|
1621
1645
|
|
|
@@ -1663,7 +1687,7 @@ export class AnimateOptions {
|
|
|
1663
1687
|
*/
|
|
1664
1688
|
requestGpuRendering(request: boolean): AnimateOptions {
|
|
1665
1689
|
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
1666
|
-
|
|
1690
|
+
|
|
1667
1691
|
return this;
|
|
1668
1692
|
}
|
|
1669
1693
|
|
|
@@ -1739,7 +1763,6 @@ export class AnimateOptions {
|
|
|
1739
1763
|
return this;
|
|
1740
1764
|
}
|
|
1741
1765
|
|
|
1742
|
-
|
|
1743
1766
|
/**
|
|
1744
1767
|
* Sets the width of the animation.
|
|
1745
1768
|
*/
|
|
@@ -1829,7 +1852,6 @@ export class AnimateOptions {
|
|
|
1829
1852
|
return this;
|
|
1830
1853
|
}
|
|
1831
1854
|
|
|
1832
|
-
|
|
1833
1855
|
toQuery(): URLSearchParams {
|
|
1834
1856
|
return new URLSearchParams(this.query.toString());
|
|
1835
1857
|
}
|