screenshotone-api-sdk 1.0.27 → 1.0.29

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.
@@ -44,6 +44,13 @@ export declare class Client {
44
44
  * @returns
45
45
  */
46
46
  animate(options: AnimateOptions): Promise<Blob>;
47
+ /**
48
+ * Generates an animated screenshot and return the image blob.
49
+ *
50
+ * @param options
51
+ * @returns
52
+ */
53
+ store(options: AnimateOptions | TakeOptions, path: string, bucket?: string, acl?: "public-read" | "", storageClass?: string): Promise<void>;
47
54
  }
48
55
  /**
49
56
  * Represents options for taking screenshots.
@@ -191,6 +198,10 @@ export declare class TakeOptions {
191
198
  * Blocks ads.
192
199
  */
193
200
  blockAds(blockAds: boolean): TakeOptions;
201
+ /**
202
+ * Blocks banners by heuristics.
203
+ */
204
+ blockBannersByHeuristics(block: boolean): TakeOptions;
194
205
  /**
195
206
  * Blocks cookie banners.
196
207
  */
@@ -280,6 +291,7 @@ export declare class TakeOptions {
280
291
  * You can also specify “subdirectories” in the path part.
281
292
  */
282
293
  storagePath(path: string): TakeOptions;
294
+ storageACL(acl: string): TakeOptions;
283
295
  /**
284
296
  * You can override the default bucket you configured with storage_bucket=<bucket name>.
285
297
  */
@@ -508,6 +520,7 @@ export declare class AnimateOptions {
508
520
  * Storage class allows you to specify the object storage class.
509
521
  */
510
522
  storageClass(storageClass: string): AnimateOptions;
523
+ storageACL(acl: string): AnimateOptions;
511
524
  /**
512
525
  * Sets animation duration.
513
526
  */
package/dist/main.js CHANGED
@@ -123,6 +123,29 @@ class Client {
123
123
  const data = await response.json();
124
124
  throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`);
125
125
  }
126
+ /**
127
+ * Generates an animated screenshot and return the image blob.
128
+ *
129
+ * @param options
130
+ * @returns
131
+ */
132
+ async store(options, path, bucket, acl, storageClass) {
133
+ options
134
+ .store(true)
135
+ .storagePath(path);
136
+ if (bucket) {
137
+ options.storageBucket(bucket);
138
+ }
139
+ if (acl) {
140
+ options.storageACL(acl);
141
+ }
142
+ if (storageClass) {
143
+ options.storageClass(storageClass);
144
+ }
145
+ const url = (options instanceof TakeOptions)
146
+ ? this.generateSignedTakeURL(options)
147
+ : this.generateSignedAnimateURL(options);
148
+ }
126
149
  }
127
150
  exports.Client = Client;
128
151
  /**
@@ -368,6 +391,13 @@ class TakeOptions {
368
391
  this.put("block_ads", blockAds ? "true" : "false");
369
392
  return this;
370
393
  }
394
+ /**
395
+ * Blocks banners by heuristics.
396
+ */
397
+ blockBannersByHeuristics(block) {
398
+ this.put("block_banners_by_heuristics", block ? "true" : "false");
399
+ return this;
400
+ }
371
401
  /**
372
402
  * Blocks cookie banners.
373
403
  */
@@ -514,6 +544,10 @@ class TakeOptions {
514
544
  this.put("storage_path", path);
515
545
  return this;
516
546
  }
547
+ storageACL(acl) {
548
+ this.put("storage_acl", acl);
549
+ return this;
550
+ }
517
551
  /**
518
552
  * You can override the default bucket you configured with storage_bucket=<bucket name>.
519
553
  */
@@ -893,6 +927,10 @@ class AnimateOptions {
893
927
  this.put("storage_class", storageClass);
894
928
  return this;
895
929
  }
930
+ storageACL(acl) {
931
+ this.put("storage_acl", acl);
932
+ return this;
933
+ }
896
934
  /**
897
935
  * Sets animation duration.
898
936
  */
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.0.27",
4
+ "version": "1.0.29",
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
@@ -114,6 +114,32 @@ export class Client {
114
114
 
115
115
  throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`);
116
116
  }
117
+
118
+ /**
119
+ * Generates an animated screenshot and return the image blob.
120
+ *
121
+ * @param options
122
+ * @returns
123
+ */
124
+ async store(options: AnimateOptions | TakeOptions, path: string, bucket?: string, acl?: "public-read" | "", storageClass?: string) {
125
+ options
126
+ .store(true)
127
+ .storagePath(path);
128
+
129
+ if (bucket) {
130
+ options.storageBucket(bucket);
131
+ }
132
+ if (acl) {
133
+ options.storageACL(acl);
134
+ }
135
+ if (storageClass) {
136
+ options.storageClass(storageClass)
137
+ }
138
+
139
+ const url = (options instanceof TakeOptions)
140
+ ? this.generateSignedTakeURL(options)
141
+ : this.generateSignedAnimateURL(options);
142
+ }
117
143
  }
118
144
 
119
145
  /**
@@ -422,6 +448,15 @@ export class TakeOptions {
422
448
  return this;
423
449
  }
424
450
 
451
+ /**
452
+ * Blocks banners by heuristics.
453
+ */
454
+ blockBannersByHeuristics(block: boolean): TakeOptions {
455
+ this.put("block_banners_by_heuristics", block ? "true" : "false");
456
+
457
+ return this;
458
+ }
459
+
425
460
  /**
426
461
  * Blocks cookie banners.
427
462
  */
@@ -607,6 +642,12 @@ export class TakeOptions {
607
642
  return this;
608
643
  }
609
644
 
645
+ storageACL(acl: string): TakeOptions {
646
+ this.put("storage_acl", acl);
647
+
648
+ return this;
649
+ }
650
+
610
651
  /**
611
652
  * You can override the default bucket you configured with storage_bucket=<bucket name>.
612
653
  */
@@ -1082,6 +1123,12 @@ export class AnimateOptions {
1082
1123
  return this;
1083
1124
  }
1084
1125
 
1126
+ storageACL(acl: string): AnimateOptions {
1127
+ this.put("storage_acl", acl);
1128
+
1129
+ return this;
1130
+ }
1131
+
1085
1132
  /**
1086
1133
  * Sets animation duration.
1087
1134
  */