@getlatedev/node 0.2.1743 → 0.2.1744

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 CHANGED
@@ -1479,7 +1479,7 @@ try {
1479
1479
  | `metrics.getAccountMetrics()` | Read follower and post totals per account, platform or scope over time |
1480
1480
  | `metrics.getAdAccountMetrics()` | Read the uploaded results summed across ad accounts |
1481
1481
  | `metrics.getAdMetrics()` | Read ad metrics by id, or one ad day by day with breakdowns |
1482
- | `metrics.getCampaignMetrics()` | Read the uploaded results of each campaign over a window |
1482
+ | `metrics.getCampaignMetrics()` | Read the delivery metrics or the uploaded results of each campaign over a window |
1483
1483
  | `metrics.getInboxMetrics()` | Read message volume and response times |
1484
1484
  | `metrics.getInsightMetrics()` | Read live account or post insights from the platform |
1485
1485
  | `metrics.getMetricsCatalog()` | List the metrics, groupings and limits of each metrics endpoint |
package/dist/index.d.mts CHANGED
@@ -9476,11 +9476,33 @@ type CampaignMetricRow = {
9476
9476
  adAccountId: string;
9477
9477
  campaignId: string;
9478
9478
  /**
9479
- * Each uploaded result metric summed over the range, by metric key.
9479
+ * Without metrics, each uploaded result metric summed over the range, by metric key.
9480
9480
  */
9481
- results: {
9481
+ results?: {
9482
9482
  [key: string]: (number);
9483
9483
  };
9484
+ /**
9485
+ * With metrics, the campaign name. null before its first sync.
9486
+ */
9487
+ name?: (string) | null;
9488
+ /**
9489
+ * With metrics, the ad account currency every money metric of this campaign is in. Campaigns of different ad accounts are never summed together.
9490
+ */
9491
+ currency?: (string) | null;
9492
+ /**
9493
+ * With metrics, only the asked metrics, summed over every ad of the campaign with rates recomputed from the sums. reach is deduplicated across the range for Meta and TikTok when the platform returns it.
9494
+ */
9495
+ metrics?: (AdMetrics);
9496
+ /**
9497
+ * With granularity=day, one point per day with delivery, each carrying date and the asked metrics.
9498
+ */
9499
+ daily?: Array<(AdMetrics & {
9500
+ date: string;
9501
+ })>;
9502
+ /**
9503
+ * With metrics, when the newest daily row of the campaign was synced.
9504
+ */
9505
+ lastSyncedAt?: (string) | null;
9484
9506
  };
9485
9507
  type CampaignMetricsResponse = {
9486
9508
  data: Array<CampaignMetricRow>;
@@ -9488,6 +9510,10 @@ type CampaignMetricsResponse = {
9488
9510
  meta: ({
9489
9511
  fromDate: string;
9490
9512
  toDate: string;
9513
+ /**
9514
+ * With metrics, asked campaignIds that are not campaigns the caller can see.
9515
+ */
9516
+ missingIds?: Array<(string)>;
9491
9517
  } & MetricsFreshness);
9492
9518
  };
9493
9519
  type CampaignParticipant = {
@@ -33622,7 +33648,7 @@ type GetAdMetricsError = (ErrorResponse | (ErrorResponse & {
33622
33648
  type GetCampaignMetricsData = {
33623
33649
  query: {
33624
33650
  /**
33625
- * Comma-separated platform campaign ids.
33651
+ * Comma-separated platform campaign ids. Required with metrics, up to 100.
33626
33652
  */
33627
33653
  campaignId?: string;
33628
33654
  /**
@@ -33633,10 +33659,18 @@ type GetCampaignMetricsData = {
33633
33659
  * First day, inclusive.
33634
33660
  */
33635
33661
  fromDate: string;
33662
+ /**
33663
+ * day adds one point per day to each campaign. Needs metrics.
33664
+ */
33665
+ granularity?: 'total' | 'day';
33636
33666
  /**
33637
33667
  * Rows per page, 50 by default, 100 at most.
33638
33668
  */
33639
33669
  limit?: number;
33670
+ /**
33671
+ * Comma-separated delivery metrics, as GET /v1/metrics/catalog?entity=campaigns lists them (spend, impressions, reach, clicks, ctr, cpc, cpm, conversions, roas, actions, funnel, video counts...).
33672
+ */
33673
+ metrics?: string;
33640
33674
  /**
33641
33675
  * Last day, inclusive. The range is at most 400 days.
33642
33676
  */
package/dist/index.d.ts CHANGED
@@ -9476,11 +9476,33 @@ type CampaignMetricRow = {
9476
9476
  adAccountId: string;
9477
9477
  campaignId: string;
9478
9478
  /**
9479
- * Each uploaded result metric summed over the range, by metric key.
9479
+ * Without metrics, each uploaded result metric summed over the range, by metric key.
9480
9480
  */
9481
- results: {
9481
+ results?: {
9482
9482
  [key: string]: (number);
9483
9483
  };
9484
+ /**
9485
+ * With metrics, the campaign name. null before its first sync.
9486
+ */
9487
+ name?: (string) | null;
9488
+ /**
9489
+ * With metrics, the ad account currency every money metric of this campaign is in. Campaigns of different ad accounts are never summed together.
9490
+ */
9491
+ currency?: (string) | null;
9492
+ /**
9493
+ * With metrics, only the asked metrics, summed over every ad of the campaign with rates recomputed from the sums. reach is deduplicated across the range for Meta and TikTok when the platform returns it.
9494
+ */
9495
+ metrics?: (AdMetrics);
9496
+ /**
9497
+ * With granularity=day, one point per day with delivery, each carrying date and the asked metrics.
9498
+ */
9499
+ daily?: Array<(AdMetrics & {
9500
+ date: string;
9501
+ })>;
9502
+ /**
9503
+ * With metrics, when the newest daily row of the campaign was synced.
9504
+ */
9505
+ lastSyncedAt?: (string) | null;
9484
9506
  };
9485
9507
  type CampaignMetricsResponse = {
9486
9508
  data: Array<CampaignMetricRow>;
@@ -9488,6 +9510,10 @@ type CampaignMetricsResponse = {
9488
9510
  meta: ({
9489
9511
  fromDate: string;
9490
9512
  toDate: string;
9513
+ /**
9514
+ * With metrics, asked campaignIds that are not campaigns the caller can see.
9515
+ */
9516
+ missingIds?: Array<(string)>;
9491
9517
  } & MetricsFreshness);
9492
9518
  };
9493
9519
  type CampaignParticipant = {
@@ -33622,7 +33648,7 @@ type GetAdMetricsError = (ErrorResponse | (ErrorResponse & {
33622
33648
  type GetCampaignMetricsData = {
33623
33649
  query: {
33624
33650
  /**
33625
- * Comma-separated platform campaign ids.
33651
+ * Comma-separated platform campaign ids. Required with metrics, up to 100.
33626
33652
  */
33627
33653
  campaignId?: string;
33628
33654
  /**
@@ -33633,10 +33659,18 @@ type GetCampaignMetricsData = {
33633
33659
  * First day, inclusive.
33634
33660
  */
33635
33661
  fromDate: string;
33662
+ /**
33663
+ * day adds one point per day to each campaign. Needs metrics.
33664
+ */
33665
+ granularity?: 'total' | 'day';
33636
33666
  /**
33637
33667
  * Rows per page, 50 by default, 100 at most.
33638
33668
  */
33639
33669
  limit?: number;
33670
+ /**
33671
+ * Comma-separated delivery metrics, as GET /v1/metrics/catalog?entity=campaigns lists them (spend, impressions, reach, clicks, ctr, cpc, cpm, conversions, roas, actions, funnel, video counts...).
33672
+ */
33673
+ metrics?: string;
33640
33674
  /**
33641
33675
  * Last day, inclusive. The range is at most 400 days.
33642
33676
  */
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.1743",
39
+ version: "0.2.1744",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
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.1743",
8
+ version: "0.2.1744",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlatedev/node",
3
- "version": "0.2.1743",
3
+ "version": "0.2.1744",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -239,10 +239,12 @@ export const getAdMetrics = <ThrowOnError extends boolean = false>(options: Opti
239
239
  };
240
240
 
241
241
  /**
242
- * Read the uploaded results of each campaign over a window
243
- * Sums, per campaign, each result metric you uploaded (one key per metric, as `GET /v1/ads/campaign-results/metrics` lists them), with `cac_percent`, `cost_per_sale`, `cost_per_qualified_lead`, `lead_to_sale` and `qualified_rate` next to them, over `fromDate` to `toDate` (both required, at most 400 days).
242
+ * Read the delivery metrics or the uploaded results of each campaign over a window
243
+ * Without `metrics`, sums per campaign each result metric you uploaded (one key per metric, as `GET /v1/ads/campaign-results/metrics` lists them), with `cac_percent`, `cost_per_sale`, `cost_per_qualified_lead`, `lead_to_sale` and `qualified_rate` next to them, over `fromDate` to `toDate` (both required, at most 400 days). Filter with `campaignId` (platform campaign ids); pages with `cursor`.
244
244
  *
245
- * Filter with `campaignId` (platform campaign ids); pages with `cursor`.
245
+ * With `metrics` (for example `metrics=spend,impressions,clicks,ctr`), sums the delivery metrics of every ad of each campaign in `campaignId` (required, up to 100) from the stored daily rows. Every campaign comes on one page with its `currency`, and `granularity=day` adds one point per day.
246
+ *
247
+ * A query reads at most 9,200 campaign days (100 campaigns for 92 days, 23 for 400) and answers 422 `query_too_large` beyond that. Breakdowns stay live in the platform queries, such as `POST /v1/metrics/platform-queries/meta-ads`.
246
248
  */
247
249
  export const getCampaignMetrics = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetCampaignMetricsData, ThrowOnError>) => {
248
250
  return (options?.client ?? client).get<GetCampaignMetricsResponse, GetCampaignMetricsError, ThrowOnError>({
@@ -7141,11 +7141,33 @@ export type CampaignMetricRow = {
7141
7141
  adAccountId: string;
7142
7142
  campaignId: string;
7143
7143
  /**
7144
- * Each uploaded result metric summed over the range, by metric key.
7144
+ * Without metrics, each uploaded result metric summed over the range, by metric key.
7145
7145
  */
7146
- results: {
7146
+ results?: {
7147
7147
  [key: string]: (number);
7148
7148
  };
7149
+ /**
7150
+ * With metrics, the campaign name. null before its first sync.
7151
+ */
7152
+ name?: (string) | null;
7153
+ /**
7154
+ * With metrics, the ad account currency every money metric of this campaign is in. Campaigns of different ad accounts are never summed together.
7155
+ */
7156
+ currency?: (string) | null;
7157
+ /**
7158
+ * With metrics, only the asked metrics, summed over every ad of the campaign with rates recomputed from the sums. reach is deduplicated across the range for Meta and TikTok when the platform returns it.
7159
+ */
7160
+ metrics?: (AdMetrics);
7161
+ /**
7162
+ * With granularity=day, one point per day with delivery, each carrying date and the asked metrics.
7163
+ */
7164
+ daily?: Array<(AdMetrics & {
7165
+ date: string;
7166
+ })>;
7167
+ /**
7168
+ * With metrics, when the newest daily row of the campaign was synced.
7169
+ */
7170
+ lastSyncedAt?: (string) | null;
7149
7171
  };
7150
7172
 
7151
7173
  export type CampaignMetricsResponse = {
@@ -7154,6 +7176,10 @@ export type CampaignMetricsResponse = {
7154
7176
  meta: ({
7155
7177
  fromDate: string;
7156
7178
  toDate: string;
7179
+ /**
7180
+ * With metrics, asked campaignIds that are not campaigns the caller can see.
7181
+ */
7182
+ missingIds?: Array<(string)>;
7157
7183
  } & MetricsFreshness);
7158
7184
  };
7159
7185
 
@@ -32390,7 +32416,7 @@ export type GetAdMetricsError = (ErrorResponse | (ErrorResponse & {
32390
32416
  export type GetCampaignMetricsData = {
32391
32417
  query: {
32392
32418
  /**
32393
- * Comma-separated platform campaign ids.
32419
+ * Comma-separated platform campaign ids. Required with metrics, up to 100.
32394
32420
  */
32395
32421
  campaignId?: string;
32396
32422
  /**
@@ -32401,10 +32427,18 @@ export type GetCampaignMetricsData = {
32401
32427
  * First day, inclusive.
32402
32428
  */
32403
32429
  fromDate: string;
32430
+ /**
32431
+ * day adds one point per day to each campaign. Needs metrics.
32432
+ */
32433
+ granularity?: 'total' | 'day';
32404
32434
  /**
32405
32435
  * Rows per page, 50 by default, 100 at most.
32406
32436
  */
32407
32437
  limit?: number;
32438
+ /**
32439
+ * Comma-separated delivery metrics, as GET /v1/metrics/catalog?entity=campaigns lists them (spend, impressions, reach, clicks, ctr, cpc, cpm, conversions, roas, actions, funnel, video counts...).
32440
+ */
32441
+ metrics?: string;
32408
32442
  /**
32409
32443
  * Last day, inclusive. The range is at most 400 days.
32410
32444
  */