@getlatedev/node 0.2.1675 → 0.2.1677

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.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.1675",
39
+ version: "0.2.1677",
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.1675",
8
+ version: "0.2.1677",
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.1675",
3
+ "version": "0.2.1677",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -765,7 +765,7 @@ export const getAutoRecharge = <ThrowOnError extends boolean = false>(options?:
765
765
  *
766
766
  * When this month's auto top-ups plus the next one would pass `monthlyLimitCents`, the card is not charged and you get one email that month. At $0, pay-per-use then answers 402 `usage_limit_reached`.
767
767
  *
768
- * - 400: a field is out of range, `toCents` is not more than $5 above `belowCents`, or, while auto top-up is on, `monthlyLimitCents` is lower than `toCents` (one top-up from $0 would pass it, so it could never charge). Omitted fields are checked with their stored values.
768
+ * - 400: a field is out of range, `toCents` is less than $5 above `belowCents`, or, while auto top-up is on, `monthlyLimitCents` is lower than `toCents` (one top-up from $0 would pass it, so it could never charge). Omitted fields are checked with their stored values.
769
769
  * - 409 `balance_billing_required`: the account is not on the prepaid balance.
770
770
  *
771
771
  * Needs an owner, admin or billing admin, signed in or through a full-access key they created.
@@ -1788,9 +1788,14 @@ export const getXApiPricing = <ThrowOnError extends boolean = false>(options?: O
1788
1788
  * - `peaks`, `callUsage` and `tax` are then `null` (team-level facts).
1789
1789
  * - Projected `days` spread the group's period share over each day (usage is attributed per period, not per day).
1790
1790
  * - `profileId` / `accountId` on their own do not select metering mode: pair them with `range`.
1791
+ * - `externalId` names the profile by the id you set on it (`POST /v1/profiles`), so you can bill a tenant without storing our profile id.
1792
+ *
1793
+ * With `groupBy=profile`, each group also carries `profileId` and `externalId`.
1791
1794
  *
1792
1795
  * Profile-scoped API keys and members only see their profiles' groups (`attribution.restricted: true`, with `totals` summing the visible groups). Credits, 10DLC fees and Verify are always unattributed.
1793
1796
  *
1797
+ * Since 1.630.0 a profile-scoped key or member never gets the team payload in metering mode: without `groupBy` or a filter, `days`, `totals` and `lineItems` are projected onto its visible profiles, `peaks`, `callUsage` and `tax` are `null`, and no `attribution` is returned. Full-access keys and sessions keep the team payload.
1798
+ *
1794
1799
  * ### Related endpoints
1795
1800
  *
1796
1801
  * - Per-domain consumption *volumes*: `GET /v1/usage/calls` and `GET /v1/usage/sms`.
@@ -1825,6 +1830,14 @@ export const getUsage = <ThrowOnError extends boolean = false>(options?: Options
1825
1830
  *
1826
1831
  * The legacy `usage.xApiCalls` 3-tier aggregate is still emitted for back-compat. It excludes the $0.200 URL tier and any future tiers, so new clients should consume `xApiCallsByOperation` only.
1827
1832
  *
1833
+ * ### Per profile
1834
+ *
1835
+ * `profileId` or `externalId` adds a `profile` block with the counters that are meaningful per profile (`usage.connectedAccounts`). Everything else (plan, limits, uploads, X usage, spend, payment state) stays team-level. These filters work on this path only: a bare `GET /v1/usage` ignores them.
1836
+ *
1837
+ * Since 1.630.0 a profile-scoped API key or member gets a `profiles` array with one block per profile it can see (or the single `profile` block when it filters), and `usage.connectedAccounts` / `usage.profiles` count only those profiles.
1838
+ *
1839
+ * Plan, billing and payment fields are unchanged. Full-access keys and sessions keep the team counts and get no `profiles` array.
1840
+ *
1828
1841
  */
1829
1842
  export const getUsageStats = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<GetUsageStatsData, ThrowOnError>) => {
1830
1843
  return (options?.client ?? client).get<GetUsageStatsResponse, GetUsageStatsError, ThrowOnError>({
@@ -1845,8 +1858,18 @@ export const getUsageStats = <ThrowOnError extends boolean = false>(options?: Op
1845
1858
  * `metaUSD` is the WhatsApp per-minute charge Meta bills directly to
1846
1859
  * your WABA (display only, never billed by Zernio).
1847
1860
  *
1848
- * Optional `groupBy` returns a breakdown by UTC day, by your number, or
1849
- * by channel. Defaults to the last 30 days.
1861
+ * Optional `groupBy` returns a breakdown by UTC day, by your number, by
1862
+ * channel, or by profile. Defaults to the last 30 days.
1863
+ *
1864
+ * ### Per profile
1865
+ *
1866
+ * A call belongs to the profile of the account (number) it was placed
1867
+ * on.
1868
+ *
1869
+ * - `profileId` or `externalId` scopes every figure to one profile.
1870
+ * - `groupBy=profile` returns one group per profile carrying its `profileId` and `externalId`.
1871
+ * - Calls on numbers outside any of your profiles count in `totals` but in no group.
1872
+ * - A profile-scoped API key or member only ever sees its own profiles' calls, with or without a filter (since 1.630.0), so `totals` and every group cover those profiles only. Full-access keys and sessions see the whole team.
1850
1873
  *
1851
1874
  */
1852
1875
  export const getCallsUsage = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<GetCallsUsageData, ThrowOnError>) => {
@@ -1866,6 +1889,15 @@ export const getCallsUsage = <ThrowOnError extends boolean = false>(options?: Op
1866
1889
  * and billed to your invoice, so per-message cost is not available here.
1867
1890
  * Calling usage (GET /v1/usage/calls) does include billable cost.
1868
1891
  *
1892
+ * ### Per profile
1893
+ *
1894
+ * A message belongs to the profile of the SMS number it went through.
1895
+ *
1896
+ * - `profileId` or `externalId` scopes the counts to one profile. Combined with `number`, only that number's messages on that profile count.
1897
+ * - `groupBy=profile` returns one group per profile carrying its `profileId` and `externalId`.
1898
+ * - Alphanumeric sender IDs sit on no profile, so their messages count in `totals` but in no group.
1899
+ * - A profile-scoped API key or member only ever sees its own profiles' messages, with or without a filter (since 1.630.0). Full-access keys and sessions see every number.
1900
+ *
1869
1901
  */
1870
1902
  export const getSmsUsage = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<GetSmsUsageData, ThrowOnError>) => {
1871
1903
  return (options?.client ?? client).get<GetSmsUsageResponse, GetSmsUsageError, ThrowOnError>({
@@ -9009,6 +9041,13 @@ export const createVoiceCall = <ThrowOnError extends boolean = false>(options: O
9009
9041
  * page. For a history that also includes WhatsApp calls, use
9010
9042
  * `GET /v1/calls`.
9011
9043
  *
9044
+ * `profileId` or `externalId` lists one profile's calls: a call belongs
9045
+ * to the profile of the account (number) it was placed on.
9046
+ *
9047
+ * A profile-scoped API key or member only ever lists its own profiles'
9048
+ * calls, with or without a filter (since 1.630.0). Full-access keys and
9049
+ * sessions list the whole team's.
9050
+ *
9012
9051
  */
9013
9052
  export const listVoiceCalls = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<ListVoiceCallsData, ThrowOnError>) => {
9014
9053
  return (options?.client ?? client).get<ListVoiceCallsResponse, ListVoiceCallsError, ThrowOnError>({
@@ -20296,6 +20296,14 @@ export type UsageAttributionGroup = UsageAttributionSlice & {
20296
20296
  * Profile id or account id, per `groupBy`.
20297
20297
  */
20298
20298
  key: string;
20299
+ /**
20300
+ * With `groupBy=profile` only: the profile id (same as `key`).
20301
+ */
20302
+ profileId?: string;
20303
+ /**
20304
+ * With `groupBy=profile` only: the externalId set on the profile, null when it has none.
20305
+ */
20306
+ externalId?: (string) | null;
20299
20307
  };
20300
20308
 
20301
20309
  export type UsageAttributionSlice = {
@@ -20469,11 +20477,9 @@ export type UsageMetering = {
20469
20477
  restricted?: boolean;
20470
20478
  };
20471
20479
  /**
20472
- * Present with `profileId` / `accountId`: echoes the group the payload was projected onto.
20480
+ * Present with `profileId` / `externalId` / `accountId`: echoes the group the payload was projected onto. A profile scope carries both ids.
20473
20481
  */
20474
- scope?: ({
20475
- profileId: string;
20476
- } | {
20482
+ scope?: (UsageProfileRef | {
20477
20483
  accountId: string;
20478
20484
  });
20479
20485
  };
@@ -20487,6 +20493,14 @@ export type source5 = 'cycle' | 'window';
20487
20493
 
20488
20494
  export type groupBy = 'profile' | 'account';
20489
20495
 
20496
+ export type UsageProfileRef = {
20497
+ profileId: string;
20498
+ /**
20499
+ * The externalId set on the profile, null when it has none.
20500
+ */
20501
+ externalId: (string) | null;
20502
+ };
20503
+
20490
20504
  /**
20491
20505
  * Plan and usage stats. The response shape depends on `billingSystem`:
20492
20506
  *
@@ -20589,6 +20603,25 @@ export type UsageStats = {
20589
20603
  [key: string]: (number);
20590
20604
  };
20591
20605
  };
20606
+ /**
20607
+ * Profile-scoped API keys and members only, without a filter: one block per profile the caller can see, shaped like `profile`.
20608
+ */
20609
+ profiles?: Array<(UsageProfileRef & {
20610
+ usage?: {
20611
+ connectedAccounts?: number;
20612
+ };
20613
+ })>;
20614
+ /**
20615
+ * Present with `profileId` / `externalId` on `GET /v1/usage-stats`: the per-profile counters. Everything outside this block stays team-level.
20616
+ */
20617
+ profile?: (UsageProfileRef & {
20618
+ usage?: {
20619
+ /**
20620
+ * Billable connected accounts on this profile, counted like the team-level figure.
20621
+ */
20622
+ connectedAccounts?: number;
20623
+ };
20624
+ });
20592
20625
  /**
20593
20626
  * Usage-based billing only. Current-period spend summary.
20594
20627
  */
@@ -29967,7 +30000,7 @@ export type UpdateAutoRechargeData = {
29967
30000
  */
29968
30001
  belowCents?: number;
29969
30002
  /**
29970
- * Top back up to this, in cents. More than $5 above belowCents.
30003
+ * Top back up to this, in cents. At least $5 above belowCents, so at least $10.
29971
30004
  */
29972
30005
  toCents?: number;
29973
30006
  /**
@@ -32531,9 +32564,13 @@ export type GetXApiPricingError = (ErrorResponse);
32531
32564
  export type GetUsageData = {
32532
32565
  query?: {
32533
32566
  /**
32534
- * Metering mode (pair with `range`). Project the payload onto this account's attributed share. Mutually exclusive with `profileId`, and `groupBy` (if given) must be `account`; 404 when the account is not visible to the caller.
32567
+ * Metering mode (pair with `range`). Project the payload onto this account's attributed share. Mutually exclusive with `profileId` and `externalId`, and `groupBy` (if given) must be `account`; 404 when the account is not visible to the caller.
32535
32568
  */
32536
32569
  accountId?: string;
32570
+ /**
32571
+ * Metering mode (pair with `range`). Same as `profileId`, naming the profile by the `externalId` you set on it. Ignored without metering params. 404 when none of your visible profiles carries it; 400 when two of them do (externalId is unique per user, not per team), then filter by `profileId`.
32572
+ */
32573
+ externalId?: string;
32537
32574
  /**
32538
32575
  * Inclusive start (UTC date). Required when `range=custom`.
32539
32576
  */
@@ -32550,7 +32587,7 @@ export type GetUsageData = {
32550
32587
  */
32551
32588
  groupBy?: 'profile' | 'account';
32552
32589
  /**
32553
- * Metering mode (pair with `range`). Project the payload onto this profile's attributed share. Mutually exclusive with `accountId`, and `groupBy` (if given) must be `profile`; 404 when the profile is not in your team (or outside a scoped key's profiles).
32590
+ * Metering mode (pair with `range`). Project the payload onto this profile's attributed share. Mutually exclusive with `externalId` and `accountId`, and `groupBy` (if given) must be `profile`; 404 when the profile is not in your team (or outside a scoped key's profiles).
32554
32591
  */
32555
32592
  profileId?: string;
32556
32593
  /**
@@ -32577,12 +32614,18 @@ export type GetUsageData = {
32577
32614
 
32578
32615
  export type GetUsageResponse = ((UsageStats | UsageMetering));
32579
32616
 
32580
- export type GetUsageError = (unknown | ErrorResponse | {
32581
- error?: string;
32582
- });
32617
+ export type GetUsageError = (unknown | ErrorResponse);
32583
32618
 
32584
32619
  export type GetUsageStatsData = {
32585
32620
  query?: {
32621
+ /**
32622
+ * Same as `profileId`, naming the profile by the `externalId` you set on it. 404 when none of your visible profiles carries it; 400 when two of them do.
32623
+ */
32624
+ externalId?: string;
32625
+ /**
32626
+ * Add the `profile` block for this profile. Mutually exclusive with `externalId`. 404 when the profile is not in your team or outside a scoped key's profiles.
32627
+ */
32628
+ profileId?: string;
32586
32629
  /**
32587
32630
  * For Stripe subscription users, `true` forces a subscription
32588
32631
  * reconciliation pass even when cached plan data looks complete.
@@ -32597,18 +32640,24 @@ export type GetUsageStatsData = {
32597
32640
 
32598
32641
  export type GetUsageStatsResponse = (UsageStats);
32599
32642
 
32600
- export type GetUsageStatsError = (unknown | ErrorResponse | {
32601
- error?: string;
32602
- });
32643
+ export type GetUsageStatsError = (unknown | ErrorResponse);
32603
32644
 
32604
32645
  export type GetCallsUsageData = {
32605
32646
  query?: {
32606
32647
  channel?: 'whatsapp' | 'pstn';
32607
- groupBy?: 'day' | 'number' | 'channel';
32648
+ /**
32649
+ * Same as `profileId`, naming the profile by the `externalId` you set on it. 404 when none of your visible profiles carries it; 400 when two of them do.
32650
+ */
32651
+ externalId?: string;
32652
+ groupBy?: 'day' | 'number' | 'channel' | 'profile';
32608
32653
  /**
32609
32654
  * Scope to calls involving this number (typically one of YOUR numbers). E.164, leading + optional.
32610
32655
  */
32611
32656
  number?: string;
32657
+ /**
32658
+ * Scope to the calls of this profile. Mutually exclusive with `externalId`. 404 when the profile is not in your team or outside a scoped key's profiles.
32659
+ */
32660
+ profileId?: string;
32612
32661
  /**
32613
32662
  * Start of the window (inclusive). Default 30 days before `until`.
32614
32663
  */
@@ -32623,7 +32672,11 @@ export type GetCallsUsageData = {
32623
32672
  export type GetCallsUsageResponse = ({
32624
32673
  since?: string;
32625
32674
  until?: string;
32626
- groupBy?: ('day' | 'number' | 'channel') | null;
32675
+ groupBy?: ('day' | 'number' | 'channel' | 'profile') | null;
32676
+ /**
32677
+ * Present with `profileId` / `externalId`: the profile the figures are scoped to.
32678
+ */
32679
+ profile?: UsageProfileRef;
32627
32680
  totals?: {
32628
32681
  calls?: number;
32629
32682
  answered?: number;
@@ -32650,9 +32703,17 @@ export type GetCallsUsageResponse = ({
32650
32703
  */
32651
32704
  groups?: Array<{
32652
32705
  /**
32653
- * The group key: a `YYYY-MM-DD` UTC day, one of your numbers, or a channel.
32706
+ * The group key: a `YYYY-MM-DD` UTC day, one of your numbers, a channel, or a profile id.
32654
32707
  */
32655
32708
  key?: string;
32709
+ /**
32710
+ * With `groupBy=profile` only: the profile id (same as `key`).
32711
+ */
32712
+ profileId?: string;
32713
+ /**
32714
+ * With `groupBy=profile` only: the externalId set on the profile, null when it has none.
32715
+ */
32716
+ externalId?: (string) | null;
32656
32717
  calls?: number;
32657
32718
  answered?: number;
32658
32719
  minutes?: number;
@@ -32667,11 +32728,19 @@ export type GetCallsUsageError = (unknown | ErrorResponse);
32667
32728
 
32668
32729
  export type GetSmsUsageData = {
32669
32730
  query?: {
32670
- groupBy?: 'day' | 'number';
32731
+ /**
32732
+ * Same as `profileId`, naming the profile by the `externalId` you set on it. 404 when none of your visible profiles carries it; 400 when two of them do.
32733
+ */
32734
+ externalId?: string;
32735
+ groupBy?: 'day' | 'number' | 'profile';
32671
32736
  /**
32672
32737
  * Scope to one of YOUR SMS-enabled numbers (E.164, leading + optional).
32673
32738
  */
32674
32739
  number?: string;
32740
+ /**
32741
+ * Scope to the messages of this profile. Mutually exclusive with `externalId`. 404 when the profile is not in your team or outside a scoped key's profiles.
32742
+ */
32743
+ profileId?: string;
32675
32744
  /**
32676
32745
  * Start of the window (inclusive). Default 30 days before `until`.
32677
32746
  */
@@ -32686,7 +32755,11 @@ export type GetSmsUsageData = {
32686
32755
  export type GetSmsUsageResponse = ({
32687
32756
  since?: string;
32688
32757
  until?: string;
32689
- groupBy?: ('day' | 'number') | null;
32758
+ groupBy?: ('day' | 'number' | 'profile') | null;
32759
+ /**
32760
+ * Present with `profileId` / `externalId`: the profile the counts are scoped to.
32761
+ */
32762
+ profile?: UsageProfileRef;
32690
32763
  totals?: {
32691
32764
  sent?: number;
32692
32765
  received?: number;
@@ -32697,9 +32770,17 @@ export type GetSmsUsageResponse = ({
32697
32770
  */
32698
32771
  groups?: Array<{
32699
32772
  /**
32700
- * A `YYYY-MM-DD` UTC day or one of your numbers.
32773
+ * A `YYYY-MM-DD` UTC day, one of your numbers, or a profile id.
32701
32774
  */
32702
32775
  key?: string;
32776
+ /**
32777
+ * With `groupBy=profile` only: the profile id (same as `key`).
32778
+ */
32779
+ profileId?: string;
32780
+ /**
32781
+ * With `groupBy=profile` only: the externalId set on the profile, null when it has none.
32782
+ */
32783
+ externalId?: (string) | null;
32703
32784
  sent?: number;
32704
32785
  received?: number;
32705
32786
  total?: number;
@@ -49938,11 +50019,19 @@ export type ListVoiceCallsData = {
49938
50019
  query?: {
49939
50020
  before?: string;
49940
50021
  direction?: 'inbound' | 'outbound';
50022
+ /**
50023
+ * Same as `profileId`, naming the profile by the `externalId` you set on it. 404 when none of your visible profiles carries it; 400 when two of them do.
50024
+ */
50025
+ externalId?: string;
49941
50026
  limit?: number;
49942
50027
  /**
49943
50028
  * Exact filter: calls involving this number (typically one of your DIDs). E.164, leading + optional.
49944
50029
  */
49945
50030
  number?: string;
50031
+ /**
50032
+ * Only calls of this profile. Mutually exclusive with `externalId`. 404 when the profile is not in your team or outside a scoped key's profiles.
50033
+ */
50034
+ profileId?: string;
49946
50035
  status?: 'ringing' | 'answered' | 'ended' | 'failed';
49947
50036
  };
49948
50037
  };
@@ -49952,7 +50041,7 @@ export type ListVoiceCallsResponse = ({
49952
50041
  nextCursor?: (string) | null;
49953
50042
  });
49954
50043
 
49955
- export type ListVoiceCallsError = (ErrorResponse);
50044
+ export type ListVoiceCallsError = (unknown | ErrorResponse);
49956
50045
 
49957
50046
  export type GetVoiceCallData = {
49958
50047
  path: {