screenshotone-api-sdk 1.1.9 → 1.1.11

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.
@@ -298,6 +298,11 @@ export declare class TakeOptions {
298
298
  * selector is present in the view when taking a screenshot.
299
299
  */
300
300
  scrollIntoView(selector: string): TakeOptions;
301
+ /**
302
+ * After the given element appears in the viewport and its top coordinate is aligned with the viewport’s top,
303
+ * you can adjust the position a bit before taking a screenshot.
304
+ */
305
+ scrollIntoViewAdjustTop(adjustTop: number): TakeOptions;
301
306
  /**
302
307
  * You can use your custom proxy to take screenshots
303
308
  * or render HTML with the proxy option.
package/dist/main.js CHANGED
@@ -80,7 +80,7 @@ class Client {
80
80
  }
81
81
  try {
82
82
  const data = await response.json();
83
- throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`);
83
+ throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.error_message}`);
84
84
  }
85
85
  catch (e) {
86
86
  throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}`);
@@ -100,7 +100,7 @@ class Client {
100
100
  }
101
101
  try {
102
102
  const data = await response.json();
103
- throw new Error(`failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.message}`);
103
+ throw new Error(`failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.error_message}`);
104
104
  }
105
105
  catch (e) {
106
106
  throw new Error(`failed to generate animation, response returned ${response.status} ${response.statusText}`);
@@ -547,6 +547,14 @@ class TakeOptions {
547
547
  this.put("scroll_into_view", selector);
548
548
  return this;
549
549
  }
550
+ /**
551
+ * After the given element appears in the viewport and its top coordinate is aligned with the viewport’s top,
552
+ * you can adjust the position a bit before taking a screenshot.
553
+ */
554
+ scrollIntoViewAdjustTop(adjustTop) {
555
+ this.put("scroll_into_view_adjust_top", adjustTop.toString());
556
+ return this;
557
+ }
550
558
  /**
551
559
  * You can use your custom proxy to take screenshots
552
560
  * or render HTML with the proxy option.
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.9",
4
+ "version": "1.1.11",
5
5
  "description": "Use ScreenshotOne.com API to generate screenshots of any website.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -47,4 +47,4 @@
47
47
  "build": "tsc",
48
48
  "prepare": "npm run build"
49
49
  }
50
- }
50
+ }
package/src/main.ts CHANGED
@@ -95,7 +95,7 @@ export class Client {
95
95
  const data = await response.json();
96
96
 
97
97
  throw new Error(
98
- `failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`
98
+ `failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.error_message}`
99
99
  );
100
100
  } catch (e) {
101
101
  throw new Error(
@@ -121,7 +121,7 @@ export class Client {
121
121
  const data = await response.json();
122
122
 
123
123
  throw new Error(
124
- `failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.message}`
124
+ `failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.error_message}`
125
125
  );
126
126
  } catch (e) {
127
127
  throw new Error(
@@ -695,6 +695,16 @@ export class TakeOptions {
695
695
  return this;
696
696
  }
697
697
 
698
+ /**
699
+ * After the given element appears in the viewport and its top coordinate is aligned with the viewport’s top,
700
+ * you can adjust the position a bit before taking a screenshot.
701
+ */
702
+ scrollIntoViewAdjustTop(adjustTop: number): TakeOptions {
703
+ this.put("scroll_into_view_adjust_top", adjustTop.toString());
704
+
705
+ return this;
706
+ }
707
+
698
708
  /**
699
709
  * You can use your custom proxy to take screenshots
700
710
  * or render HTML with the proxy option.