screenshotone-api-sdk 1.0.3 → 1.0.6
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/main.js +263 -0
- package/package.json +5 -4
- package/{lib → src}/main.ts +0 -0
- package/tsconfig.json +7 -4
- package/lib/main.d.ts +0 -40
- package/lib/main.js +0 -145
- package/lib/main.js.map +0 -1
package/dist/main.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.TakeOptions = exports.Client = void 0;
|
|
30
|
+
const crypto = __importStar(require("crypto"));
|
|
31
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
32
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
33
|
+
/**
|
|
34
|
+
* Represents an API client for the screenshotone.com API.
|
|
35
|
+
*/
|
|
36
|
+
class Client {
|
|
37
|
+
constructor(accessKey, secretKey) {
|
|
38
|
+
this.API_BASE_URL = "https://api.screenshotone.com";
|
|
39
|
+
this.API_TAKE_PATH = "/take";
|
|
40
|
+
this.accessKey = accessKey;
|
|
41
|
+
this.secretKey = secretKey;
|
|
42
|
+
}
|
|
43
|
+
generateTakeURL(options) {
|
|
44
|
+
const query = options.toQuery();
|
|
45
|
+
query.append("access_key", this.accessKey);
|
|
46
|
+
let queryString = query.toString();
|
|
47
|
+
const signature = crypto.createHmac("sha256", this.secretKey)
|
|
48
|
+
.update(queryString, 'utf-8')
|
|
49
|
+
.digest('hex');
|
|
50
|
+
queryString += '&signature=' + signature;
|
|
51
|
+
return `${this.API_BASE_URL}${this.API_TAKE_PATH}?${queryString}`;
|
|
52
|
+
}
|
|
53
|
+
async take(options) {
|
|
54
|
+
const url = this.generateTakeURL(options);
|
|
55
|
+
const response = await (0, node_fetch_1.default)(url);
|
|
56
|
+
if (response.ok) {
|
|
57
|
+
return await response.blob();
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.Client = Client;
|
|
63
|
+
/**
|
|
64
|
+
* Represents options for taking screenshots.
|
|
65
|
+
*/
|
|
66
|
+
class TakeOptions {
|
|
67
|
+
constructor(url) {
|
|
68
|
+
const query = new URLSearchParams();
|
|
69
|
+
query.append("url", url);
|
|
70
|
+
this.query = query;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Initializes take screenshot options with provided website URL.
|
|
74
|
+
*/
|
|
75
|
+
static url(url) {
|
|
76
|
+
return new TakeOptions(url);
|
|
77
|
+
}
|
|
78
|
+
put(key, ...values) {
|
|
79
|
+
for (const value of values) {
|
|
80
|
+
this.query.append(key, value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
/**
|
|
85
|
+
* Renders the full page.
|
|
86
|
+
*/
|
|
87
|
+
fullPage(fullPage) {
|
|
88
|
+
this.put("full_page", fullPage ? "true" : "false");
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Sets response format, one of: "png", "jpeg", "webp" or "jpg".
|
|
93
|
+
*/
|
|
94
|
+
format(format) {
|
|
95
|
+
this.put("format", format);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Renders image with the specified quality. Available for the next formats: "jpeg" ("jpg"), "webp".
|
|
100
|
+
*/
|
|
101
|
+
imageQuality(imageQuality) {
|
|
102
|
+
this.put("image_quality", imageQuality.toString());
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Renders a transparent background for the image. Works only if the site has not defined background color.
|
|
107
|
+
* Available for the following response formats: "png", "webp".
|
|
108
|
+
*/
|
|
109
|
+
omitBackground(omitBackground) {
|
|
110
|
+
this.put("omit_background", omitBackground ? "true" : "false");
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sets the width of the browser viewport (pixels).
|
|
115
|
+
*/
|
|
116
|
+
viewportWidth(viewportWidth) {
|
|
117
|
+
this.put("viewport_width", viewportWidth.toString());
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Sets the height of the browser viewport (pixels).
|
|
122
|
+
*/
|
|
123
|
+
viewportHeight(viewportHeight) {
|
|
124
|
+
this.put("viewport_height", viewportHeight.toString());
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Sets the device scale factor. Acceptable value is one of: 1, 2 or 3.
|
|
129
|
+
*/
|
|
130
|
+
deviceScaleFactor(deviceScaleFactor) {
|
|
131
|
+
this.put("device_scale_factor", deviceScaleFactor.toString());
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sets geolocation latitude for the request.
|
|
136
|
+
* Both latitude and longitude are required if one of them is set.
|
|
137
|
+
*/
|
|
138
|
+
geolocationLatitude(latitude) {
|
|
139
|
+
this.put("geolocation_latitude", new big_js_1.default(latitude).toFixed(20).replace(/0+$/, ""));
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Sets geolocation longitude for the request. Both latitude and longitude are required if one of them is set.
|
|
144
|
+
*/
|
|
145
|
+
geolocationLongitude(longitude) {
|
|
146
|
+
this.put("geolocation_longitude", new big_js_1.default(longitude).toFixed(20).replace(/0+$/, ""));
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sets the geolocation accuracy in meters.
|
|
151
|
+
*/
|
|
152
|
+
geolocationAccuracy(accuracy) {
|
|
153
|
+
this.put("geolocation_accuracy", accuracy.toString());
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Blocks ads.
|
|
158
|
+
*/
|
|
159
|
+
blockAds(blockAds) {
|
|
160
|
+
this.put("block_ads", blockAds ? "true" : "false");
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Blocks trackers.
|
|
165
|
+
*/
|
|
166
|
+
blockTrackers(blockTrackers) {
|
|
167
|
+
this.put("block_trackers", blockTrackers ? "true" : "false");
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Blocks requests by specifying URL, domain, or even a simple pattern.
|
|
172
|
+
*/
|
|
173
|
+
blockRequests(...blockRequests) {
|
|
174
|
+
this.put("block_requests", ...blockRequests);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Blocks loading resources by type. Available resource types are: "document", "stylesheet", "image", "media",
|
|
179
|
+
* "font", "script", "texttrack", "xhr", "fetch", "eventsource", "websocket", "manifest", "other".
|
|
180
|
+
*/
|
|
181
|
+
blockResources(...blockResources) {
|
|
182
|
+
this.put("block_resources", ...blockResources);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Enables caching.
|
|
187
|
+
*/
|
|
188
|
+
cache(cache) {
|
|
189
|
+
this.put("cache", cache ? "true" : "false");
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Sets cache TTL.
|
|
194
|
+
*/
|
|
195
|
+
cacheTtl(cacheTTL) {
|
|
196
|
+
this.put("cache_ttl", cacheTTL.toString());
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sets cache key.
|
|
201
|
+
*/
|
|
202
|
+
cacheKey(cacheKey) {
|
|
203
|
+
this.put("cache_key", cacheKey);
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Sets a user agent for the request.
|
|
208
|
+
*/
|
|
209
|
+
userAgent(userAgent) {
|
|
210
|
+
this.put("user_agent", userAgent);
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Sets an authorization header for the request.
|
|
215
|
+
*/
|
|
216
|
+
authorization(authorization) {
|
|
217
|
+
this.put("authorization", authorization);
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Set cookies for the request.
|
|
222
|
+
*/
|
|
223
|
+
cookies(...cookies) {
|
|
224
|
+
this.put("cookies", ...cookies);
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Sets extra headers for the request.
|
|
229
|
+
*/
|
|
230
|
+
headers(...headers) {
|
|
231
|
+
this.put("headers", ...headers);
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* TimeZone sets time zone for the request.
|
|
236
|
+
* Available time zones are: "America/Santiago", "Asia/Shanghai", "Europe/Berlin", "America/Guayaquil",
|
|
237
|
+
* "Europe/Madrid", "Pacific/Majuro", "Asia/Kuala_Lumpur", "Pacific/Auckland", "Europe/Lisbon", "Europe/Kiev",
|
|
238
|
+
* "Asia/Tashkent", "Europe/London".
|
|
239
|
+
*/
|
|
240
|
+
timeZone(timeZone) {
|
|
241
|
+
this.put("time_zone", timeZone);
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Sets delay.
|
|
246
|
+
*/
|
|
247
|
+
delay(delay) {
|
|
248
|
+
this.put("delay", delay.toString());
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Sets timeout.
|
|
253
|
+
*/
|
|
254
|
+
timeout(timeout) {
|
|
255
|
+
this.put("timeout", timeout.toString());
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
toQuery() {
|
|
259
|
+
return new URLSearchParams(this.query.toString());
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.TakeOptions = TakeOptions;
|
|
263
|
+
//# sourceMappingURL=main.js.map
|
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.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"description": "Use ScreenshotOne.com API to generate screenshots of any website.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"email": "support@screenshotone.com",
|
|
28
28
|
"url": "https://github.com/screenshotone/tssdk/issues"
|
|
29
29
|
},
|
|
30
|
-
"
|
|
31
|
-
"main": "./lib/main.js",
|
|
30
|
+
"main": "dist/main.js",
|
|
32
31
|
"types": "dist/index.d.ts",
|
|
32
|
+
"type": "module",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^4.7.3",
|
|
35
35
|
"@types/node": "^17.0.40",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"node-fetch": "^3.2.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"prepublish": "
|
|
43
|
+
"prepublish": "npm run build",
|
|
44
|
+
"prepare" : "npm run build",
|
|
44
45
|
"build": "tsc --build"
|
|
45
46
|
}
|
|
46
47
|
}
|
package/{lib → src}/main.ts
RENAMED
|
File without changes
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"module": "es2022",
|
|
4
3
|
"target": "es2017",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"strict": true,
|
|
5
7
|
"noImplicitAny": true,
|
|
6
|
-
"removeComments":
|
|
8
|
+
"removeComments": false,
|
|
7
9
|
"preserveConstEnums": true,
|
|
8
10
|
"sourceMap": true,
|
|
9
11
|
"moduleResolution": "node",
|
|
10
12
|
"declaration": true,
|
|
11
13
|
"esModuleInterop": true
|
|
14
|
+
|
|
12
15
|
},
|
|
13
|
-
"include": ["
|
|
14
|
-
"exclude": ["node_modules"
|
|
16
|
+
"include": ["src/**/*"],
|
|
17
|
+
"exclude": ["node_modules"]
|
|
15
18
|
}
|
package/lib/main.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare class Client {
|
|
2
|
-
private readonly API_BASE_URL;
|
|
3
|
-
private readonly API_TAKE_PATH;
|
|
4
|
-
private readonly accessKey;
|
|
5
|
-
private readonly secretKey;
|
|
6
|
-
constructor(accessKey: string, secretKey: string);
|
|
7
|
-
generateTakeURL(options: TakeOptions): string;
|
|
8
|
-
take(options: TakeOptions): Promise<Blob>;
|
|
9
|
-
}
|
|
10
|
-
export declare class TakeOptions {
|
|
11
|
-
private readonly query;
|
|
12
|
-
private constructor();
|
|
13
|
-
static url(url: string): TakeOptions;
|
|
14
|
-
private put;
|
|
15
|
-
fullPage(fullPage: boolean): TakeOptions;
|
|
16
|
-
format(format: string): TakeOptions;
|
|
17
|
-
imageQuality(imageQuality: number): TakeOptions;
|
|
18
|
-
omitBackground(omitBackground: boolean): TakeOptions;
|
|
19
|
-
viewportWidth(viewportWidth: number): TakeOptions;
|
|
20
|
-
viewportHeight(viewportHeight: number): TakeOptions;
|
|
21
|
-
deviceScaleFactor(deviceScaleFactor: number): TakeOptions;
|
|
22
|
-
geolocationLatitude(latitude: number): TakeOptions;
|
|
23
|
-
geolocationLongitude(longitude: number): TakeOptions;
|
|
24
|
-
geolocationAccuracy(accuracy: number): TakeOptions;
|
|
25
|
-
blockAds(blockAds: boolean): TakeOptions;
|
|
26
|
-
blockTrackers(blockTrackers: boolean): TakeOptions;
|
|
27
|
-
blockRequests(...blockRequests: string[]): TakeOptions;
|
|
28
|
-
blockResources(...blockResources: string[]): TakeOptions;
|
|
29
|
-
cache(cache: boolean): TakeOptions;
|
|
30
|
-
cacheTtl(cacheTTL: number): TakeOptions;
|
|
31
|
-
cacheKey(cacheKey: string): TakeOptions;
|
|
32
|
-
userAgent(userAgent: string): TakeOptions;
|
|
33
|
-
authorization(authorization: string): TakeOptions;
|
|
34
|
-
cookies(...cookies: string[]): TakeOptions;
|
|
35
|
-
headers(...headers: string[]): this;
|
|
36
|
-
timeZone(timeZone: string): TakeOptions;
|
|
37
|
-
delay(delay: number): TakeOptions;
|
|
38
|
-
timeout(timeout: number): TakeOptions;
|
|
39
|
-
toQuery(): URLSearchParams;
|
|
40
|
-
}
|
package/lib/main.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as crypto from 'crypto';
|
|
2
|
-
import Big from 'big.js';
|
|
3
|
-
import fetch from 'node-fetch';
|
|
4
|
-
export class Client {
|
|
5
|
-
constructor(accessKey, secretKey) {
|
|
6
|
-
this.API_BASE_URL = "https://api.screenshotone.com";
|
|
7
|
-
this.API_TAKE_PATH = "/take";
|
|
8
|
-
this.accessKey = accessKey;
|
|
9
|
-
this.secretKey = secretKey;
|
|
10
|
-
}
|
|
11
|
-
generateTakeURL(options) {
|
|
12
|
-
const query = options.toQuery();
|
|
13
|
-
query.append("access_key", this.accessKey);
|
|
14
|
-
let queryString = query.toString();
|
|
15
|
-
const signature = crypto.createHmac("sha256", this.secretKey)
|
|
16
|
-
.update(queryString, 'utf-8')
|
|
17
|
-
.digest('hex');
|
|
18
|
-
queryString += '&signature=' + signature;
|
|
19
|
-
return `${this.API_BASE_URL}${this.API_TAKE_PATH}?${queryString}`;
|
|
20
|
-
}
|
|
21
|
-
async take(options) {
|
|
22
|
-
const url = this.generateTakeURL(options);
|
|
23
|
-
const response = await fetch(url);
|
|
24
|
-
if (response.ok) {
|
|
25
|
-
return await response.blob();
|
|
26
|
-
}
|
|
27
|
-
throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export class TakeOptions {
|
|
31
|
-
constructor(url) {
|
|
32
|
-
const query = new URLSearchParams();
|
|
33
|
-
query.append("url", url);
|
|
34
|
-
this.query = query;
|
|
35
|
-
}
|
|
36
|
-
static url(url) {
|
|
37
|
-
return new TakeOptions(url);
|
|
38
|
-
}
|
|
39
|
-
put(key, ...values) {
|
|
40
|
-
for (const value of values) {
|
|
41
|
-
this.query.append(key, value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
;
|
|
45
|
-
fullPage(fullPage) {
|
|
46
|
-
this.put("full_page", fullPage ? "true" : "false");
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
format(format) {
|
|
50
|
-
this.put("format", format);
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
imageQuality(imageQuality) {
|
|
54
|
-
this.put("image_quality", imageQuality.toString());
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
omitBackground(omitBackground) {
|
|
58
|
-
this.put("omit_background", omitBackground ? "true" : "false");
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
viewportWidth(viewportWidth) {
|
|
62
|
-
this.put("viewport_width", viewportWidth.toString());
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
viewportHeight(viewportHeight) {
|
|
66
|
-
this.put("viewport_height", viewportHeight.toString());
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
deviceScaleFactor(deviceScaleFactor) {
|
|
70
|
-
this.put("device_scale_factor", deviceScaleFactor.toString());
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
geolocationLatitude(latitude) {
|
|
74
|
-
this.put("geolocation_latitude", new Big(latitude).toFixed(20).replace(/0+$/, ""));
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
geolocationLongitude(longitude) {
|
|
78
|
-
this.put("geolocation_longitude", new Big(longitude).toFixed(20).replace(/0+$/, ""));
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
geolocationAccuracy(accuracy) {
|
|
82
|
-
this.put("geolocation_accuracy", accuracy.toString());
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
blockAds(blockAds) {
|
|
86
|
-
this.put("block_ads", blockAds ? "true" : "false");
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
blockTrackers(blockTrackers) {
|
|
90
|
-
this.put("block_trackers", blockTrackers ? "true" : "false");
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
blockRequests(...blockRequests) {
|
|
94
|
-
this.put("block_requests", ...blockRequests);
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
blockResources(...blockResources) {
|
|
98
|
-
this.put("block_resources", ...blockResources);
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
cache(cache) {
|
|
102
|
-
this.put("cache", cache ? "true" : "false");
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
cacheTtl(cacheTTL) {
|
|
106
|
-
this.put("cache_ttl", cacheTTL.toString());
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
cacheKey(cacheKey) {
|
|
110
|
-
this.put("cache_key", cacheKey);
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
userAgent(userAgent) {
|
|
114
|
-
this.put("user_agent", userAgent);
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
authorization(authorization) {
|
|
118
|
-
this.put("authorization", authorization);
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
cookies(...cookies) {
|
|
122
|
-
this.put("cookies", ...cookies);
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
headers(...headers) {
|
|
126
|
-
this.put("headers", ...headers);
|
|
127
|
-
return this;
|
|
128
|
-
}
|
|
129
|
-
timeZone(timeZone) {
|
|
130
|
-
this.put("time_zone", timeZone);
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
|
-
delay(delay) {
|
|
134
|
-
this.put("delay", delay.toString());
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
timeout(timeout) {
|
|
138
|
-
this.put("timeout", timeout.toString());
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
toQuery() {
|
|
142
|
-
return new URLSearchParams(this.query.toString());
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=main.js.map
|
package/lib/main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,KAAK,MAAM,YAAY,CAAC;AAK/B,MAAM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