@mendable/firecrawl-js 4.19.0 → 4.20.0
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/audit-ci.jsonc +5 -2
- package/dist/{chunk-JJY4NJXL.js → chunk-UXVHRV2G.js} +1 -1
- package/dist/index.cjs +118 -47
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +119 -48
- package/dist/{package-HMEPZJ3J.js → package-ELM7Z5VP.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/scrape-browser.unit.test.ts +39 -12
- package/src/v2/methods/batch.ts +89 -28
- package/src/v2/methods/browser.ts +19 -11
- package/src/v2/methods/map.ts +36 -9
- package/src/v2/methods/parse.ts +15 -9
- package/src/v2/methods/scrape.ts +32 -13
- package/src/v2/methods/search.ts +38 -10
- package/src/v2/utils/httpClient.ts +36 -16
package/audit-ci.jsonc
CHANGED
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.
|
|
11
|
+
version: "4.20.0",
|
|
12
12
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
13
|
main: "dist/index.js",
|
|
14
14
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.
|
|
38
|
+
version: "4.20.0",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -182,10 +182,10 @@ var HttpClient = class {
|
|
|
182
182
|
const isPlainObjectBody = !isFormDataBody && cfg.data != null && typeof cfg.data === "object" && !Array.isArray(cfg.data);
|
|
183
183
|
if (isPlainObjectBody && cfg.method && ["post", "put", "patch"].includes(cfg.method.toLowerCase())) {
|
|
184
184
|
const data = cfg.data ?? {};
|
|
185
|
-
cfg.data = {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
185
|
+
cfg.data = {
|
|
186
|
+
...data,
|
|
187
|
+
origin: typeof data.origin === "string" && data.origin.includes("mcp") ? data.origin : `js-sdk@${version}`
|
|
188
|
+
};
|
|
189
189
|
}
|
|
190
190
|
if (isFormDataBody) {
|
|
191
191
|
cfg.headers = { ...cfg.headers || {} };
|
|
@@ -213,16 +213,22 @@ var HttpClient = class {
|
|
|
213
213
|
sleep(seconds) {
|
|
214
214
|
return new Promise((r) => setTimeout(r, seconds * 1e3));
|
|
215
215
|
}
|
|
216
|
-
post(endpoint, body,
|
|
217
|
-
return this.request({
|
|
216
|
+
post(endpoint, body, options) {
|
|
217
|
+
return this.request({
|
|
218
|
+
method: "post",
|
|
219
|
+
url: endpoint,
|
|
220
|
+
data: body,
|
|
221
|
+
headers: options?.headers,
|
|
222
|
+
timeout: options?.timeoutMs
|
|
223
|
+
});
|
|
218
224
|
}
|
|
219
|
-
postMultipart(endpoint, formData,
|
|
225
|
+
postMultipart(endpoint, formData, options) {
|
|
220
226
|
return this.request({
|
|
221
227
|
method: "post",
|
|
222
228
|
url: endpoint,
|
|
223
229
|
data: formData,
|
|
224
|
-
headers,
|
|
225
|
-
timeout: timeoutMs
|
|
230
|
+
headers: options?.headers,
|
|
231
|
+
timeout: options?.timeoutMs
|
|
226
232
|
});
|
|
227
233
|
}
|
|
228
234
|
get(endpoint, headers) {
|
|
@@ -488,7 +494,11 @@ async function scrape(http, url, options) {
|
|
|
488
494
|
const payload = { url: url.trim() };
|
|
489
495
|
if (options) Object.assign(payload, options);
|
|
490
496
|
try {
|
|
491
|
-
const res = await http.post(
|
|
497
|
+
const res = await http.post(
|
|
498
|
+
"/v2/scrape",
|
|
499
|
+
payload,
|
|
500
|
+
typeof options?.timeout === "number" ? { timeoutMs: options.timeout + 5e3 } : {}
|
|
501
|
+
);
|
|
492
502
|
if (res.status !== 200 || !res.data?.success) {
|
|
493
503
|
throwForBadResponse(res, "scrape");
|
|
494
504
|
}
|
|
@@ -516,12 +526,15 @@ async function interact(http, jobId, args) {
|
|
|
516
526
|
try {
|
|
517
527
|
const res = await http.post(
|
|
518
528
|
`/v2/scrape/${jobId}/interact`,
|
|
519
|
-
body
|
|
529
|
+
body,
|
|
530
|
+
args.timeout != null ? { timeoutMs: args.timeout * 1e3 + 5e3 } : {}
|
|
520
531
|
);
|
|
521
|
-
if (res.status !== 200)
|
|
532
|
+
if (res.status !== 200)
|
|
533
|
+
throwForBadResponse(res, "interact with scrape browser");
|
|
522
534
|
return res.data;
|
|
523
535
|
} catch (err) {
|
|
524
|
-
if (err?.isAxiosError)
|
|
536
|
+
if (err?.isAxiosError)
|
|
537
|
+
return normalizeAxiosError(err, "interact with scrape browser");
|
|
525
538
|
throw err;
|
|
526
539
|
}
|
|
527
540
|
}
|
|
@@ -559,7 +572,9 @@ function toUploadBlob(input, contentType) {
|
|
|
559
572
|
return new Blob([input], { type: contentType });
|
|
560
573
|
}
|
|
561
574
|
if (typeof input === "string") {
|
|
562
|
-
return new Blob([input], {
|
|
575
|
+
return new Blob([input], {
|
|
576
|
+
type: contentType ?? "text/plain; charset=utf-8"
|
|
577
|
+
});
|
|
563
578
|
}
|
|
564
579
|
throw new Error("Unsupported parse file data type");
|
|
565
580
|
}
|
|
@@ -587,9 +602,12 @@ async function parse(http, file, options) {
|
|
|
587
602
|
toUploadBlob(file.data, file.contentType),
|
|
588
603
|
file.filename.trim()
|
|
589
604
|
);
|
|
590
|
-
const requestTimeoutMs = typeof normalizedOptions.timeout === "number" ? normalizedOptions.timeout + 5e3 : void 0;
|
|
591
605
|
try {
|
|
592
|
-
const res = await http.postMultipart(
|
|
606
|
+
const res = await http.postMultipart(
|
|
607
|
+
"/v2/parse",
|
|
608
|
+
formData,
|
|
609
|
+
typeof normalizedOptions.timeout === "number" ? { timeoutMs: normalizedOptions.timeout + 5e3 } : {}
|
|
610
|
+
);
|
|
593
611
|
if (res.status !== 200 || !res.data?.success) {
|
|
594
612
|
throwForBadResponse(res, "parse");
|
|
595
613
|
}
|
|
@@ -603,8 +621,10 @@ async function parse(http, file, options) {
|
|
|
603
621
|
// src/v2/methods/search.ts
|
|
604
622
|
function prepareSearchPayload(req) {
|
|
605
623
|
if (!req.query || !req.query.trim()) throw new Error("Query cannot be empty");
|
|
606
|
-
if (req.limit != null && req.limit <= 0)
|
|
607
|
-
|
|
624
|
+
if (req.limit != null && req.limit <= 0)
|
|
625
|
+
throw new Error("limit must be positive");
|
|
626
|
+
if (req.timeout != null && req.timeout <= 0)
|
|
627
|
+
throw new Error("timeout must be positive");
|
|
608
628
|
const payload = {
|
|
609
629
|
query: req.query
|
|
610
630
|
};
|
|
@@ -613,9 +633,11 @@ function prepareSearchPayload(req) {
|
|
|
613
633
|
if (req.limit != null) payload.limit = req.limit;
|
|
614
634
|
if (req.tbs != null) payload.tbs = req.tbs;
|
|
615
635
|
if (req.location != null) payload.location = req.location;
|
|
616
|
-
if (req.ignoreInvalidURLs != null)
|
|
636
|
+
if (req.ignoreInvalidURLs != null)
|
|
637
|
+
payload.ignoreInvalidURLs = req.ignoreInvalidURLs;
|
|
617
638
|
if (req.timeout != null) payload.timeout = req.timeout;
|
|
618
|
-
if (req.integration && req.integration.trim())
|
|
639
|
+
if (req.integration && req.integration.trim())
|
|
640
|
+
payload.integration = req.integration.trim();
|
|
619
641
|
if (req.origin) payload.origin = req.origin;
|
|
620
642
|
if (req.scrapeOptions) {
|
|
621
643
|
ensureValidScrapeOptions(req.scrapeOptions);
|
|
@@ -641,7 +663,11 @@ function transformArray(arr) {
|
|
|
641
663
|
async function search(http, request) {
|
|
642
664
|
const payload = prepareSearchPayload(request);
|
|
643
665
|
try {
|
|
644
|
-
const res = await http.post(
|
|
666
|
+
const res = await http.post(
|
|
667
|
+
"/v2/search",
|
|
668
|
+
payload,
|
|
669
|
+
typeof request.timeout === "number" ? { timeoutMs: request.timeout + 5e3 } : {}
|
|
670
|
+
);
|
|
645
671
|
if (res.status !== 200 || !res.data?.success) {
|
|
646
672
|
throwForBadResponse(res, "search");
|
|
647
673
|
}
|
|
@@ -649,7 +675,8 @@ async function search(http, request) {
|
|
|
649
675
|
const out = {};
|
|
650
676
|
if (data.web) out.web = transformArray(data.web);
|
|
651
677
|
if (data.news) out.news = transformArray(data.news);
|
|
652
|
-
if (data.images)
|
|
678
|
+
if (data.images)
|
|
679
|
+
out.images = transformArray(data.images);
|
|
653
680
|
return out;
|
|
654
681
|
} catch (err) {
|
|
655
682
|
if (err?.isAxiosError) return normalizeAxiosError(err, "search");
|
|
@@ -664,11 +691,14 @@ function prepareMapPayload(url, options) {
|
|
|
664
691
|
if (options) {
|
|
665
692
|
if (options.sitemap != null) payload.sitemap = options.sitemap;
|
|
666
693
|
if (options.search != null) payload.search = options.search;
|
|
667
|
-
if (options.includeSubdomains != null)
|
|
668
|
-
|
|
694
|
+
if (options.includeSubdomains != null)
|
|
695
|
+
payload.includeSubdomains = options.includeSubdomains;
|
|
696
|
+
if (options.ignoreQueryParameters != null)
|
|
697
|
+
payload.ignoreQueryParameters = options.ignoreQueryParameters;
|
|
669
698
|
if (options.limit != null) payload.limit = options.limit;
|
|
670
699
|
if (options.timeout != null) payload.timeout = options.timeout;
|
|
671
|
-
if (options.integration != null && options.integration.trim())
|
|
700
|
+
if (options.integration != null && options.integration.trim())
|
|
701
|
+
payload.integration = options.integration.trim();
|
|
672
702
|
if (options.origin) payload.origin = options.origin;
|
|
673
703
|
if (options.location != null) payload.location = options.location;
|
|
674
704
|
}
|
|
@@ -677,7 +707,11 @@ function prepareMapPayload(url, options) {
|
|
|
677
707
|
async function map(http, url, options) {
|
|
678
708
|
const payload = prepareMapPayload(url, options);
|
|
679
709
|
try {
|
|
680
|
-
const res = await http.post(
|
|
710
|
+
const res = await http.post(
|
|
711
|
+
"/v2/map",
|
|
712
|
+
payload,
|
|
713
|
+
typeof options?.timeout === "number" ? { timeoutMs: options.timeout + 5e3 } : {}
|
|
714
|
+
);
|
|
681
715
|
if (res.status !== 200 || !res.data?.success) {
|
|
682
716
|
throwForBadResponse(res, "map");
|
|
683
717
|
}
|
|
@@ -685,7 +719,12 @@ async function map(http, url, options) {
|
|
|
685
719
|
const links = [];
|
|
686
720
|
for (const item of linksIn) {
|
|
687
721
|
if (typeof item === "string") links.push({ url: item });
|
|
688
|
-
else if (item && typeof item === "object")
|
|
722
|
+
else if (item && typeof item === "object")
|
|
723
|
+
links.push({
|
|
724
|
+
url: item.url,
|
|
725
|
+
title: item.title,
|
|
726
|
+
description: item.description
|
|
727
|
+
});
|
|
689
728
|
}
|
|
690
729
|
return { links };
|
|
691
730
|
} catch (err) {
|
|
@@ -897,7 +936,8 @@ async function startBatchScrape(http, urls, {
|
|
|
897
936
|
integration,
|
|
898
937
|
origin
|
|
899
938
|
} = {}) {
|
|
900
|
-
if (!Array.isArray(urls) || urls.length === 0)
|
|
939
|
+
if (!Array.isArray(urls) || urls.length === 0)
|
|
940
|
+
throw new Error("URLs list cannot be empty");
|
|
901
941
|
const payload = { urls };
|
|
902
942
|
if (options) {
|
|
903
943
|
ensureValidScrapeOptions(options);
|
|
@@ -908,22 +948,30 @@ async function startBatchScrape(http, urls, {
|
|
|
908
948
|
if (ignoreInvalidURLs != null) payload.ignoreInvalidURLs = ignoreInvalidURLs;
|
|
909
949
|
if (maxConcurrency != null) payload.maxConcurrency = maxConcurrency;
|
|
910
950
|
if (zeroDataRetention != null) payload.zeroDataRetention = zeroDataRetention;
|
|
911
|
-
if (integration != null && integration.trim())
|
|
951
|
+
if (integration != null && integration.trim())
|
|
952
|
+
payload.integration = integration.trim();
|
|
912
953
|
if (origin) payload.origin = origin;
|
|
913
954
|
try {
|
|
914
955
|
const headers = http.prepareHeaders(idempotencyKey);
|
|
915
|
-
const res = await http.post("/v2/batch/scrape", payload, headers);
|
|
916
|
-
if (res.status !== 200 || !res.data?.success)
|
|
917
|
-
|
|
956
|
+
const res = await http.post("/v2/batch/scrape", payload, { headers });
|
|
957
|
+
if (res.status !== 200 || !res.data?.success)
|
|
958
|
+
throwForBadResponse(res, "start batch scrape");
|
|
959
|
+
return {
|
|
960
|
+
id: res.data.id,
|
|
961
|
+
url: res.data.url,
|
|
962
|
+
invalidURLs: res.data.invalidURLs || void 0
|
|
963
|
+
};
|
|
918
964
|
} catch (err) {
|
|
919
|
-
if (err?.isAxiosError)
|
|
965
|
+
if (err?.isAxiosError)
|
|
966
|
+
return normalizeAxiosError(err, "start batch scrape");
|
|
920
967
|
throw err;
|
|
921
968
|
}
|
|
922
969
|
}
|
|
923
970
|
async function getBatchScrapeStatus(http, jobId, pagination) {
|
|
924
971
|
try {
|
|
925
972
|
const res = await http.get(`/v2/batch/scrape/${jobId}`);
|
|
926
|
-
if (res.status !== 200 || !res.data?.success)
|
|
973
|
+
if (res.status !== 200 || !res.data?.success)
|
|
974
|
+
throwForBadResponse(res, "get batch scrape status");
|
|
927
975
|
const body = res.data;
|
|
928
976
|
const initialDocs = body.data || [];
|
|
929
977
|
const auto = pagination?.autoPaginate ?? true;
|
|
@@ -939,7 +987,12 @@ async function getBatchScrapeStatus(http, jobId, pagination) {
|
|
|
939
987
|
data: initialDocs
|
|
940
988
|
};
|
|
941
989
|
}
|
|
942
|
-
const aggregated = await fetchAllPages(
|
|
990
|
+
const aggregated = await fetchAllPages(
|
|
991
|
+
http,
|
|
992
|
+
body.next,
|
|
993
|
+
initialDocs,
|
|
994
|
+
pagination
|
|
995
|
+
);
|
|
943
996
|
return {
|
|
944
997
|
id: jobId,
|
|
945
998
|
status: body.status,
|
|
@@ -951,17 +1004,21 @@ async function getBatchScrapeStatus(http, jobId, pagination) {
|
|
|
951
1004
|
data: aggregated
|
|
952
1005
|
};
|
|
953
1006
|
} catch (err) {
|
|
954
|
-
if (err?.isAxiosError)
|
|
1007
|
+
if (err?.isAxiosError)
|
|
1008
|
+
return normalizeAxiosError(err, "get batch scrape status");
|
|
955
1009
|
throw err;
|
|
956
1010
|
}
|
|
957
1011
|
}
|
|
958
1012
|
async function cancelBatchScrape(http, jobId) {
|
|
959
1013
|
try {
|
|
960
|
-
const res = await http.delete(
|
|
1014
|
+
const res = await http.delete(
|
|
1015
|
+
`/v2/batch/scrape/${jobId}`
|
|
1016
|
+
);
|
|
961
1017
|
if (res.status !== 200) throwForBadResponse(res, "cancel batch scrape");
|
|
962
1018
|
return res.data?.status === "cancelled";
|
|
963
1019
|
} catch (err) {
|
|
964
|
-
if (err?.isAxiosError)
|
|
1020
|
+
if (err?.isAxiosError)
|
|
1021
|
+
return normalizeAxiosError(err, "cancel batch scrape");
|
|
965
1022
|
throw err;
|
|
966
1023
|
}
|
|
967
1024
|
}
|
|
@@ -970,9 +1027,13 @@ async function getBatchScrapeErrors(http, jobId) {
|
|
|
970
1027
|
const res = await http.get(`/v2/batch/scrape/${jobId}/errors`);
|
|
971
1028
|
if (res.status !== 200) throwForBadResponse(res, "get batch scrape errors");
|
|
972
1029
|
const payload = res.data?.data ?? res.data;
|
|
973
|
-
return {
|
|
1030
|
+
return {
|
|
1031
|
+
errors: payload.errors || [],
|
|
1032
|
+
robotsBlocked: payload.robotsBlocked || []
|
|
1033
|
+
};
|
|
974
1034
|
} catch (err) {
|
|
975
|
-
if (err?.isAxiosError)
|
|
1035
|
+
if (err?.isAxiosError)
|
|
1036
|
+
return normalizeAxiosError(err, "get batch scrape errors");
|
|
976
1037
|
throw err;
|
|
977
1038
|
}
|
|
978
1039
|
}
|
|
@@ -1007,7 +1068,12 @@ async function waitForBatchCompletion(http, jobId, pollInterval = 2, timeout) {
|
|
|
1007
1068
|
}
|
|
1008
1069
|
async function batchScrape(http, urls, opts = {}) {
|
|
1009
1070
|
const start = await startBatchScrape(http, urls, opts);
|
|
1010
|
-
return waitForBatchCompletion(
|
|
1071
|
+
return waitForBatchCompletion(
|
|
1072
|
+
http,
|
|
1073
|
+
start.id,
|
|
1074
|
+
opts.pollInterval ?? 2,
|
|
1075
|
+
opts.timeout
|
|
1076
|
+
);
|
|
1011
1077
|
}
|
|
1012
1078
|
|
|
1013
1079
|
// src/v2/methods/extract.ts
|
|
@@ -1146,7 +1212,8 @@ async function browser(http, args = {}) {
|
|
|
1146
1212
|
if (res.status !== 200) throwForBadResponse(res, "create browser session");
|
|
1147
1213
|
return res.data;
|
|
1148
1214
|
} catch (err) {
|
|
1149
|
-
if (err?.isAxiosError)
|
|
1215
|
+
if (err?.isAxiosError)
|
|
1216
|
+
return normalizeAxiosError(err, "create browser session");
|
|
1150
1217
|
throw err;
|
|
1151
1218
|
}
|
|
1152
1219
|
}
|
|
@@ -1159,12 +1226,14 @@ async function browserExecute(http, sessionId, args) {
|
|
|
1159
1226
|
try {
|
|
1160
1227
|
const res = await http.post(
|
|
1161
1228
|
`/v2/browser/${sessionId}/execute`,
|
|
1162
|
-
body
|
|
1229
|
+
body,
|
|
1230
|
+
args.timeout != null ? { timeoutMs: args.timeout * 1e3 + 5e3 } : {}
|
|
1163
1231
|
);
|
|
1164
1232
|
if (res.status !== 200) throwForBadResponse(res, "execute browser code");
|
|
1165
1233
|
return res.data;
|
|
1166
1234
|
} catch (err) {
|
|
1167
|
-
if (err?.isAxiosError)
|
|
1235
|
+
if (err?.isAxiosError)
|
|
1236
|
+
return normalizeAxiosError(err, "execute browser code");
|
|
1168
1237
|
throw err;
|
|
1169
1238
|
}
|
|
1170
1239
|
}
|
|
@@ -1176,7 +1245,8 @@ async function deleteBrowser(http, sessionId) {
|
|
|
1176
1245
|
if (res.status !== 200) throwForBadResponse(res, "delete browser session");
|
|
1177
1246
|
return res.data;
|
|
1178
1247
|
} catch (err) {
|
|
1179
|
-
if (err?.isAxiosError)
|
|
1248
|
+
if (err?.isAxiosError)
|
|
1249
|
+
return normalizeAxiosError(err, "delete browser session");
|
|
1180
1250
|
throw err;
|
|
1181
1251
|
}
|
|
1182
1252
|
}
|
|
@@ -1188,7 +1258,8 @@ async function listBrowsers(http, args = {}) {
|
|
|
1188
1258
|
if (res.status !== 200) throwForBadResponse(res, "list browser sessions");
|
|
1189
1259
|
return res.data;
|
|
1190
1260
|
} catch (err) {
|
|
1191
|
-
if (err?.isAxiosError)
|
|
1261
|
+
if (err?.isAxiosError)
|
|
1262
|
+
return normalizeAxiosError(err, "list browser sessions");
|
|
1192
1263
|
throw err;
|
|
1193
1264
|
}
|
|
1194
1265
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -649,6 +649,10 @@ interface HttpClientOptions {
|
|
|
649
649
|
maxRetries?: number;
|
|
650
650
|
backoffFactor?: number;
|
|
651
651
|
}
|
|
652
|
+
interface RequestOptions {
|
|
653
|
+
headers?: Record<string, string>;
|
|
654
|
+
timeoutMs?: number;
|
|
655
|
+
}
|
|
652
656
|
declare class HttpClient {
|
|
653
657
|
private instance;
|
|
654
658
|
private readonly apiKey;
|
|
@@ -660,8 +664,8 @@ declare class HttpClient {
|
|
|
660
664
|
getApiKey(): string;
|
|
661
665
|
private request;
|
|
662
666
|
private sleep;
|
|
663
|
-
post<T = any>(endpoint: string, body: Record<string, unknown>,
|
|
664
|
-
postMultipart<T = any>(endpoint: string, formData: FormData,
|
|
667
|
+
post<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
668
|
+
postMultipart<T = any>(endpoint: string, formData: FormData, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
665
669
|
get<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
666
670
|
delete<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
667
671
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -649,6 +649,10 @@ interface HttpClientOptions {
|
|
|
649
649
|
maxRetries?: number;
|
|
650
650
|
backoffFactor?: number;
|
|
651
651
|
}
|
|
652
|
+
interface RequestOptions {
|
|
653
|
+
headers?: Record<string, string>;
|
|
654
|
+
timeoutMs?: number;
|
|
655
|
+
}
|
|
652
656
|
declare class HttpClient {
|
|
653
657
|
private instance;
|
|
654
658
|
private readonly apiKey;
|
|
@@ -660,8 +664,8 @@ declare class HttpClient {
|
|
|
660
664
|
getApiKey(): string;
|
|
661
665
|
private request;
|
|
662
666
|
private sleep;
|
|
663
|
-
post<T = any>(endpoint: string, body: Record<string, unknown>,
|
|
664
|
-
postMultipart<T = any>(endpoint: string, formData: FormData,
|
|
667
|
+
post<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
668
|
+
postMultipart<T = any>(endpoint: string, formData: FormData, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
665
669
|
get<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
666
670
|
delete<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
667
671
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|