@getlatedev/node 0.2.1207 → 0.2.1209
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 +3 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
- package/src/client.ts +13 -5
- package/src/generated/types.gen.ts +27 -3
package/README.md
CHANGED
|
@@ -52,10 +52,12 @@ console.log(`Published to ${post.platforms.length} platforms!`);
|
|
|
52
52
|
const zernio = new Zernio({
|
|
53
53
|
apiKey: 'your-api-key', // Defaults to process.env['ZERNIO_API_KEY']
|
|
54
54
|
baseURL: 'https://zernio.com/api',
|
|
55
|
-
timeout:
|
|
55
|
+
timeout: 300000,
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
A per-call `signal` overrides `timeout`, and a timed-out call rejects with a `TimeoutError`.
|
|
60
|
+
|
|
59
61
|
## Examples
|
|
60
62
|
|
|
61
63
|
### Schedule a Post
|
package/dist/index.d.mts
CHANGED
|
@@ -11,8 +11,8 @@ interface ClientOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
baseURL?: string | null | undefined;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @default
|
|
14
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
15
|
+
* @default 300000
|
|
16
16
|
*/
|
|
17
17
|
timeout?: number;
|
|
18
18
|
/**
|
|
@@ -46,7 +46,7 @@ interface ClientOptions {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
declare class Zernio {
|
|
49
|
-
private
|
|
49
|
+
private _timeout;
|
|
50
50
|
/**
|
|
51
51
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
52
52
|
* to it, so two Zernio instances in the same process never see each other's
|
|
@@ -71,7 +71,7 @@ declare class Zernio {
|
|
|
71
71
|
* Routes a generated operation through this instance's client, preserving the
|
|
72
72
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
73
73
|
* when it is bound, because class fields initialize before the constructor
|
|
74
|
-
* body runs.
|
|
74
|
+
* body runs. Each call gets its own timeout signal.
|
|
75
75
|
*/
|
|
76
76
|
private _bind;
|
|
77
77
|
/**
|
|
@@ -9451,7 +9451,7 @@ type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
9451
9451
|
*/
|
|
9452
9452
|
type timeframe = 'this_week' | 'this_month';
|
|
9453
9453
|
/**
|
|
9454
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
9454
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
9455
9455
|
*/
|
|
9456
9456
|
type InstagramPlatformData = {
|
|
9457
9457
|
/**
|
|
@@ -21810,7 +21810,7 @@ type GetConnectUrlData = {
|
|
|
21810
21810
|
};
|
|
21811
21811
|
query: {
|
|
21812
21812
|
/**
|
|
21813
|
-
*
|
|
21813
|
+
* Your product name, for the two branded pages. With `signup=hosted` (WhatsApp) it replaces Zernio in the page title ("Connect your WhatsApp number to <brandName>"). With `welcome=true` it fills the heading ("<brandName> wants to connect to your <platform>"); without it the screen shows Zernio and the Zernio mark. Both pages keep a Zernio mark: they are co-branded, not white-label. Trimmed; 1 to 60 characters. Rejected with 400 `INVALID_FIELD_VALUE` without `signup=hosted` or `welcome=true`. Sealed into the page link at issue time, so editing the URL cannot change it.
|
|
21814
21814
|
*/
|
|
21815
21815
|
brandName?: string;
|
|
21816
21816
|
/**
|
|
@@ -21844,6 +21844,10 @@ type GetConnectUrlData = {
|
|
|
21844
21844
|
*
|
|
21845
21845
|
*/
|
|
21846
21846
|
loginMethod?: 'instagram_login' | 'facebook_login';
|
|
21847
|
+
/**
|
|
21848
|
+
* Welcome screen only (`welcome=true`): https URL of your logo, shown in a square tile, so use a square image. Without it the tile shows the first letter of `brandName`, or the Zernio mark when there is no `brandName` either. Rejected with 400 `INVALID_FIELD_VALUE` without `welcome=true`.
|
|
21849
|
+
*/
|
|
21850
|
+
logoUrl?: string;
|
|
21847
21851
|
/**
|
|
21848
21852
|
* WhatsApp only. Ignored for every other platform. Controls which screen Meta's Embedded Signup popup shows.
|
|
21849
21853
|
*
|
|
@@ -21856,7 +21860,7 @@ type GetConnectUrlData = {
|
|
|
21856
21860
|
*/
|
|
21857
21861
|
onboarding?: 'api' | 'business_app';
|
|
21858
21862
|
/**
|
|
21859
|
-
*
|
|
21863
|
+
* Hex colour (`#RRGGBB`) for the primary button on the hosted WhatsApp signup page (`signup=hosted`) or the welcome screen (`welcome=true`). Validated server-side; anything else is a 400 `INVALID_FIELD_VALUE`. Rejected without one of the two.
|
|
21860
21864
|
*/
|
|
21861
21865
|
primaryColor?: string;
|
|
21862
21866
|
/**
|
|
@@ -22041,6 +22045,14 @@ type GetConnectUrlData = {
|
|
|
22041
22045
|
*
|
|
22042
22046
|
*/
|
|
22043
22047
|
signup?: 'hosted';
|
|
22048
|
+
/**
|
|
22049
|
+
* Any platform. When `true`, `authUrl` points to a Zernio-hosted welcome screen that shows your brand next to the platform ("<brandName> wants to connect to your <platform>") with a Continue button; Continue sends the user to the platform's own authorization screen and the rest of the flow is unchanged. `brandName`, `logoUrl`, `primaryColor` and `welcomeTheme` are optional and default to Zernio's own name, mark and look. The link is valid for 30 minutes, after which the page asks the user to start again. The brand also carries to the account and channel pickers Zernio shows after authorization, and when you pass no `redirect_url` the flow ends on a branded Zernio-hosted page saying whether the account connected, instead of the Zernio dashboard. Cannot be combined with `headless=true` or `signup=hosted` (400 `INVALID_FIELD_VALUE`). The platform's authorization screen still names the Zernio app.
|
|
22050
|
+
*/
|
|
22051
|
+
welcome?: boolean;
|
|
22052
|
+
/**
|
|
22053
|
+
* Welcome screen only (`welcome=true`): a URL-encoded JSON object that restyles and rewords the screen. All keys are optional. Copy: `heading` (up to 120 characters), `trustLine` and `consentLine` (up to 200 each), `buttonLabel` (up to 30); each may contain the placeholders `{brand}` and `{platform}`. Style: `primaryColor`, `pageColor`, `cardColor` and `textColor` as `#RRGGBB`, `cornerRadius` as an integer from 0 to 24 (pixels), `font` as `sans`, `serif` or `mono`. A `primaryColor` here wins over the `primaryColor` parameter. Unknown keys, invalid JSON or an invalid value are a 400 `INVALID_FIELD_VALUE`. Rejected without `welcome=true`. Example: `{"heading":"Link your {platform} to {brand}","cardColor":"#FFF7ED","cornerRadius":12}`.
|
|
22054
|
+
*/
|
|
22055
|
+
welcomeTheme?: string;
|
|
22044
22056
|
};
|
|
22045
22057
|
};
|
|
22046
22058
|
type GetConnectUrlResponse = ({
|
|
@@ -27913,6 +27925,10 @@ type ListLogsData = {
|
|
|
27913
27925
|
* Filter by platform
|
|
27914
27926
|
*/
|
|
27915
27927
|
platform?: 'tiktok' | 'instagram' | 'whatsapp' | 'facebook' | 'youtube' | 'linkedin' | 'twitter' | 'threads' | 'pinterest' | 'reddit' | 'bluesky' | 'googlebusiness' | 'telegram' | 'snapchat' | 'all';
|
|
27928
|
+
/**
|
|
27929
|
+
* Filter by profile: every log type carries the profile it belongs to, and an API request log carries the profileId the call named
|
|
27930
|
+
*/
|
|
27931
|
+
profileId?: string;
|
|
27916
27932
|
/**
|
|
27917
27933
|
* Correlation ID. Returns every log spawned by a single API request
|
|
27918
27934
|
*/
|
|
@@ -27958,6 +27974,14 @@ type ListLogsResponse = ({
|
|
|
27958
27974
|
user_id?: string;
|
|
27959
27975
|
platform?: string;
|
|
27960
27976
|
account_id?: string;
|
|
27977
|
+
/**
|
|
27978
|
+
* The profile the entry belongs to; on API request logs, the profileId the call named in its query or body
|
|
27979
|
+
*/
|
|
27980
|
+
profile_id?: string;
|
|
27981
|
+
/**
|
|
27982
|
+
* API request logs only: the operationId of the public operation the request hit (e.g. createPost), absent for routes outside this spec
|
|
27983
|
+
*/
|
|
27984
|
+
operation_id?: string;
|
|
27961
27985
|
status?: 'success' | 'failed' | 'pending' | 'skipped';
|
|
27962
27986
|
status_code?: number;
|
|
27963
27987
|
error_message?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ interface ClientOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
baseURL?: string | null | undefined;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @default
|
|
14
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
15
|
+
* @default 300000
|
|
16
16
|
*/
|
|
17
17
|
timeout?: number;
|
|
18
18
|
/**
|
|
@@ -46,7 +46,7 @@ interface ClientOptions {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
declare class Zernio {
|
|
49
|
-
private
|
|
49
|
+
private _timeout;
|
|
50
50
|
/**
|
|
51
51
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
52
52
|
* to it, so two Zernio instances in the same process never see each other's
|
|
@@ -71,7 +71,7 @@ declare class Zernio {
|
|
|
71
71
|
* Routes a generated operation through this instance's client, preserving the
|
|
72
72
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
73
73
|
* when it is bound, because class fields initialize before the constructor
|
|
74
|
-
* body runs.
|
|
74
|
+
* body runs. Each call gets its own timeout signal.
|
|
75
75
|
*/
|
|
76
76
|
private _bind;
|
|
77
77
|
/**
|
|
@@ -9451,7 +9451,7 @@ type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
9451
9451
|
*/
|
|
9452
9452
|
type timeframe = 'this_week' | 'this_month';
|
|
9453
9453
|
/**
|
|
9454
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
9454
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
9455
9455
|
*/
|
|
9456
9456
|
type InstagramPlatformData = {
|
|
9457
9457
|
/**
|
|
@@ -21810,7 +21810,7 @@ type GetConnectUrlData = {
|
|
|
21810
21810
|
};
|
|
21811
21811
|
query: {
|
|
21812
21812
|
/**
|
|
21813
|
-
*
|
|
21813
|
+
* Your product name, for the two branded pages. With `signup=hosted` (WhatsApp) it replaces Zernio in the page title ("Connect your WhatsApp number to <brandName>"). With `welcome=true` it fills the heading ("<brandName> wants to connect to your <platform>"); without it the screen shows Zernio and the Zernio mark. Both pages keep a Zernio mark: they are co-branded, not white-label. Trimmed; 1 to 60 characters. Rejected with 400 `INVALID_FIELD_VALUE` without `signup=hosted` or `welcome=true`. Sealed into the page link at issue time, so editing the URL cannot change it.
|
|
21814
21814
|
*/
|
|
21815
21815
|
brandName?: string;
|
|
21816
21816
|
/**
|
|
@@ -21844,6 +21844,10 @@ type GetConnectUrlData = {
|
|
|
21844
21844
|
*
|
|
21845
21845
|
*/
|
|
21846
21846
|
loginMethod?: 'instagram_login' | 'facebook_login';
|
|
21847
|
+
/**
|
|
21848
|
+
* Welcome screen only (`welcome=true`): https URL of your logo, shown in a square tile, so use a square image. Without it the tile shows the first letter of `brandName`, or the Zernio mark when there is no `brandName` either. Rejected with 400 `INVALID_FIELD_VALUE` without `welcome=true`.
|
|
21849
|
+
*/
|
|
21850
|
+
logoUrl?: string;
|
|
21847
21851
|
/**
|
|
21848
21852
|
* WhatsApp only. Ignored for every other platform. Controls which screen Meta's Embedded Signup popup shows.
|
|
21849
21853
|
*
|
|
@@ -21856,7 +21860,7 @@ type GetConnectUrlData = {
|
|
|
21856
21860
|
*/
|
|
21857
21861
|
onboarding?: 'api' | 'business_app';
|
|
21858
21862
|
/**
|
|
21859
|
-
*
|
|
21863
|
+
* Hex colour (`#RRGGBB`) for the primary button on the hosted WhatsApp signup page (`signup=hosted`) or the welcome screen (`welcome=true`). Validated server-side; anything else is a 400 `INVALID_FIELD_VALUE`. Rejected without one of the two.
|
|
21860
21864
|
*/
|
|
21861
21865
|
primaryColor?: string;
|
|
21862
21866
|
/**
|
|
@@ -22041,6 +22045,14 @@ type GetConnectUrlData = {
|
|
|
22041
22045
|
*
|
|
22042
22046
|
*/
|
|
22043
22047
|
signup?: 'hosted';
|
|
22048
|
+
/**
|
|
22049
|
+
* Any platform. When `true`, `authUrl` points to a Zernio-hosted welcome screen that shows your brand next to the platform ("<brandName> wants to connect to your <platform>") with a Continue button; Continue sends the user to the platform's own authorization screen and the rest of the flow is unchanged. `brandName`, `logoUrl`, `primaryColor` and `welcomeTheme` are optional and default to Zernio's own name, mark and look. The link is valid for 30 minutes, after which the page asks the user to start again. The brand also carries to the account and channel pickers Zernio shows after authorization, and when you pass no `redirect_url` the flow ends on a branded Zernio-hosted page saying whether the account connected, instead of the Zernio dashboard. Cannot be combined with `headless=true` or `signup=hosted` (400 `INVALID_FIELD_VALUE`). The platform's authorization screen still names the Zernio app.
|
|
22050
|
+
*/
|
|
22051
|
+
welcome?: boolean;
|
|
22052
|
+
/**
|
|
22053
|
+
* Welcome screen only (`welcome=true`): a URL-encoded JSON object that restyles and rewords the screen. All keys are optional. Copy: `heading` (up to 120 characters), `trustLine` and `consentLine` (up to 200 each), `buttonLabel` (up to 30); each may contain the placeholders `{brand}` and `{platform}`. Style: `primaryColor`, `pageColor`, `cardColor` and `textColor` as `#RRGGBB`, `cornerRadius` as an integer from 0 to 24 (pixels), `font` as `sans`, `serif` or `mono`. A `primaryColor` here wins over the `primaryColor` parameter. Unknown keys, invalid JSON or an invalid value are a 400 `INVALID_FIELD_VALUE`. Rejected without `welcome=true`. Example: `{"heading":"Link your {platform} to {brand}","cardColor":"#FFF7ED","cornerRadius":12}`.
|
|
22054
|
+
*/
|
|
22055
|
+
welcomeTheme?: string;
|
|
22044
22056
|
};
|
|
22045
22057
|
};
|
|
22046
22058
|
type GetConnectUrlResponse = ({
|
|
@@ -27913,6 +27925,10 @@ type ListLogsData = {
|
|
|
27913
27925
|
* Filter by platform
|
|
27914
27926
|
*/
|
|
27915
27927
|
platform?: 'tiktok' | 'instagram' | 'whatsapp' | 'facebook' | 'youtube' | 'linkedin' | 'twitter' | 'threads' | 'pinterest' | 'reddit' | 'bluesky' | 'googlebusiness' | 'telegram' | 'snapchat' | 'all';
|
|
27928
|
+
/**
|
|
27929
|
+
* Filter by profile: every log type carries the profile it belongs to, and an API request log carries the profileId the call named
|
|
27930
|
+
*/
|
|
27931
|
+
profileId?: string;
|
|
27916
27932
|
/**
|
|
27917
27933
|
* Correlation ID. Returns every log spawned by a single API request
|
|
27918
27934
|
*/
|
|
@@ -27958,6 +27974,14 @@ type ListLogsResponse = ({
|
|
|
27958
27974
|
user_id?: string;
|
|
27959
27975
|
platform?: string;
|
|
27960
27976
|
account_id?: string;
|
|
27977
|
+
/**
|
|
27978
|
+
* The profile the entry belongs to; on API request logs, the profileId the call named in its query or body
|
|
27979
|
+
*/
|
|
27980
|
+
profile_id?: string;
|
|
27981
|
+
/**
|
|
27982
|
+
* API request logs only: the operationId of the public operation the request hit (e.g. createPost), absent for routes outside this spec
|
|
27983
|
+
*/
|
|
27984
|
+
operation_id?: string;
|
|
27961
27985
|
status?: 'success' | 'failed' | 'pending' | 'skipped';
|
|
27962
27986
|
status_code?: number;
|
|
27963
27987
|
error_message?: string;
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
// package.json
|
|
37
37
|
var package_default = {
|
|
38
38
|
name: "@getlatedev/node",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.1209",
|
|
40
40
|
description: "The official Node.js library for the Zernio API",
|
|
41
41
|
main: "dist/index.js",
|
|
42
42
|
module: "dist/index.mjs",
|
|
@@ -8128,7 +8128,8 @@ var Zernio = class _Zernio {
|
|
|
8128
8128
|
}
|
|
8129
8129
|
this.apiKey = apiKey;
|
|
8130
8130
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8131
|
-
|
|
8131
|
+
const timeout = options.timeout ?? 3e5;
|
|
8132
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8132
8133
|
this._client = M(
|
|
8133
8134
|
q({
|
|
8134
8135
|
baseUrl: this.baseURL,
|
|
@@ -8159,7 +8160,7 @@ var Zernio = class _Zernio {
|
|
|
8159
8160
|
* Routes a generated operation through this instance's client, preserving the
|
|
8160
8161
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8161
8162
|
* when it is bound, because class fields initialize before the constructor
|
|
8162
|
-
* body runs.
|
|
8163
|
+
* body runs. Each call gets its own timeout signal.
|
|
8163
8164
|
*/
|
|
8164
8165
|
_bind(operation) {
|
|
8165
8166
|
return ((options) => {
|
|
@@ -8167,6 +8168,9 @@ var Zernio = class _Zernio {
|
|
|
8167
8168
|
if (withClient["client"] === void 0) {
|
|
8168
8169
|
withClient["client"] = this._dispatchClient;
|
|
8169
8170
|
}
|
|
8171
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8172
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8173
|
+
}
|
|
8170
8174
|
return operation(withClient);
|
|
8171
8175
|
});
|
|
8172
8176
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@getlatedev/node",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1209",
|
|
9
9
|
description: "The official Node.js library for the Zernio API",
|
|
10
10
|
main: "dist/index.js",
|
|
11
11
|
module: "dist/index.mjs",
|
|
@@ -8097,7 +8097,8 @@ var Zernio = class _Zernio {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
this.apiKey = apiKey;
|
|
8099
8099
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8100
|
-
|
|
8100
|
+
const timeout = options.timeout ?? 3e5;
|
|
8101
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8101
8102
|
this._client = M(
|
|
8102
8103
|
q({
|
|
8103
8104
|
baseUrl: this.baseURL,
|
|
@@ -8128,7 +8129,7 @@ var Zernio = class _Zernio {
|
|
|
8128
8129
|
* Routes a generated operation through this instance's client, preserving the
|
|
8129
8130
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8130
8131
|
* when it is bound, because class fields initialize before the constructor
|
|
8131
|
-
* body runs.
|
|
8132
|
+
* body runs. Each call gets its own timeout signal.
|
|
8132
8133
|
*/
|
|
8133
8134
|
_bind(operation) {
|
|
8134
8135
|
return ((options) => {
|
|
@@ -8136,6 +8137,9 @@ var Zernio = class _Zernio {
|
|
|
8136
8137
|
if (withClient["client"] === void 0) {
|
|
8137
8138
|
withClient["client"] = this._dispatchClient;
|
|
8138
8139
|
}
|
|
8140
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8141
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8142
|
+
}
|
|
8139
8143
|
return operation(withClient);
|
|
8140
8144
|
});
|
|
8141
8145
|
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -983,8 +983,8 @@ export interface ClientOptions {
|
|
|
983
983
|
baseURL?: string | null | undefined;
|
|
984
984
|
|
|
985
985
|
/**
|
|
986
|
-
*
|
|
987
|
-
* @default
|
|
986
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
987
|
+
* @default 300000
|
|
988
988
|
*/
|
|
989
989
|
timeout?: number;
|
|
990
990
|
|
|
@@ -1019,7 +1019,7 @@ export interface ClientOptions {
|
|
|
1019
1019
|
* ```
|
|
1020
1020
|
*/
|
|
1021
1021
|
export class Zernio {
|
|
1022
|
-
private
|
|
1022
|
+
private _timeout: number | undefined;
|
|
1023
1023
|
|
|
1024
1024
|
/**
|
|
1025
1025
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
@@ -1049,7 +1049,7 @@ export class Zernio {
|
|
|
1049
1049
|
* Routes a generated operation through this instance's client, preserving the
|
|
1050
1050
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
1051
1051
|
* when it is bound, because class fields initialize before the constructor
|
|
1052
|
-
* body runs.
|
|
1052
|
+
* body runs. Each call gets its own timeout signal.
|
|
1053
1053
|
*/
|
|
1054
1054
|
private _bind<F>(operation: F): F {
|
|
1055
1055
|
return ((options?: Record<string, unknown>) => {
|
|
@@ -1057,6 +1057,10 @@ export class Zernio {
|
|
|
1057
1057
|
if (withClient['client'] === undefined) {
|
|
1058
1058
|
withClient['client'] = this._dispatchClient;
|
|
1059
1059
|
}
|
|
1060
|
+
// A caller signal replaces the timeout instead of joining it: AbortSignal.any needs Node 18.17 and engines allows 18.0.
|
|
1061
|
+
if (withClient['signal'] === undefined && this._timeout !== undefined) {
|
|
1062
|
+
withClient['signal'] = AbortSignal.timeout(this._timeout);
|
|
1063
|
+
}
|
|
1060
1064
|
return (operation as (opts: unknown) => unknown)(withClient);
|
|
1061
1065
|
}) as F;
|
|
1062
1066
|
}
|
|
@@ -3016,7 +3020,11 @@ export class Zernio {
|
|
|
3016
3020
|
|
|
3017
3021
|
this.apiKey = apiKey;
|
|
3018
3022
|
this.baseURL = options.baseURL ?? 'https://zernio.com/api';
|
|
3019
|
-
|
|
3023
|
+
// AbortSignal.timeout throws a RangeError outside uint32 integers, and `timeout` was
|
|
3024
|
+
// ignored by every earlier release, so no value an integrator already passes may start throwing.
|
|
3025
|
+
const timeout = options.timeout ?? 300000;
|
|
3026
|
+
this._timeout =
|
|
3027
|
+
timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : undefined;
|
|
3020
3028
|
|
|
3021
3029
|
// One client per instance. Interceptors used to be registered on the
|
|
3022
3030
|
// module-global client, so every `new Zernio()` stacked another auth
|
|
@@ -7762,7 +7762,7 @@ export type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
7762
7762
|
export type timeframe = 'this_week' | 'this_month';
|
|
7763
7763
|
|
|
7764
7764
|
/**
|
|
7765
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
7765
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
7766
7766
|
*/
|
|
7767
7767
|
export type InstagramPlatformData = {
|
|
7768
7768
|
/**
|
|
@@ -20760,7 +20760,7 @@ export type GetConnectUrlData = {
|
|
|
20760
20760
|
};
|
|
20761
20761
|
query: {
|
|
20762
20762
|
/**
|
|
20763
|
-
*
|
|
20763
|
+
* Your product name, for the two branded pages. With `signup=hosted` (WhatsApp) it replaces Zernio in the page title ("Connect your WhatsApp number to <brandName>"). With `welcome=true` it fills the heading ("<brandName> wants to connect to your <platform>"); without it the screen shows Zernio and the Zernio mark. Both pages keep a Zernio mark: they are co-branded, not white-label. Trimmed; 1 to 60 characters. Rejected with 400 `INVALID_FIELD_VALUE` without `signup=hosted` or `welcome=true`. Sealed into the page link at issue time, so editing the URL cannot change it.
|
|
20764
20764
|
*/
|
|
20765
20765
|
brandName?: string;
|
|
20766
20766
|
/**
|
|
@@ -20794,6 +20794,10 @@ export type GetConnectUrlData = {
|
|
|
20794
20794
|
*
|
|
20795
20795
|
*/
|
|
20796
20796
|
loginMethod?: 'instagram_login' | 'facebook_login';
|
|
20797
|
+
/**
|
|
20798
|
+
* Welcome screen only (`welcome=true`): https URL of your logo, shown in a square tile, so use a square image. Without it the tile shows the first letter of `brandName`, or the Zernio mark when there is no `brandName` either. Rejected with 400 `INVALID_FIELD_VALUE` without `welcome=true`.
|
|
20799
|
+
*/
|
|
20800
|
+
logoUrl?: string;
|
|
20797
20801
|
/**
|
|
20798
20802
|
* WhatsApp only. Ignored for every other platform. Controls which screen Meta's Embedded Signup popup shows.
|
|
20799
20803
|
*
|
|
@@ -20806,7 +20810,7 @@ export type GetConnectUrlData = {
|
|
|
20806
20810
|
*/
|
|
20807
20811
|
onboarding?: 'api' | 'business_app';
|
|
20808
20812
|
/**
|
|
20809
|
-
*
|
|
20813
|
+
* Hex colour (`#RRGGBB`) for the primary button on the hosted WhatsApp signup page (`signup=hosted`) or the welcome screen (`welcome=true`). Validated server-side; anything else is a 400 `INVALID_FIELD_VALUE`. Rejected without one of the two.
|
|
20810
20814
|
*/
|
|
20811
20815
|
primaryColor?: string;
|
|
20812
20816
|
/**
|
|
@@ -20991,6 +20995,14 @@ export type GetConnectUrlData = {
|
|
|
20991
20995
|
*
|
|
20992
20996
|
*/
|
|
20993
20997
|
signup?: 'hosted';
|
|
20998
|
+
/**
|
|
20999
|
+
* Any platform. When `true`, `authUrl` points to a Zernio-hosted welcome screen that shows your brand next to the platform ("<brandName> wants to connect to your <platform>") with a Continue button; Continue sends the user to the platform's own authorization screen and the rest of the flow is unchanged. `brandName`, `logoUrl`, `primaryColor` and `welcomeTheme` are optional and default to Zernio's own name, mark and look. The link is valid for 30 minutes, after which the page asks the user to start again. The brand also carries to the account and channel pickers Zernio shows after authorization, and when you pass no `redirect_url` the flow ends on a branded Zernio-hosted page saying whether the account connected, instead of the Zernio dashboard. Cannot be combined with `headless=true` or `signup=hosted` (400 `INVALID_FIELD_VALUE`). The platform's authorization screen still names the Zernio app.
|
|
21000
|
+
*/
|
|
21001
|
+
welcome?: boolean;
|
|
21002
|
+
/**
|
|
21003
|
+
* Welcome screen only (`welcome=true`): a URL-encoded JSON object that restyles and rewords the screen. All keys are optional. Copy: `heading` (up to 120 characters), `trustLine` and `consentLine` (up to 200 each), `buttonLabel` (up to 30); each may contain the placeholders `{brand}` and `{platform}`. Style: `primaryColor`, `pageColor`, `cardColor` and `textColor` as `#RRGGBB`, `cornerRadius` as an integer from 0 to 24 (pixels), `font` as `sans`, `serif` or `mono`. A `primaryColor` here wins over the `primaryColor` parameter. Unknown keys, invalid JSON or an invalid value are a 400 `INVALID_FIELD_VALUE`. Rejected without `welcome=true`. Example: `{"heading":"Link your {platform} to {brand}","cardColor":"#FFF7ED","cornerRadius":12}`.
|
|
21004
|
+
*/
|
|
21005
|
+
welcomeTheme?: string;
|
|
20994
21006
|
};
|
|
20995
21007
|
};
|
|
20996
21008
|
|
|
@@ -27277,6 +27289,10 @@ export type ListLogsData = {
|
|
|
27277
27289
|
* Filter by platform
|
|
27278
27290
|
*/
|
|
27279
27291
|
platform?: 'tiktok' | 'instagram' | 'whatsapp' | 'facebook' | 'youtube' | 'linkedin' | 'twitter' | 'threads' | 'pinterest' | 'reddit' | 'bluesky' | 'googlebusiness' | 'telegram' | 'snapchat' | 'all';
|
|
27292
|
+
/**
|
|
27293
|
+
* Filter by profile: every log type carries the profile it belongs to, and an API request log carries the profileId the call named
|
|
27294
|
+
*/
|
|
27295
|
+
profileId?: string;
|
|
27280
27296
|
/**
|
|
27281
27297
|
* Correlation ID. Returns every log spawned by a single API request
|
|
27282
27298
|
*/
|
|
@@ -27323,6 +27339,14 @@ export type ListLogsResponse = ({
|
|
|
27323
27339
|
user_id?: string;
|
|
27324
27340
|
platform?: string;
|
|
27325
27341
|
account_id?: string;
|
|
27342
|
+
/**
|
|
27343
|
+
* The profile the entry belongs to; on API request logs, the profileId the call named in its query or body
|
|
27344
|
+
*/
|
|
27345
|
+
profile_id?: string;
|
|
27346
|
+
/**
|
|
27347
|
+
* API request logs only: the operationId of the public operation the request hit (e.g. createPost), absent for routes outside this spec
|
|
27348
|
+
*/
|
|
27349
|
+
operation_id?: string;
|
|
27326
27350
|
status?: 'success' | 'failed' | 'pending' | 'skipped';
|
|
27327
27351
|
status_code?: number;
|
|
27328
27352
|
error_message?: string;
|