@getanyapi/sdk 0.178.18 → 0.179.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/README.md +9 -1
- package/dist/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -485,8 +485,14 @@ declare class NotFoundError extends AnyAPIError {
|
|
|
485
485
|
*/
|
|
486
486
|
declare class ResultNotFoundError extends NotFoundError {
|
|
487
487
|
}
|
|
488
|
-
/**
|
|
488
|
+
/**
|
|
489
|
+
* HTTP 429. `retryAfterSeconds` is the response's Retry-After when it carried one: wait that
|
|
490
|
+
* long before sending again. Code `rate_limited` on a run means the account reached its limit
|
|
491
|
+
* of new requests a minute to that API; nothing was run or charged.
|
|
492
|
+
*/
|
|
489
493
|
declare class RateLimitedError extends AnyAPIError {
|
|
494
|
+
readonly retryAfterSeconds?: number;
|
|
495
|
+
constructor(message: string, status: number, requestId?: string, code?: string, retryAfterSeconds?: number);
|
|
490
496
|
}
|
|
491
497
|
/** HTTP 502. */
|
|
492
498
|
declare class UpstreamError extends AnyAPIError {
|
|
@@ -32685,7 +32691,7 @@ declare class InstagramNamespace {
|
|
|
32685
32691
|
*
|
|
32686
32692
|
* List the related profiles Instagram's website shows for a public profile, with each account's handle, display name, verified flag and avatar. This is Instagram's shorter web list: it often holds only a few accounts and can be empty even for a large profile. When it comes back empty or cannot be read, the accounts Instagram's app suggests for the profile may be returned instead. For the full list of accounts Instagram suggests as similar, use instagram.suggested_profiles.
|
|
32687
32693
|
*
|
|
32688
|
-
* Price: $0.
|
|
32694
|
+
* Price: $0.0022 per request.
|
|
32689
32695
|
*
|
|
32690
32696
|
* @example
|
|
32691
32697
|
* const res = await client.instagram.similarProfiles({ handle: "nasa" });
|
|
@@ -73427,7 +73433,7 @@ declare class TwitterNamespace {
|
|
|
73427
73433
|
*
|
|
73428
73434
|
* Search X (Twitter) with full advanced-search syntax (operators like from:, since:, until:, min_faves: work inline in the query) and get structured tweets with text, author, engagement, and cursor pagination. Limit is a per-page maximum; native pages contain approximately 20 tweets unless requireSinglePage selects a bulk lane.
|
|
73429
73435
|
*
|
|
73430
|
-
* Price: $0.
|
|
73436
|
+
* Price: $0.00047 per request.
|
|
73431
73437
|
*
|
|
73432
73438
|
* @example
|
|
73433
73439
|
* const res = await client.twitter.search({ query: "openai" });
|
package/dist/index.d.ts
CHANGED
|
@@ -485,8 +485,14 @@ declare class NotFoundError extends AnyAPIError {
|
|
|
485
485
|
*/
|
|
486
486
|
declare class ResultNotFoundError extends NotFoundError {
|
|
487
487
|
}
|
|
488
|
-
/**
|
|
488
|
+
/**
|
|
489
|
+
* HTTP 429. `retryAfterSeconds` is the response's Retry-After when it carried one: wait that
|
|
490
|
+
* long before sending again. Code `rate_limited` on a run means the account reached its limit
|
|
491
|
+
* of new requests a minute to that API; nothing was run or charged.
|
|
492
|
+
*/
|
|
489
493
|
declare class RateLimitedError extends AnyAPIError {
|
|
494
|
+
readonly retryAfterSeconds?: number;
|
|
495
|
+
constructor(message: string, status: number, requestId?: string, code?: string, retryAfterSeconds?: number);
|
|
490
496
|
}
|
|
491
497
|
/** HTTP 502. */
|
|
492
498
|
declare class UpstreamError extends AnyAPIError {
|
|
@@ -32685,7 +32691,7 @@ declare class InstagramNamespace {
|
|
|
32685
32691
|
*
|
|
32686
32692
|
* List the related profiles Instagram's website shows for a public profile, with each account's handle, display name, verified flag and avatar. This is Instagram's shorter web list: it often holds only a few accounts and can be empty even for a large profile. When it comes back empty or cannot be read, the accounts Instagram's app suggests for the profile may be returned instead. For the full list of accounts Instagram suggests as similar, use instagram.suggested_profiles.
|
|
32687
32693
|
*
|
|
32688
|
-
* Price: $0.
|
|
32694
|
+
* Price: $0.0022 per request.
|
|
32689
32695
|
*
|
|
32690
32696
|
* @example
|
|
32691
32697
|
* const res = await client.instagram.similarProfiles({ handle: "nasa" });
|
|
@@ -73427,7 +73433,7 @@ declare class TwitterNamespace {
|
|
|
73427
73433
|
*
|
|
73428
73434
|
* Search X (Twitter) with full advanced-search syntax (operators like from:, since:, until:, min_faves: work inline in the query) and get structured tweets with text, author, engagement, and cursor pagination. Limit is a per-page maximum; native pages contain approximately 20 tweets unless requireSinglePage selects a bulk lane.
|
|
73429
73435
|
*
|
|
73430
|
-
* Price: $0.
|
|
73436
|
+
* Price: $0.00047 per request.
|
|
73431
73437
|
*
|
|
73432
73438
|
* @example
|
|
73433
73439
|
* const res = await client.twitter.search({ query: "openai" });
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,13 @@ var NotFoundError = class extends AnyAPIError {
|
|
|
33
33
|
var ResultNotFoundError = class extends NotFoundError {
|
|
34
34
|
};
|
|
35
35
|
var RateLimitedError = class extends AnyAPIError {
|
|
36
|
+
retryAfterSeconds;
|
|
37
|
+
constructor(message, status, requestId, code, retryAfterSeconds) {
|
|
38
|
+
super(message, status, requestId, code);
|
|
39
|
+
if (retryAfterSeconds !== void 0) {
|
|
40
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
36
43
|
};
|
|
37
44
|
var UpstreamError = class extends AnyAPIError {
|
|
38
45
|
};
|
|
@@ -55,7 +62,7 @@ function requestIdOf(headers) {
|
|
|
55
62
|
}
|
|
56
63
|
return void 0;
|
|
57
64
|
}
|
|
58
|
-
function errorFromStatus(status, message, requestId, code) {
|
|
65
|
+
function errorFromStatus(status, message, requestId, code, retryAfterSeconds) {
|
|
59
66
|
switch (status) {
|
|
60
67
|
case 400:
|
|
61
68
|
return new BadRequestError(message, status, requestId, code);
|
|
@@ -66,7 +73,7 @@ function errorFromStatus(status, message, requestId, code) {
|
|
|
66
73
|
case 404:
|
|
67
74
|
return new NotFoundError(message, status, requestId, code);
|
|
68
75
|
case 429:
|
|
69
|
-
return new RateLimitedError(message, status, requestId, code);
|
|
76
|
+
return new RateLimitedError(message, status, requestId, code, retryAfterSeconds);
|
|
70
77
|
case 502:
|
|
71
78
|
return new UpstreamError(message, status, requestId, code);
|
|
72
79
|
default:
|
|
@@ -897,9 +904,8 @@ var AnyAPI = class {
|
|
|
897
904
|
const retryAfterMs = parseRetryAfterMs(
|
|
898
905
|
response.headers.get("retry-after")
|
|
899
906
|
);
|
|
900
|
-
if (response.status === 429 && attempt < opts.maxRetries) {
|
|
901
|
-
|
|
902
|
-
await sleep(delay, opts.signal);
|
|
907
|
+
if (response.status === 429 && attempt < opts.maxRetries && (retryAfterMs === void 0 || retryAfterMs <= RETRY_MAX_DELAY_MS)) {
|
|
908
|
+
await sleep(retryAfterMs ?? backoffDelay(attempt), opts.signal);
|
|
903
909
|
attempt += 1;
|
|
904
910
|
continue;
|
|
905
911
|
}
|
|
@@ -912,7 +918,13 @@ var AnyAPI = class {
|
|
|
912
918
|
continue;
|
|
913
919
|
}
|
|
914
920
|
}
|
|
915
|
-
throw errorFromStatus(
|
|
921
|
+
throw errorFromStatus(
|
|
922
|
+
response.status,
|
|
923
|
+
message,
|
|
924
|
+
requestId,
|
|
925
|
+
code,
|
|
926
|
+
retryAfterMs === void 0 ? void 0 : Math.ceil(retryAfterMs / 1e3)
|
|
927
|
+
);
|
|
916
928
|
}
|
|
917
929
|
}
|
|
918
930
|
/** Internal accessor for GET helpers in account.ts (same base URL / machinery). */
|
|
@@ -4679,7 +4691,7 @@ var InstagramNamespace = class {
|
|
|
4679
4691
|
*
|
|
4680
4692
|
* List the related profiles Instagram's website shows for a public profile, with each account's handle, display name, verified flag and avatar. This is Instagram's shorter web list: it often holds only a few accounts and can be empty even for a large profile. When it comes back empty or cannot be read, the accounts Instagram's app suggests for the profile may be returned instead. For the full list of accounts Instagram suggests as similar, use instagram.suggested_profiles.
|
|
4681
4693
|
*
|
|
4682
|
-
* Price: $0.
|
|
4694
|
+
* Price: $0.0022 per request.
|
|
4683
4695
|
*
|
|
4684
4696
|
* @example
|
|
4685
4697
|
* const res = await client.instagram.similarProfiles({ handle: "nasa" });
|
|
@@ -8927,7 +8939,7 @@ var TwitterNamespace = class {
|
|
|
8927
8939
|
*
|
|
8928
8940
|
* Search X (Twitter) with full advanced-search syntax (operators like from:, since:, until:, min_faves: work inline in the query) and get structured tweets with text, author, engagement, and cursor pagination. Limit is a per-page maximum; native pages contain approximately 20 tweets unless requireSinglePage selects a bulk lane.
|
|
8929
8941
|
*
|
|
8930
|
-
* Price: $0.
|
|
8942
|
+
* Price: $0.00047 per request.
|
|
8931
8943
|
*
|
|
8932
8944
|
* @example
|
|
8933
8945
|
* const res = await client.twitter.search({ query: "openai" });
|