screenshotone-api-sdk 1.1.7 → 1.1.9

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.
@@ -149,6 +149,28 @@ export declare class TakeOptions {
149
149
  * Sets response format, one of: "png", "jpeg", "webp" or "jpg".
150
150
  */
151
151
  format(format: string): TakeOptions;
152
+ /**
153
+ * When the site responds within the range of 200-299 status code,
154
+ * you can ignore errors and take a screenshot of the error page anyway.
155
+ * To do that, set the option ignore_host_errors to true.
156
+ * It is false by default.
157
+ *
158
+ * It is helpful when you want to create a gallery of error pages or,
159
+ * for some reason, you need to render error pages.
160
+ */
161
+ ignoreHostErrors(ignore: boolean): TakeOptions;
162
+ /**
163
+ * Use wait_until to wait until an event occurred before taking a screenshot or rendering HTML or PDF.
164
+ *
165
+ * The default value of wait_until is ['load']. Allowed values are:
166
+ * - load: the navigation is successful when the load even is fired;
167
+ * - domcontentloaded: the navigation is finished when the DOMContentLoaded even is fired;
168
+ * - networkidle0: the navigation is finished when there are no more than 0 network connections for at least 500 ms;
169
+ * - networkidle2: consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
170
+ *
171
+ * The parameter accepts many values. It means that screenshots will be taken after all events occur altogether.
172
+ */
173
+ waitUntil(...until: string[]): TakeOptions;
152
174
  /**
153
175
  * Sets IP country code.
154
176
  */
@@ -177,6 +199,22 @@ export declare class TakeOptions {
177
199
  * Sets the height of the browser viewport (pixels).
178
200
  */
179
201
  viewportHeight(viewportHeight: number): TakeOptions;
202
+ /**
203
+ * The clip_x option specifies only the top coordinate (x) of the area to clip.
204
+ */
205
+ clipX(clipX: number): TakeOptions;
206
+ /**
207
+ * The clip_y option specifies only the top coordinate (y) of the area to clip.
208
+ */
209
+ clipY(clipY: number): TakeOptions;
210
+ /**
211
+ * The clip_width option specifies only the width of the area to clip.
212
+ */
213
+ clipWidth(clipWidth: number): TakeOptions;
214
+ /**
215
+ * The clip_height option specifies only the width of the area to clip.
216
+ */
217
+ clipHeight(clipHeight: number): TakeOptions;
180
218
  /**
181
219
  * Sets the device scale factor. Acceptable value is one of: 1, 2 or 3.
182
220
  */
package/dist/main.js CHANGED
@@ -302,6 +302,34 @@ class TakeOptions {
302
302
  this.put("format", format);
303
303
  return this;
304
304
  }
305
+ /**
306
+ * When the site responds within the range of 200-299 status code,
307
+ * you can ignore errors and take a screenshot of the error page anyway.
308
+ * To do that, set the option ignore_host_errors to true.
309
+ * It is false by default.
310
+ *
311
+ * It is helpful when you want to create a gallery of error pages or,
312
+ * for some reason, you need to render error pages.
313
+ */
314
+ ignoreHostErrors(ignore) {
315
+ this.put("ignore_host_errors", ignore ? "true" : "false");
316
+ return this;
317
+ }
318
+ /**
319
+ * Use wait_until to wait until an event occurred before taking a screenshot or rendering HTML or PDF.
320
+ *
321
+ * The default value of wait_until is ['load']. Allowed values are:
322
+ * - load: the navigation is successful when the load even is fired;
323
+ * - domcontentloaded: the navigation is finished when the DOMContentLoaded even is fired;
324
+ * - networkidle0: the navigation is finished when there are no more than 0 network connections for at least 500 ms;
325
+ * - networkidle2: consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
326
+ *
327
+ * The parameter accepts many values. It means that screenshots will be taken after all events occur altogether.
328
+ */
329
+ waitUntil(...until) {
330
+ this.put("wait_until", ...until);
331
+ return this;
332
+ }
305
333
  /**
306
334
  * Sets IP country code.
307
335
  */
@@ -348,6 +376,34 @@ class TakeOptions {
348
376
  this.put("viewport_height", viewportHeight.toString());
349
377
  return this;
350
378
  }
379
+ /**
380
+ * The clip_x option specifies only the top coordinate (x) of the area to clip.
381
+ */
382
+ clipX(clipX) {
383
+ this.put("clip_x", clipX.toString());
384
+ return this;
385
+ }
386
+ /**
387
+ * The clip_y option specifies only the top coordinate (y) of the area to clip.
388
+ */
389
+ clipY(clipY) {
390
+ this.put("clip_y", clipY.toString());
391
+ return this;
392
+ }
393
+ /**
394
+ * The clip_width option specifies only the width of the area to clip.
395
+ */
396
+ clipWidth(clipWidth) {
397
+ this.put("clip_width", clipWidth.toString());
398
+ return this;
399
+ }
400
+ /**
401
+ * The clip_height option specifies only the width of the area to clip.
402
+ */
403
+ clipHeight(clipHeight) {
404
+ this.put("clip_height", clipHeight.toString());
405
+ return this;
406
+ }
351
407
  /**
352
408
  * Sets the device scale factor. Acceptable value is one of: 1, 2 or 3.
353
409
  */
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.7",
4
+ "version": "1.1.9",
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
@@ -380,6 +380,38 @@ export class TakeOptions {
380
380
  return this;
381
381
  }
382
382
 
383
+ /**
384
+ * When the site responds within the range of 200-299 status code,
385
+ * you can ignore errors and take a screenshot of the error page anyway.
386
+ * To do that, set the option ignore_host_errors to true.
387
+ * It is false by default.
388
+ *
389
+ * It is helpful when you want to create a gallery of error pages or,
390
+ * for some reason, you need to render error pages.
391
+ */
392
+ ignoreHostErrors(ignore: boolean): TakeOptions {
393
+ this.put("ignore_host_errors", ignore ? "true" : "false");
394
+
395
+ return this;
396
+ }
397
+
398
+ /**
399
+ * Use wait_until to wait until an event occurred before taking a screenshot or rendering HTML or PDF.
400
+ *
401
+ * The default value of wait_until is ['load']. Allowed values are:
402
+ * - load: the navigation is successful when the load even is fired;
403
+ * - domcontentloaded: the navigation is finished when the DOMContentLoaded even is fired;
404
+ * - networkidle0: the navigation is finished when there are no more than 0 network connections for at least 500 ms;
405
+ * - networkidle2: consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
406
+ *
407
+ * The parameter accepts many values. It means that screenshots will be taken after all events occur altogether.
408
+ */
409
+ waitUntil(...until: string[]): TakeOptions {
410
+ this.put("wait_until", ...until);
411
+
412
+ return this;
413
+ }
414
+
383
415
  /**
384
416
  * Sets IP country code.
385
417
  */
@@ -438,6 +470,42 @@ export class TakeOptions {
438
470
  return this;
439
471
  }
440
472
 
473
+ /**
474
+ * The clip_x option specifies only the top coordinate (x) of the area to clip.
475
+ */
476
+ clipX(clipX: number): TakeOptions {
477
+ this.put("clip_x", clipX.toString());
478
+
479
+ return this;
480
+ }
481
+
482
+ /**
483
+ * The clip_y option specifies only the top coordinate (y) of the area to clip.
484
+ */
485
+ clipY(clipY: number): TakeOptions {
486
+ this.put("clip_y", clipY.toString());
487
+
488
+ return this;
489
+ }
490
+
491
+ /**
492
+ * The clip_width option specifies only the width of the area to clip.
493
+ */
494
+ clipWidth(clipWidth: number): TakeOptions {
495
+ this.put("clip_width", clipWidth.toString());
496
+
497
+ return this;
498
+ }
499
+
500
+ /**
501
+ * The clip_height option specifies only the width of the area to clip.
502
+ */
503
+ clipHeight(clipHeight: number): TakeOptions {
504
+ this.put("clip_height", clipHeight.toString());
505
+
506
+ return this;
507
+ }
508
+
441
509
  /**
442
510
  * Sets the device scale factor. Acceptable value is one of: 1, 2 or 3.
443
511
  */