@zernio/node 0.2.145 → 0.2.147
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/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/package.json +1 -1
- package/src/generated/sdk.gen.ts +33 -2
- package/src/generated/types.gen.ts +11 -0
package/dist/index.d.mts
CHANGED
|
@@ -6141,6 +6141,13 @@ type CreatePostData = {
|
|
|
6141
6141
|
*/
|
|
6142
6142
|
queueId?: string;
|
|
6143
6143
|
};
|
|
6144
|
+
headers?: {
|
|
6145
|
+
/**
|
|
6146
|
+
* Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
|
|
6147
|
+
*
|
|
6148
|
+
*/
|
|
6149
|
+
'x-request-id'?: string;
|
|
6150
|
+
};
|
|
6144
6151
|
};
|
|
6145
6152
|
type CreatePostResponse = (PostCreateResponse);
|
|
6146
6153
|
type CreatePostError = ({
|
|
@@ -14129,6 +14136,10 @@ type GetAdsTimelineError = ({
|
|
|
14129
14136
|
} | unknown);
|
|
14130
14137
|
type GetAdData = {
|
|
14131
14138
|
path: {
|
|
14139
|
+
/**
|
|
14140
|
+
* Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs. See description for details.
|
|
14141
|
+
*
|
|
14142
|
+
*/
|
|
14132
14143
|
adId: string;
|
|
14133
14144
|
};
|
|
14134
14145
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6141,6 +6141,13 @@ type CreatePostData = {
|
|
|
6141
6141
|
*/
|
|
6142
6142
|
queueId?: string;
|
|
6143
6143
|
};
|
|
6144
|
+
headers?: {
|
|
6145
|
+
/**
|
|
6146
|
+
* Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
|
|
6147
|
+
*
|
|
6148
|
+
*/
|
|
6149
|
+
'x-request-id'?: string;
|
|
6150
|
+
};
|
|
6144
6151
|
};
|
|
6145
6152
|
type CreatePostResponse = (PostCreateResponse);
|
|
6146
6153
|
type CreatePostError = ({
|
|
@@ -14129,6 +14136,10 @@ type GetAdsTimelineError = ({
|
|
|
14129
14136
|
} | unknown);
|
|
14130
14137
|
type GetAdData = {
|
|
14131
14138
|
path: {
|
|
14139
|
+
/**
|
|
14140
|
+
* Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs. See description for details.
|
|
14141
|
+
*
|
|
14142
|
+
*/
|
|
14132
14143
|
adId: string;
|
|
14133
14144
|
};
|
|
14134
14145
|
};
|
package/package.json
CHANGED
package/src/generated/sdk.gen.ts
CHANGED
|
@@ -510,8 +510,24 @@ export const listPosts = <ThrowOnError extends boolean = false>(options?: Option
|
|
|
510
510
|
|
|
511
511
|
/**
|
|
512
512
|
* Create post
|
|
513
|
-
* Create and optionally publish a post. Immediate posts (publishNow: true) include platformPostUrl in the response.
|
|
514
|
-
* Content is optional when media is attached or all platforms have customContent
|
|
513
|
+
* Create and optionally publish a post. Immediate posts (`publishNow: true`) include `platformPostUrl` in the response.
|
|
514
|
+
* Content is optional when media is attached or all platforms have `customContent`. See each platform's schema for media constraints.
|
|
515
|
+
*
|
|
516
|
+
* ## Idempotency
|
|
517
|
+
*
|
|
518
|
+
* Two layers of duplicate-protection apply, so safe-to-retry callers (network blips, n8n / Zapier retries, etc.) don't accidentally double-post.
|
|
519
|
+
*
|
|
520
|
+
* **1. Same-request idempotency (5-minute window).**
|
|
521
|
+
* Pass an `x-request-id` header to mark a logical request. If a second request arrives with the same `x-request-id` while the first is in-flight (or within ~5 minutes of completion), we return **HTTP 200** with the original post in the `existingPost` field — no new post is created. The official Zernio SDKs auto-generate a unique `x-request-id` per call. If you're using a generic HTTP client (curl, n8n's HTTP node, Zapier, custom code), either:
|
|
522
|
+
* - Set a unique `x-request-id` per logical call (recommended — UUIDv4 is fine)
|
|
523
|
+
* - Or simply omit the header — we'll treat each request as new
|
|
524
|
+
*
|
|
525
|
+
* **Common pitfall**: if your workflow tool uses a single execution-level request ID and reuses it across multiple HTTP nodes (e.g. one ID for the whole run, shared across 6 different platform calls), every call after the first will look like a retry of the first and return its post. Generate a fresh ID per node.
|
|
526
|
+
*
|
|
527
|
+
* **2. Content-hash dedup (24-hour window).**
|
|
528
|
+
* Independently, we hash `(platform, accountId, content + media URLs)` and reject duplicates within 24 hours with **HTTP 409**. This catches genuine "same content posted twice to the same account" cases regardless of `x-request-id`. Returns `error`, `accountId`, `platform`, and `existingPostId` so you can find the original. To intentionally re-post identical content within 24h, change something (the caption, the media, the account) — the dedup is keyed on the full content fingerprint.
|
|
529
|
+
*
|
|
530
|
+
* Order: same-`x-request-id` retries (200) are checked first; if no idempotency match, the content-hash dedup (409) runs.
|
|
515
531
|
*
|
|
516
532
|
*/
|
|
517
533
|
export const createPost = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<CreatePostData, ThrowOnError>) => {
|
|
@@ -3493,6 +3509,15 @@ export const getAdsTimeline = <ThrowOnError extends boolean = false>(options: Op
|
|
|
3493
3509
|
/**
|
|
3494
3510
|
* Get ad details
|
|
3495
3511
|
* Returns an ad with its creative, targeting, status, and performance metrics.
|
|
3512
|
+
*
|
|
3513
|
+
* The `{adId}` path segment accepts any identifier dialect Zernio indexes for the ad:
|
|
3514
|
+
* - the Zernio internal `_id` (24-char hex)
|
|
3515
|
+
* - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`)
|
|
3516
|
+
* - the creative's `effective_object_story_id` (`{pageId}_{postId}` shape, Facebook side)
|
|
3517
|
+
* - the creative's `effective_instagram_media_id` (Instagram side)
|
|
3518
|
+
*
|
|
3519
|
+
* Any of the four resolve to the same ad. Caller doesn't need a translation step.
|
|
3520
|
+
*
|
|
3496
3521
|
*/
|
|
3497
3522
|
export const getAd = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetAdData, ThrowOnError>) => {
|
|
3498
3523
|
return (options?.client ?? client).get<GetAdResponse, GetAdError, ThrowOnError>({
|
|
@@ -3570,6 +3595,12 @@ export const getAdAnalytics = <ThrowOnError extends boolean = false>(options: Op
|
|
|
3570
3595
|
*
|
|
3571
3596
|
* Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/{postId}.
|
|
3572
3597
|
*
|
|
3598
|
+
* The `{adId}` path segment accepts any identifier dialect Zernio indexes for the ad:
|
|
3599
|
+
* Zernio internal `_id` (24-char hex), Meta's numeric `platformAdId` (the value shipped in
|
|
3600
|
+
* `comment.received` webhooks as `comment.ad.id`), or the creative's
|
|
3601
|
+
* `effective_object_story_id` / `effective_instagram_media_id`. Caller doesn't need a
|
|
3602
|
+
* translation step.
|
|
3603
|
+
*
|
|
3573
3604
|
*/
|
|
3574
3605
|
export const getAdComments = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetAdCommentsData, ThrowOnError>) => {
|
|
3575
3606
|
return (options?.client ?? client).get<GetAdCommentsResponse, GetAdCommentsError, ThrowOnError>({
|
|
@@ -5797,6 +5797,13 @@ export type CreatePostData = {
|
|
|
5797
5797
|
*/
|
|
5798
5798
|
queueId?: string;
|
|
5799
5799
|
};
|
|
5800
|
+
headers?: {
|
|
5801
|
+
/**
|
|
5802
|
+
* Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
|
|
5803
|
+
*
|
|
5804
|
+
*/
|
|
5805
|
+
'x-request-id'?: string;
|
|
5806
|
+
};
|
|
5800
5807
|
};
|
|
5801
5808
|
|
|
5802
5809
|
export type CreatePostResponse = (PostCreateResponse);
|
|
@@ -14457,6 +14464,10 @@ export type GetAdsTimelineError = ({
|
|
|
14457
14464
|
|
|
14458
14465
|
export type GetAdData = {
|
|
14459
14466
|
path: {
|
|
14467
|
+
/**
|
|
14468
|
+
* Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs. See description for details.
|
|
14469
|
+
*
|
|
14470
|
+
*/
|
|
14460
14471
|
adId: string;
|
|
14461
14472
|
};
|
|
14462
14473
|
};
|