@zernio/node 0.2.990 → 0.2.992

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.
@@ -9226,6 +9226,18 @@ export const removeAdKeyword = <ThrowOnError extends boolean = false>(options: O
9226
9226
  * Google campaign budgets include amountMicros, explicitlyShared, resourceName and
9227
9227
  * deliveryMethod after the next successful sync. This endpoint does not fetch Google live.
9228
9228
  *
9229
+ * **Status freshness.** `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus`
9230
+ * and `platformCampaignStatus` are the values Zernio last stored. Background sync refreshes
9231
+ * them, typically within 15 to 60 minutes (Google up to about 3 hours), and ended or
9232
+ * long-paused objects may be refreshed less often. Zernio's own status writes re-read the
9233
+ * switches they change. A change made in the platform's own ads manager therefore shows up
9234
+ * here only after the next sync. Controllers that act on a switch should pass `live=true`,
9235
+ * which reads the switches from the platform now, stores them, and returns `statusReadAt`
9236
+ * (null when the read failed and the stored values were returned).
9237
+ * With `live=true` (which needs `limit` of 20 or less) each returned campaign's own switch
9238
+ * (`platformCampaignStatus`) is read live. Live reads cover TikTok, Meta, Google and OpenAI.
9239
+ * The rolled-up `status` is not re-derived by a live read.
9240
+ *
9229
9241
  */
9230
9242
  export const listAdCampaigns = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<ListAdCampaignsData, ThrowOnError>) => {
9231
9243
  return (options?.client ?? client).get<ListAdCampaignsResponse, ListAdCampaignsError, ThrowOnError>({
@@ -9262,12 +9274,26 @@ export const createAdCampaign = <ThrowOnError extends boolean = false>(options:
9262
9274
  /**
9263
9275
  * Pause or resume a campaign
9264
9276
  * Writes the campaign's own on/off switch, then lets the platform cascade delivery to its ad sets and ads.
9265
- * Makes one platform API call, not one per ad.
9277
+ *
9278
+ * **What the write touches (current semantics, per platform).** TikTok: the campaign, every
9279
+ * ad group and every ad under it that is not in a terminal status (rejected, completed,
9280
+ * cancelled), on pause and on resume alike, so a resume also switches those ad groups and ads
9281
+ * on. LinkedIn: the campaign group plus the campaigns and creatives of its non-terminal ads.
9282
+ * Google: `paused` writes the campaign alone; `active` also switches on the ad groups and ads
9283
+ * Zernio tracks under it (see below). Pinterest: the campaign plus one tracked ad and its ad
9284
+ * group. X: the campaign plus one tracked line item. Meta and ChatGPT (OpenAI): the campaign
9285
+ * switch only.
9286
+ *
9287
+ * **Counts and readback.** Before the write, each ad's own switch is read live from the
9288
+ * platform (up to 20 ads; beyond that the stored switch is used), and `updated` / `skipped`
9289
+ * are computed against that live state. After the write each ad's own switch and delivery
9290
+ * status are read again and stored, and the campaign switch is re-read and stored, so an
9291
+ * immediate GET returns what the platform now reports.
9266
9292
  *
9267
9293
  * The switch is always written, whatever delivery status the ads underneath report: an ad still in review
9268
9294
  * does not block resuming its campaign. The echoed `status` is the confirmation that it landed.
9269
9295
  *
9270
- * `updated` / `skipped` describe only the ads whose own stored status CHANGED alongside it, so
9296
+ * `updated` / `skipped` describe only the ads whose own status changed alongside it, so
9271
9297
  * `updated: 0` is a normal successful response, not a no-op. Ads are skipped when they are in a terminal
9272
9298
  * status (rejected, completed, cancelled), already in the target state, or switched on but not yet
9273
9299
  * delivering. The last group keeps its `pending_review` / `error` status until the platform reports what
@@ -9495,7 +9521,9 @@ export const replaceCampaignNegativeKeywords = <ThrowOnError extends boolean = f
9495
9521
  * Pause or resume many campaigns
9496
9522
  * Process up to 50 campaigns in one call. Each campaign is updated
9497
9523
  * concurrently and the response contains a per-campaign result so a
9498
- * single bad row does not fail the whole batch.
9524
+ * single bad row does not fail the whole batch. Each campaign is written,
9525
+ * counted and re-read exactly as PUT /v1/ads/campaigns/{campaignId}/status
9526
+ * describes, including which child ad sets and ads each platform writes.
9499
9527
  *
9500
9528
  */
9501
9529
  export const bulkUpdateAdCampaignStatus = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<BulkUpdateAdCampaignStatusData, ThrowOnError>) => {
@@ -9628,6 +9656,19 @@ export const updateCampaignTargeting = <ThrowOnError extends boolean = false>(op
9628
9656
  * Google only) is visible here even though it is invisible in the tree
9629
9657
  * until an ad joins it via `adSetId` on POST /v1/ads/create. Returns at most 500
9630
9658
  * rows, newest first.
9659
+ *
9660
+ * **Status freshness.** `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus`
9661
+ * and `platformCampaignStatus` are the values Zernio last stored. Background sync refreshes
9662
+ * them, typically within 15 to 60 minutes (Google up to about 3 hours), and ended or
9663
+ * long-paused objects may be refreshed less often. Zernio's own status writes re-read the
9664
+ * switches they change. A change made in the platform's own ads manager therefore shows up
9665
+ * here only after the next sync. Controllers that act on a switch should pass `live=true`,
9666
+ * which reads the switches from the platform now, stores them, and returns `statusReadAt`
9667
+ * (null when the read failed and the stored values were returned).
9668
+ * With `live=true` (which needs a `campaignId` or `adSetId` filter) each listed ad set's own
9669
+ * switch (`platformAdSetStatus`) is read live, for the first 20 rows; later rows keep their
9670
+ * synced value with `statusReadAt: null`. Live reads cover TikTok, Meta, Google and OpenAI.
9671
+ * The rolled-up `status` is not re-derived by a live read.
9631
9672
  */
9632
9673
  export const listAdSets = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<ListAdSetsData, ThrowOnError>) => {
9633
9674
  return (options?.client ?? client).get<ListAdSetsResponse, ListAdSetsError, ThrowOnError>({
@@ -9752,6 +9793,11 @@ export const getAdSetDetails = <ThrowOnError extends boolean = false>(options: O
9752
9793
  * CBO, the response is 409 with code BUDGET_LEVEL_MISMATCH. Route to
9753
9794
  * PUT /v1/ads/campaigns/{campaignId} instead.
9754
9795
  *
9796
+ * `status` behaves exactly as PUT /v1/ads/ad-sets/{adSetId}/status
9797
+ * describes, including which child ads each platform writes with the ad
9798
+ * set and how `statusUpdated` / `statusSkipped` are counted against the
9799
+ * ads' live switches.
9800
+ *
9755
9801
  */
9756
9802
  export const updateAdSet = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateAdSetData, ThrowOnError>) => {
9757
9803
  return (options?.client ?? client).put<UpdateAdSetResponse, UpdateAdSetError, ThrowOnError>({
@@ -9791,13 +9837,26 @@ export const deleteAdSet = <ThrowOnError extends boolean = false>(options: Optio
9791
9837
  * status, LinkedIn campaign, Pinterest ad group, X line item, OpenAI ad
9792
9838
  * group), whatever delivery status its ads report: an ad still in review
9793
9839
  * or paused by its campaign does not block it. The echoed `status` is the
9794
- * confirmation that it landed. On TikTok, Pinterest and OpenAI the ads
9795
- * whose own switch is not yet in the target state are flipped with it.
9796
- *
9797
- * `updated` / `skipped` describe only the ads whose own stored status
9798
- * CHANGED alongside the switch, so `updated: 0` is a normal successful
9799
- * response. See `skippedReasons` for which of the three cases applies
9800
- * (terminal, already in the target state, or switched on but not yet
9840
+ * confirmation that it landed.
9841
+ *
9842
+ * **What the write touches (current semantics, per platform).** On TikTok the ad group AND
9843
+ * every ad under it that is not in a terminal status (rejected, completed, cancelled) are
9844
+ * written to the target state, on pause and on resume alike, so a resume also switches those
9845
+ * ads on. Pinterest and ChatGPT (OpenAI) do the same with their ads. On Meta, Google, LinkedIn
9846
+ * (campaign) and X (line item) only the ad set's own switch is written and each ad keeps its
9847
+ * own switch.
9848
+ *
9849
+ * **Counts and readback.** Before the write, each ad's own switch is read live from the
9850
+ * platform (up to 20 ads; beyond that the stored switch is used), and `updated` / `skipped`
9851
+ * are computed against that live state, not against a stored switch a change in the
9852
+ * platform's UI may have left stale. After the write each ad's own switch and delivery
9853
+ * status are read again and stored, and the ad set switch is re-read and stored, so an
9854
+ * immediate GET returns what the platform now reports.
9855
+ *
9856
+ * `updated` / `skipped` describe only the ads whose own status changed
9857
+ * alongside the switch, so `updated: 0` is a normal successful response.
9858
+ * See `skippedReasons` for which of the three cases applies (terminal,
9859
+ * own switch already in the target state, or switched on but not yet
9801
9860
  * delivering).
9802
9861
  *
9803
9862
  * A campaign created paused needs its campaign resumed as well: pair this
@@ -9884,6 +9943,18 @@ export const getAdsTimeline = <ThrowOnError extends boolean = false>(options: Op
9884
9943
  * `creative.creativeFeatures` holds the stored requested settings, which do not confirm
9885
9944
  * platform application.
9886
9945
  *
9946
+ * **Status freshness.** `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus`
9947
+ * and `platformCampaignStatus` are the values Zernio last stored. Background sync refreshes
9948
+ * them, typically within 15 to 60 minutes (Google up to about 3 hours), and ended or
9949
+ * long-paused objects may be refreshed less often. Zernio's own status writes re-read the
9950
+ * switches they change. A change made in the platform's own ads manager therefore shows up
9951
+ * here only after the next sync. Controllers that act on a switch should pass `live=true`,
9952
+ * which reads the switches from the platform now, stores them, and returns `statusReadAt`
9953
+ * (null when the read failed and the stored values were returned).
9954
+ * With `live=true` the ad's own switch (`configuredStatus`), its delivery status (`status`,
9955
+ * `platformStatus`) and its ad set and campaign switches (`platformAdSetStatus`,
9956
+ * `platformCampaignStatus`) are read live.
9957
+ *
9887
9958
  */
9888
9959
  export const getAd = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetAdData, ThrowOnError>) => {
9889
9960
  return (options?.client ?? client).get<GetAdResponse, GetAdError, ThrowOnError>({
@@ -502,6 +502,10 @@ export type AdCampaign = {
502
502
  * Raw platform-level campaign status (Meta `effective_status`; ChatGPT (OpenAI): the campaign's own switch, active / paused / archived; TikTok: the campaign's own switch `operation_status`, ENABLE / DISABLE).
503
503
  */
504
504
  platformCampaignStatus?: (string) | null;
505
+ /**
506
+ * Only on GET /v1/ads/campaigns with `live=true`. When `platformCampaignStatus` was read from the platform; null when this campaign could not be read live.
507
+ */
508
+ statusReadAt?: (string) | null;
505
509
  /**
506
510
  * Platform-reported campaign issues (Meta `issues_info[]`).
507
511
  */
@@ -1141,11 +1145,11 @@ export type AdPromotedObject = {
1141
1145
  */
1142
1146
  customConversionId?: string;
1143
1147
  /**
1144
- * Optional catalog ID. If supplied with productSetId, the set must belong to this catalog. A catalog ID cannot replace productSetId.
1148
+ * Optional catalog ID. If supplied with productSetId, the set must belong to this catalog (checked by Zernio when the Meta login carries catalog_management, by Meta otherwise). A catalog ID cannot replace productSetId.
1145
1149
  */
1146
1150
  productCatalogId?: string;
1147
1151
  /**
1148
- * Meta product SET ID from GET /v1/ads/catalogs/{catalogId}/product-sets. Zernio checks that the token can read the set and its product_catalog before creation. A catalog ID or inaccessible set returns a precise 400 naming promotedObject.productSetId. A mismatch with productCatalogId names promotedObject.productCatalogId.
1152
+ * Meta product SET ID, for example from GET /v1/ads/catalogs/{catalogId}/product-sets. Creating catalog ads needs only ads_management on the Meta login, not catalog_management. Zernio checks before creation that the set is visible to the token, and a set it cannot see returns a 400 naming promotedObject.productSetId (a catalog ID is caught the same way when the login carries catalog_management, and rejected by Meta otherwise). When the login can also read the set's catalog (catalog_management), a mismatch with productCatalogId returns a 400 naming promotedObject.productCatalogId; otherwise Meta judges the catalog match. With validateOnly and a new campaign, Meta cannot dry-run the set inside the ad set, so the adSet result carries a reason; pass existingCampaignId to dry-run it in full.
1149
1153
  */
1150
1154
  productSetId?: string;
1151
1155
  /**
@@ -7717,6 +7721,11 @@ export type ParameterCatalogTokenAccountId = string;
7717
7721
  */
7718
7722
  export type ParameterIdempotencyKeyHeader = string;
7719
7723
 
7724
+ /**
7725
+ * Read the on/off switches live from the platform instead of returning the synced values. The fresh values are stored (so later reads return them too) and the response carries `statusReadAt`, the time of the read. At most 20 platform objects are read per request. Where a read fails (credentials, platform error, no reader on that platform), the stored values come back with `statusReadAt: null`. See "Status freshness" in the operation description.
7726
+ */
7727
+ export type ParameterLiveStatusRead = boolean;
7728
+
7720
7729
  /**
7721
7730
  * Page number (1-based)
7722
7731
  */
@@ -37960,6 +37969,10 @@ export type ListAdCampaignsData = {
37960
37969
  */
37961
37970
  includeEmpty?: boolean;
37962
37971
  limit?: number;
37972
+ /**
37973
+ * Read the on/off switches live from the platform instead of returning the synced values. The fresh values are stored (so later reads return them too) and the response carries `statusReadAt`, the time of the read. At most 20 platform objects are read per request. Where a read fails (credentials, platform error, no reader on that platform), the stored values come back with `statusReadAt: null`. See "Status freshness" in the operation description.
37974
+ */
37975
+ live?: boolean;
37963
37976
  /**
37964
37977
  * Return only campaigns whose spend between `fromDate` and `toDate` reaches this amount, in each campaign's OWN currency (the `currency` field on the campaign). Implies `hasDelivery`; `minSpend=0` applies no filter. Mirrors the same filter on /v1/ads/tree.
37965
37978
  */
@@ -38798,10 +38811,18 @@ export type ListAdSetsData = {
38798
38811
  * Account ID
38799
38812
  */
38800
38813
  accountId?: string;
38814
+ /**
38815
+ * Platform ad set ID
38816
+ */
38817
+ adSetId?: string;
38801
38818
  /**
38802
38819
  * Platform campaign ID
38803
38820
  */
38804
38821
  campaignId?: string;
38822
+ /**
38823
+ * Read the on/off switches live from the platform instead of returning the synced values. The fresh values are stored (so later reads return them too) and the response carries `statusReadAt`, the time of the read. At most 20 platform objects are read per request. Where a read fails (credentials, platform error, no reader on that platform), the stored values come back with `statusReadAt: null`. See "Status freshness" in the operation description.
38824
+ */
38825
+ live?: boolean;
38805
38826
  platform?: 'facebook' | 'instagram' | 'tiktok' | 'linkedin' | 'pinterest' | 'google' | 'twitter' | 'openai';
38806
38827
  };
38807
38828
  };
@@ -38880,6 +38901,10 @@ export type ListAdSetsResponse = ({
38880
38901
  } | null;
38881
38902
  isExternal?: (boolean) | null;
38882
38903
  platformCreatedAt?: (string) | null;
38904
+ /**
38905
+ * Only with `live=true`. When `platformAdSetStatus` was read from the platform; null when this row was not read live.
38906
+ */
38907
+ statusReadAt?: (string) | null;
38883
38908
  }>;
38884
38909
  });
38885
38910
 
@@ -39419,6 +39444,12 @@ export type GetAdData = {
39419
39444
  */
39420
39445
  adId: string;
39421
39446
  };
39447
+ query?: {
39448
+ /**
39449
+ * Read the on/off switches live from the platform instead of returning the synced values. The fresh values are stored (so later reads return them too) and the response carries `statusReadAt`, the time of the read. At most 20 platform objects are read per request. Where a read fails (credentials, platform error, no reader on that platform), the stored values come back with `statusReadAt: null`. See "Status freshness" in the operation description.
39450
+ */
39451
+ live?: boolean;
39452
+ };
39422
39453
  };
39423
39454
 
39424
39455
  export type GetAdResponse = ({
@@ -39431,6 +39462,10 @@ export type GetAdResponse = ({
39431
39462
  * Whether Google RSA details use the last successful cached response.
39432
39463
  */
39433
39464
  stale?: boolean;
39465
+ /**
39466
+ * Only with `live=true`. When the switches were read from the platform; null when the live read failed and the stored values were returned.
39467
+ */
39468
+ statusReadAt?: (string) | null;
39434
39469
  });
39435
39470
 
39436
39471
  export type GetAdError = (ErrorResponse | {