@paygentic/sdk 0.8.1 → 0.8.2

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.
Files changed (80) hide show
  1. package/dist/commonjs/funcs/billableMetricsListEvents.js +1 -0
  2. package/dist/commonjs/funcs/billableMetricsListEvents.js.map +1 -1
  3. package/dist/commonjs/funcs/billableMetricsMeter.js +2 -0
  4. package/dist/commonjs/funcs/billableMetricsMeter.js.map +1 -1
  5. package/dist/commonjs/lib/config.d.ts +2 -2
  6. package/dist/commonjs/lib/config.js +2 -2
  7. package/dist/commonjs/models/eventresponse.d.ts +7 -0
  8. package/dist/commonjs/models/eventresponse.d.ts.map +1 -1
  9. package/dist/commonjs/models/eventresponse.js +1 -0
  10. package/dist/commonjs/models/eventresponse.js.map +1 -1
  11. package/dist/commonjs/models/meterevent.d.ts +4 -0
  12. package/dist/commonjs/models/meterevent.d.ts.map +1 -1
  13. package/dist/commonjs/models/meterevent.js +1 -0
  14. package/dist/commonjs/models/meterevent.js.map +1 -1
  15. package/dist/commonjs/models/operations/advancetestclock.d.ts +12 -12
  16. package/dist/commonjs/models/operations/advancetestclock.d.ts.map +1 -1
  17. package/dist/commonjs/models/operations/advancetestclock.js +13 -13
  18. package/dist/commonjs/models/operations/advancetestclock.js.map +1 -1
  19. package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts +11 -1
  20. package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts.map +1 -1
  21. package/dist/commonjs/models/operations/getbillablemetricmeter.js +2 -0
  22. package/dist/commonjs/models/operations/getbillablemetricmeter.js.map +1 -1
  23. package/dist/commonjs/models/operations/ingestevent.d.ts +71 -3
  24. package/dist/commonjs/models/operations/ingestevent.d.ts.map +1 -1
  25. package/dist/commonjs/models/operations/ingestevent.js +28 -2
  26. package/dist/commonjs/models/operations/ingestevent.js.map +1 -1
  27. package/dist/commonjs/models/operations/listbillablemetricevents.d.ts +5 -0
  28. package/dist/commonjs/models/operations/listbillablemetricevents.d.ts.map +1 -1
  29. package/dist/commonjs/models/operations/listbillablemetricevents.js +1 -0
  30. package/dist/commonjs/models/operations/listbillablemetricevents.js.map +1 -1
  31. package/dist/commonjs/models/usageresponse.d.ts +10 -2
  32. package/dist/commonjs/models/usageresponse.d.ts.map +1 -1
  33. package/dist/commonjs/models/usageresponse.js +2 -0
  34. package/dist/commonjs/models/usageresponse.js.map +1 -1
  35. package/dist/esm/funcs/billableMetricsListEvents.js +1 -0
  36. package/dist/esm/funcs/billableMetricsListEvents.js.map +1 -1
  37. package/dist/esm/funcs/billableMetricsMeter.js +2 -0
  38. package/dist/esm/funcs/billableMetricsMeter.js.map +1 -1
  39. package/dist/esm/lib/config.d.ts +2 -2
  40. package/dist/esm/lib/config.js +2 -2
  41. package/dist/esm/models/eventresponse.d.ts +7 -0
  42. package/dist/esm/models/eventresponse.d.ts.map +1 -1
  43. package/dist/esm/models/eventresponse.js +1 -0
  44. package/dist/esm/models/eventresponse.js.map +1 -1
  45. package/dist/esm/models/meterevent.d.ts +4 -0
  46. package/dist/esm/models/meterevent.d.ts.map +1 -1
  47. package/dist/esm/models/meterevent.js +1 -0
  48. package/dist/esm/models/meterevent.js.map +1 -1
  49. package/dist/esm/models/operations/advancetestclock.d.ts +12 -12
  50. package/dist/esm/models/operations/advancetestclock.d.ts.map +1 -1
  51. package/dist/esm/models/operations/advancetestclock.js +10 -10
  52. package/dist/esm/models/operations/advancetestclock.js.map +1 -1
  53. package/dist/esm/models/operations/getbillablemetricmeter.d.ts +11 -1
  54. package/dist/esm/models/operations/getbillablemetricmeter.d.ts.map +1 -1
  55. package/dist/esm/models/operations/getbillablemetricmeter.js +2 -0
  56. package/dist/esm/models/operations/getbillablemetricmeter.js.map +1 -1
  57. package/dist/esm/models/operations/ingestevent.d.ts +71 -3
  58. package/dist/esm/models/operations/ingestevent.d.ts.map +1 -1
  59. package/dist/esm/models/operations/ingestevent.js +25 -1
  60. package/dist/esm/models/operations/ingestevent.js.map +1 -1
  61. package/dist/esm/models/operations/listbillablemetricevents.d.ts +5 -0
  62. package/dist/esm/models/operations/listbillablemetricevents.d.ts.map +1 -1
  63. package/dist/esm/models/operations/listbillablemetricevents.js +1 -0
  64. package/dist/esm/models/operations/listbillablemetricevents.js.map +1 -1
  65. package/dist/esm/models/usageresponse.d.ts +10 -2
  66. package/dist/esm/models/usageresponse.d.ts.map +1 -1
  67. package/dist/esm/models/usageresponse.js +2 -0
  68. package/dist/esm/models/usageresponse.js.map +1 -1
  69. package/jsr.json +1 -1
  70. package/package.json +1 -1
  71. package/src/funcs/billableMetricsListEvents.ts +1 -0
  72. package/src/funcs/billableMetricsMeter.ts +2 -0
  73. package/src/lib/config.ts +2 -2
  74. package/src/models/eventresponse.ts +8 -0
  75. package/src/models/meterevent.ts +5 -0
  76. package/src/models/operations/advancetestclock.ts +39 -23
  77. package/src/models/operations/getbillablemetricmeter.ts +13 -1
  78. package/src/models/operations/ingestevent.ts +116 -6
  79. package/src/models/operations/listbillablemetricevents.ts +6 -0
  80. package/src/models/usageresponse.ts +12 -2
@@ -25,6 +25,10 @@ export type ListBillableMetricEventsRequest = {
25
25
  * Filter by external identifier. Alphanumeric characters, hyphens, and underscores only.
26
26
  */
27
27
  externalId?: string | undefined;
28
+ /**
29
+ * Filter by the merchant's own customer identifier the event was reported with.
30
+ */
31
+ externalSubject?: string | undefined;
28
32
  };
29
33
  /** @internal */
30
34
  export type ListBillableMetricEventsRequest$Outbound = {
@@ -35,6 +39,7 @@ export type ListBillableMetricEventsRequest$Outbound = {
35
39
  limit: number;
36
40
  offset: number;
37
41
  externalId?: string | undefined;
42
+ externalSubject?: string | undefined;
38
43
  };
39
44
  /** @internal */
40
45
  export declare const ListBillableMetricEventsRequest$outboundSchema: z.ZodType<ListBillableMetricEventsRequest$Outbound, z.ZodTypeDef, ListBillableMetricEventsRequest>;
@@ -1 +1 @@
1
- {"version":3,"file":"listbillablemetricevents.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listbillablemetricevents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,EAAE,EAAE,IAAI,CAAC;IACT;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,wCAAwC,GAAG;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,8CAA8C,EAAE,CAAC,CAAC,OAAO,CACpE,wCAAwC,EACxC,CAAC,CAAC,UAAU,EACZ,+BAA+B,CAS/B,CAAC;AAEH,wBAAgB,qCAAqC,CACnD,+BAA+B,EAAE,+BAA+B,GAC/D,MAAM,CAMR"}
1
+ {"version":3,"file":"listbillablemetricevents.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listbillablemetricevents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,EAAE,EAAE,IAAI,CAAC;IACT;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,wCAAwC,GAAG;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,8CAA8C,EAAE,CAAC,CAAC,OAAO,CACpE,wCAAwC,EACxC,CAAC,CAAC,UAAU,EACZ,+BAA+B,CAU/B,CAAC;AAEH,wBAAgB,qCAAqC,CACnD,+BAA+B,EAAE,+BAA+B,GAC/D,MAAM,CAMR"}
@@ -11,6 +11,7 @@ export const ListBillableMetricEventsRequest$outboundSchema = z.object({
11
11
  limit: z.number().int().default(20),
12
12
  offset: z.number().int().default(0),
13
13
  externalId: z.string().optional(),
14
+ externalSubject: z.string().optional(),
14
15
  });
15
16
  export function listBillableMetricEventsRequestToJSON(listBillableMetricEventsRequest) {
16
17
  return JSON.stringify(ListBillableMetricEventsRequest$outboundSchema.parse(listBillableMetricEventsRequest));
@@ -1 +1 @@
1
- {"version":3,"file":"listbillablemetricevents.js","sourceRoot":"","sources":["../../../../src/models/operations/listbillablemetricevents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAyC5B,gBAAgB;AAChB,MAAM,CAAC,MAAM,8CAA8C,GAIvD,CAAC,CAAC,MAAM,CAAC;IACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,qCAAqC,CACnD,+BAAgE;IAEhE,OAAO,IAAI,CAAC,SAAS,CACnB,8CAA8C,CAAC,KAAK,CAClD,+BAA+B,CAChC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"listbillablemetricevents.js","sourceRoot":"","sources":["../../../../src/models/operations/listbillablemetricevents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AA8C5B,gBAAgB;AAChB,MAAM,CAAC,MAAM,8CAA8C,GAIvD,CAAC,CAAC,MAAM,CAAC;IACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEH,MAAM,UAAU,qCAAqC,CACnD,+BAAgE;IAEhE,OAAO,IAAI,CAAC,SAAS,CACnB,8CAA8C,CAAC,KAAK,CAClD,+BAA+B,CAChC,CACF,CAAC;AACJ,CAAC"}
@@ -16,6 +16,10 @@ export type GroupedValue = {
16
16
  [k: string]: string;
17
17
  };
18
18
  value: number;
19
+ /**
20
+ * Number of raw events in this group
21
+ */
22
+ eventCount?: number | undefined;
19
23
  };
20
24
  export type UsageResponse = {
21
25
  object: UsageResponseObject;
@@ -28,13 +32,17 @@ export type UsageResponse = {
28
32
  */
29
33
  totalValue: number;
30
34
  /**
31
- * Time-bucketed values. Only present when windowSize is specified.
35
+ * Time-bucketed values. Only present when windowSize is specified. When both windowSize and groupBy are set, windowedValues[i] is index-aligned with groupedValues[i] (same window and group).
32
36
  */
33
37
  windowedValues?: Array<WindowedValue> | undefined;
34
38
  /**
35
- * Dimension-grouped values. Only present when groupBy is specified.
39
+ * Dimension-grouped values. Only present when groupBy is specified. When both windowSize and groupBy are set, groupedValues[i] is index-aligned with windowedValues[i] (same window and group).
36
40
  */
37
41
  groupedValues?: Array<GroupedValue> | undefined;
42
+ /**
43
+ * Total distinct groups before groupLimit/groupOffset truncation. Only present when groupLimit is specified; use it to drive pagination totals.
44
+ */
45
+ groupCount?: number | undefined;
38
46
  };
39
47
  /** @internal */
40
48
  export declare const UsageResponseObject$inboundSchema: z.ZodNativeEnum<typeof UsageResponseObject>;
@@ -1 +1 @@
1
- {"version":3,"file":"usageresponse.d.ts","sourceRoot":"","sources":["../../../src/models/usageresponse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,eAAO,MAAM,mBAAmB;;CAEtB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,mBAAmB,CAAC;IAC5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;IAClD;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;CACjD,CAA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O,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CACjD,aAAa,EACb,CAAC,CAAC,UAAU,EACZ,OAAO,CAQP,CAAC;AAEH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAMpD"}
@@ -21,6 +21,7 @@ export function windowedValueFromJSON(jsonString) {
21
21
  export const GroupedValue$inboundSchema = z.object({
22
22
  groupBy: z.record(z.string()),
23
23
  value: z.number(),
24
+ eventCount: z.number().int().optional(),
24
25
  });
25
26
  export function groupedValueFromJSON(jsonString) {
26
27
  return safeParse(jsonString, (x) => GroupedValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GroupedValue' from JSON`);
@@ -32,6 +33,7 @@ export const UsageResponse$inboundSchema = z.object({
32
33
  totalValue: z.number(),
33
34
  windowedValues: z.array(z.lazy(() => WindowedValue$inboundSchema)).optional(),
34
35
  groupedValues: z.array(z.lazy(() => GroupedValue$inboundSchema)).optional(),
36
+ groupCount: z.number().int().optional(),
35
37
  });
36
38
  export function usageResponseFromJSON(jsonString) {
37
39
  return safeParse(jsonString, (x) => UsageResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageResponse' from JSON`);
@@ -1 +1 @@
1
- {"version":3,"file":"usageresponse.js","sourceRoot":"","sources":["../../../src/models/usageresponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,OAAO;CACN,CAAC;AAkCX,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAE1C,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAEtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAIpC,CAAC,CAAC,MAAM,CAAC;IACX,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,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEH,MAAM,UAAU,qBAAqB,CACnC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACvD,2CAA2C,CAC5C,CAAC;AACJ,CAAC"}
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@paygentic/sdk",
5
- "version": "0.8.1",
5
+ "version": "0.8.2",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paygentic/sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "author": "Speakeasy",
5
5
  "repository": {
6
6
  "type": "git",
@@ -102,6 +102,7 @@ async function $do(
102
102
 
103
103
  const query = encodeFormQuery({
104
104
  "externalId": payload.externalId,
105
+ "externalSubject": payload.externalSubject,
105
106
  "from": payload.from,
106
107
  "limit": payload.limit,
107
108
  "offset": payload.offset,
@@ -104,6 +104,8 @@ async function $do(
104
104
  "filterGroupBy": payload.filterGroupBy,
105
105
  "from": payload.from,
106
106
  "groupBy": payload.groupBy,
107
+ "groupLimit": payload.groupLimit,
108
+ "groupOffset": payload.groupOffset,
107
109
  "subject": payload.subject,
108
110
  "to": payload.to,
109
111
  "windowSize": payload.windowSize,
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "0.1.0",
68
- sdkVersion: "0.8.1",
68
+ sdkVersion: "0.8.2",
69
69
  genVersion: "2.879.13",
70
- userAgent: "speakeasy-sdk/typescript 0.8.1 2.879.13 0.1.0 @paygentic/sdk",
70
+ userAgent: "speakeasy-sdk/typescript 0.8.2 2.879.13 0.1.0 @paygentic/sdk",
71
71
  } as const;
@@ -21,7 +21,14 @@ export type EventResponse = {
21
21
  object: EventResponseObject;
22
22
  type?: string | undefined;
23
23
  source?: string | undefined;
24
+ /**
25
+ * Resolved customer ID. Absent when the event was reported with an externalSubject that does not match a customer yet.
26
+ */
24
27
  subject?: string | undefined;
28
+ /**
29
+ * The merchant's own customer identifier the event was reported with.
30
+ */
31
+ externalSubject?: string | undefined;
25
32
  namespace?: string | undefined;
26
33
  timestamp?: Date | undefined;
27
34
  idempotencyKey?: string | undefined;
@@ -47,6 +54,7 @@ export const EventResponse$inboundSchema: z.ZodType<
47
54
  type: z.string().optional(),
48
55
  source: z.string().optional(),
49
56
  subject: z.string().optional(),
57
+ externalSubject: z.string().optional(),
50
58
  namespace: z.string().optional(),
51
59
  timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v))
52
60
  .optional(),
@@ -47,6 +47,10 @@ export type MeterEvent = {
47
47
  * Optional external identifier for cross-referencing with external systems. Alphanumeric characters, hyphens, and underscores only.
48
48
  */
49
49
  externalId?: string | undefined;
50
+ /**
51
+ * The merchant's own customer identifier the event was reported with. Empty subject with an externalSubject means the event is not linked to a customer yet.
52
+ */
53
+ externalSubject?: string | undefined;
50
54
  };
51
55
 
52
56
  /** @internal */
@@ -69,6 +73,7 @@ export const MeterEvent$inboundSchema: z.ZodType<
69
73
  idempotencyKey: z.string(),
70
74
  data: z.record(z.any()),
71
75
  externalId: z.string().optional(),
76
+ externalSubject: z.string().optional(),
72
77
  });
73
78
 
74
79
  export function meterEventFromJSON(
@@ -5,70 +5,84 @@
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
 
8
- export type RequestBody2 = {
8
+ export type AdvanceTestClockRequestBody2 = {
9
9
  /**
10
10
  * ISO 8601 duration format indicating clock advancement distance. Sample values: 'P1M' moves forward one month, 'P7D' moves forward seven days, 'PT2H' moves forward two hours, 'P1Y2M3DT4H5M6S' moves forward one year, two months, three days, four hours, five minutes, and six seconds
11
11
  */
12
12
  advanceBy: string;
13
13
  };
14
14
 
15
- export type RequestBody1 = {
15
+ export type AdvanceTestClockRequestBody1 = {
16
16
  /**
17
17
  * New absolute time for the test clock (must be forward in time)
18
18
  */
19
19
  currentTime: Date;
20
20
  };
21
21
 
22
- export type AdvanceTestClockRequestBody = RequestBody1 | RequestBody2;
22
+ export type AdvanceTestClockRequestBody =
23
+ | AdvanceTestClockRequestBody1
24
+ | AdvanceTestClockRequestBody2;
23
25
 
24
26
  export type AdvanceTestClockRequest = {
25
27
  /**
26
28
  * Test clock ID
27
29
  */
28
30
  id: string;
29
- requestBody: RequestBody1 | RequestBody2;
31
+ requestBody: AdvanceTestClockRequestBody1 | AdvanceTestClockRequestBody2;
30
32
  };
31
33
 
32
34
  /** @internal */
33
- export type RequestBody2$Outbound = {
35
+ export type AdvanceTestClockRequestBody2$Outbound = {
34
36
  advanceBy: string;
35
37
  };
36
38
 
37
39
  /** @internal */
38
- export const RequestBody2$outboundSchema: z.ZodType<
39
- RequestBody2$Outbound,
40
+ export const AdvanceTestClockRequestBody2$outboundSchema: z.ZodType<
41
+ AdvanceTestClockRequestBody2$Outbound,
40
42
  z.ZodTypeDef,
41
- RequestBody2
43
+ AdvanceTestClockRequestBody2
42
44
  > = z.object({
43
45
  advanceBy: z.string(),
44
46
  });
45
47
 
46
- export function requestBody2ToJSON(requestBody2: RequestBody2): string {
47
- return JSON.stringify(RequestBody2$outboundSchema.parse(requestBody2));
48
+ export function advanceTestClockRequestBody2ToJSON(
49
+ advanceTestClockRequestBody2: AdvanceTestClockRequestBody2,
50
+ ): string {
51
+ return JSON.stringify(
52
+ AdvanceTestClockRequestBody2$outboundSchema.parse(
53
+ advanceTestClockRequestBody2,
54
+ ),
55
+ );
48
56
  }
49
57
 
50
58
  /** @internal */
51
- export type RequestBody1$Outbound = {
59
+ export type AdvanceTestClockRequestBody1$Outbound = {
52
60
  currentTime: string;
53
61
  };
54
62
 
55
63
  /** @internal */
56
- export const RequestBody1$outboundSchema: z.ZodType<
57
- RequestBody1$Outbound,
64
+ export const AdvanceTestClockRequestBody1$outboundSchema: z.ZodType<
65
+ AdvanceTestClockRequestBody1$Outbound,
58
66
  z.ZodTypeDef,
59
- RequestBody1
67
+ AdvanceTestClockRequestBody1
60
68
  > = z.object({
61
69
  currentTime: z.date().transform(v => v.toISOString()),
62
70
  });
63
71
 
64
- export function requestBody1ToJSON(requestBody1: RequestBody1): string {
65
- return JSON.stringify(RequestBody1$outboundSchema.parse(requestBody1));
72
+ export function advanceTestClockRequestBody1ToJSON(
73
+ advanceTestClockRequestBody1: AdvanceTestClockRequestBody1,
74
+ ): string {
75
+ return JSON.stringify(
76
+ AdvanceTestClockRequestBody1$outboundSchema.parse(
77
+ advanceTestClockRequestBody1,
78
+ ),
79
+ );
66
80
  }
67
81
 
68
82
  /** @internal */
69
83
  export type AdvanceTestClockRequestBody$Outbound =
70
- | RequestBody1$Outbound
71
- | RequestBody2$Outbound;
84
+ | AdvanceTestClockRequestBody1$Outbound
85
+ | AdvanceTestClockRequestBody2$Outbound;
72
86
 
73
87
  /** @internal */
74
88
  export const AdvanceTestClockRequestBody$outboundSchema: z.ZodType<
@@ -76,8 +90,8 @@ export const AdvanceTestClockRequestBody$outboundSchema: z.ZodType<
76
90
  z.ZodTypeDef,
77
91
  AdvanceTestClockRequestBody
78
92
  > = z.union([
79
- z.lazy(() => RequestBody1$outboundSchema),
80
- z.lazy(() => RequestBody2$outboundSchema),
93
+ z.lazy(() => AdvanceTestClockRequestBody1$outboundSchema),
94
+ z.lazy(() => AdvanceTestClockRequestBody2$outboundSchema),
81
95
  ]);
82
96
 
83
97
  export function advanceTestClockRequestBodyToJSON(
@@ -93,7 +107,9 @@ export function advanceTestClockRequestBodyToJSON(
93
107
  /** @internal */
94
108
  export type AdvanceTestClockRequest$Outbound = {
95
109
  id: string;
96
- RequestBody: RequestBody1$Outbound | RequestBody2$Outbound;
110
+ RequestBody:
111
+ | AdvanceTestClockRequestBody1$Outbound
112
+ | AdvanceTestClockRequestBody2$Outbound;
97
113
  };
98
114
 
99
115
  /** @internal */
@@ -104,8 +120,8 @@ export const AdvanceTestClockRequest$outboundSchema: z.ZodType<
104
120
  > = z.object({
105
121
  id: z.string(),
106
122
  requestBody: z.union([
107
- z.lazy(() => RequestBody1$outboundSchema),
108
- z.lazy(() => RequestBody2$outboundSchema),
123
+ z.lazy(() => AdvanceTestClockRequestBody1$outboundSchema),
124
+ z.lazy(() => AdvanceTestClockRequestBody2$outboundSchema),
109
125
  ]),
110
126
  }).transform((v) => {
111
127
  return remap$(v, {
@@ -44,9 +44,17 @@ export type GetBillableMetricMeterRequest = {
44
44
  */
45
45
  filterGroupBy?: string | undefined;
46
46
  /**
47
- * Comma-separated dimension keys
47
+ * Comma-separated dimension keys. Configure keys for the grouping on the metric. Only the "subject" grouping is supported by default.
48
48
  */
49
49
  groupBy?: string | undefined;
50
+ /**
51
+ * Cap groupedValues to the top-N by value (descending). With windowSize, restricts the windowed series to those top-N groups. Bounds the payload for high-cardinality groupings; groupCount reports the untruncated distinct-group count.
52
+ */
53
+ groupLimit?: number | undefined;
54
+ /**
55
+ * Offset into the value-descending group ordering; requires groupLimit to page through grouped results. With windowSize set, pages the windowed series through the ranked groups (offset 0 yields the top-N).
56
+ */
57
+ groupOffset?: number | undefined;
50
58
  };
51
59
 
52
60
  /** @internal */
@@ -63,6 +71,8 @@ export type GetBillableMetricMeterRequest$Outbound = {
63
71
  windowSize?: string | undefined;
64
72
  filterGroupBy?: string | undefined;
65
73
  groupBy?: string | undefined;
74
+ groupLimit?: number | undefined;
75
+ groupOffset?: number | undefined;
66
76
  };
67
77
 
68
78
  /** @internal */
@@ -78,6 +88,8 @@ export const GetBillableMetricMeterRequest$outboundSchema: z.ZodType<
78
88
  windowSize: GetBillableMetricMeterWindowSize$outboundSchema.optional(),
79
89
  filterGroupBy: z.string().optional(),
80
90
  groupBy: z.string().optional(),
91
+ groupLimit: z.number().int().optional(),
92
+ groupOffset: z.number().int().optional(),
81
93
  });
82
94
 
83
95
  export function getBillableMetricMeterRequestToJSON(
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
 
7
- export type IngestEventRequest = {
7
+ export type IngestEventRequestBody2 = {
8
8
  /**
9
9
  * CloudEvents type. Must match an eventType configured on a BillableMetric.
10
10
  */
@@ -14,9 +14,52 @@ export type IngestEventRequest = {
14
14
  */
15
15
  source: string;
16
16
  /**
17
- * Customer or entity ID this event relates to.
17
+ * Customer or entity ID this event relates to. Required unless externalSubject is provided.
18
+ */
19
+ subject?: string | undefined;
20
+ /**
21
+ * Your own customer identifier, matched against the customer's externalId. Fallback for when the Paygentic customer ID is not known — prefer subject when it is. Events reported before the customer exists are linked retroactively once a customer with this externalId is created. Resolution is eventually consistent: after an externalId is removed or reassigned, events may resolve to the previous customer for up to one hour. If subject is also provided, subject takes precedence and externalSubject is recorded but not used for resolution.
22
+ */
23
+ externalSubject: string;
24
+ /**
25
+ * Organization/merchant ID. Defaults to the authenticated user's organization. Platform users can specify a different organization.
26
+ */
27
+ namespace?: string | undefined;
28
+ /**
29
+ * Event timestamp. Defaults to server time if not provided.
30
+ */
31
+ timestamp?: Date | undefined;
32
+ /**
33
+ * User-provided deduplication key. If not provided, a unique key is generated.
34
+ */
35
+ idempotencyKey?: string | undefined;
36
+ /**
37
+ * Optional external identifier for cross-referencing with external systems. Alphanumeric characters, hyphens, and underscores only.
38
+ */
39
+ externalId?: string | undefined;
40
+ /**
41
+ * Event payload containing the metering data.
42
+ */
43
+ data: { [k: string]: any };
44
+ };
45
+
46
+ export type IngestEventRequestBody1 = {
47
+ /**
48
+ * CloudEvents type. Must match an eventType configured on a BillableMetric.
49
+ */
50
+ type: string;
51
+ /**
52
+ * Event source URI identifying the application.
53
+ */
54
+ source: string;
55
+ /**
56
+ * Customer or entity ID this event relates to. Required unless externalSubject is provided.
18
57
  */
19
58
  subject: string;
59
+ /**
60
+ * Your own customer identifier, matched against the customer's externalId. Fallback for when the Paygentic customer ID is not known — prefer subject when it is. Events reported before the customer exists are linked retroactively once a customer with this externalId is created. Resolution is eventually consistent: after an externalId is removed or reassigned, events may resolve to the previous customer for up to one hour. If subject is also provided, subject takes precedence and externalSubject is recorded but not used for resolution.
61
+ */
62
+ externalSubject?: string | undefined;
20
63
  /**
21
64
  * Organization/merchant ID. Defaults to the authenticated user's organization. Platform users can specify a different organization.
22
65
  */
@@ -39,11 +82,54 @@ export type IngestEventRequest = {
39
82
  data: { [k: string]: any };
40
83
  };
41
84
 
85
+ export type IngestEventRequest =
86
+ | IngestEventRequestBody1
87
+ | IngestEventRequestBody2;
88
+
89
+ /** @internal */
90
+ export type IngestEventRequestBody2$Outbound = {
91
+ type: string;
92
+ source: string;
93
+ subject?: string | undefined;
94
+ externalSubject: string;
95
+ namespace?: string | undefined;
96
+ timestamp?: string | undefined;
97
+ idempotencyKey?: string | undefined;
98
+ externalId?: string | undefined;
99
+ data: { [k: string]: any };
100
+ };
101
+
102
+ /** @internal */
103
+ export const IngestEventRequestBody2$outboundSchema: z.ZodType<
104
+ IngestEventRequestBody2$Outbound,
105
+ z.ZodTypeDef,
106
+ IngestEventRequestBody2
107
+ > = z.object({
108
+ type: z.string(),
109
+ source: z.string(),
110
+ subject: z.string().optional(),
111
+ externalSubject: z.string(),
112
+ namespace: z.string().optional(),
113
+ timestamp: z.date().transform(v => v.toISOString()).optional(),
114
+ idempotencyKey: z.string().optional(),
115
+ externalId: z.string().optional(),
116
+ data: z.record(z.any()),
117
+ });
118
+
119
+ export function ingestEventRequestBody2ToJSON(
120
+ ingestEventRequestBody2: IngestEventRequestBody2,
121
+ ): string {
122
+ return JSON.stringify(
123
+ IngestEventRequestBody2$outboundSchema.parse(ingestEventRequestBody2),
124
+ );
125
+ }
126
+
42
127
  /** @internal */
43
- export type IngestEventRequest$Outbound = {
128
+ export type IngestEventRequestBody1$Outbound = {
44
129
  type: string;
45
130
  source: string;
46
131
  subject: string;
132
+ externalSubject?: string | undefined;
47
133
  namespace?: string | undefined;
48
134
  timestamp?: string | undefined;
49
135
  idempotencyKey?: string | undefined;
@@ -52,14 +138,15 @@ export type IngestEventRequest$Outbound = {
52
138
  };
53
139
 
54
140
  /** @internal */
55
- export const IngestEventRequest$outboundSchema: z.ZodType<
56
- IngestEventRequest$Outbound,
141
+ export const IngestEventRequestBody1$outboundSchema: z.ZodType<
142
+ IngestEventRequestBody1$Outbound,
57
143
  z.ZodTypeDef,
58
- IngestEventRequest
144
+ IngestEventRequestBody1
59
145
  > = z.object({
60
146
  type: z.string(),
61
147
  source: z.string(),
62
148
  subject: z.string(),
149
+ externalSubject: z.string().optional(),
63
150
  namespace: z.string().optional(),
64
151
  timestamp: z.date().transform(v => v.toISOString()).optional(),
65
152
  idempotencyKey: z.string().optional(),
@@ -67,6 +154,29 @@ export const IngestEventRequest$outboundSchema: z.ZodType<
67
154
  data: z.record(z.any()),
68
155
  });
69
156
 
157
+ export function ingestEventRequestBody1ToJSON(
158
+ ingestEventRequestBody1: IngestEventRequestBody1,
159
+ ): string {
160
+ return JSON.stringify(
161
+ IngestEventRequestBody1$outboundSchema.parse(ingestEventRequestBody1),
162
+ );
163
+ }
164
+
165
+ /** @internal */
166
+ export type IngestEventRequest$Outbound =
167
+ | IngestEventRequestBody1$Outbound
168
+ | IngestEventRequestBody2$Outbound;
169
+
170
+ /** @internal */
171
+ export const IngestEventRequest$outboundSchema: z.ZodType<
172
+ IngestEventRequest$Outbound,
173
+ z.ZodTypeDef,
174
+ IngestEventRequest
175
+ > = z.union([
176
+ z.lazy(() => IngestEventRequestBody1$outboundSchema),
177
+ z.lazy(() => IngestEventRequestBody2$outboundSchema),
178
+ ]);
179
+
70
180
  export function ingestEventRequestToJSON(
71
181
  ingestEventRequest: IngestEventRequest,
72
182
  ): string {
@@ -30,6 +30,10 @@ export type ListBillableMetricEventsRequest = {
30
30
  * Filter by external identifier. Alphanumeric characters, hyphens, and underscores only.
31
31
  */
32
32
  externalId?: string | undefined;
33
+ /**
34
+ * Filter by the merchant's own customer identifier the event was reported with.
35
+ */
36
+ externalSubject?: string | undefined;
33
37
  };
34
38
 
35
39
  /** @internal */
@@ -41,6 +45,7 @@ export type ListBillableMetricEventsRequest$Outbound = {
41
45
  limit: number;
42
46
  offset: number;
43
47
  externalId?: string | undefined;
48
+ externalSubject?: string | undefined;
44
49
  };
45
50
 
46
51
  /** @internal */
@@ -56,6 +61,7 @@ export const ListBillableMetricEventsRequest$outboundSchema: z.ZodType<
56
61
  limit: z.number().int().default(20),
57
62
  offset: z.number().int().default(0),
58
63
  externalId: z.string().optional(),
64
+ externalSubject: z.string().optional(),
59
65
  });
60
66
 
61
67
  export function listBillableMetricEventsRequestToJSON(
@@ -22,6 +22,10 @@ export type WindowedValue = {
22
22
  export type GroupedValue = {
23
23
  groupBy: { [k: string]: string };
24
24
  value: number;
25
+ /**
26
+ * Number of raw events in this group
27
+ */
28
+ eventCount?: number | undefined;
25
29
  };
26
30
 
27
31
  export type UsageResponse = {
@@ -35,13 +39,17 @@ export type UsageResponse = {
35
39
  */
36
40
  totalValue: number;
37
41
  /**
38
- * Time-bucketed values. Only present when windowSize is specified.
42
+ * Time-bucketed values. Only present when windowSize is specified. When both windowSize and groupBy are set, windowedValues[i] is index-aligned with groupedValues[i] (same window and group).
39
43
  */
40
44
  windowedValues?: Array<WindowedValue> | undefined;
41
45
  /**
42
- * Dimension-grouped values. Only present when groupBy is specified.
46
+ * Dimension-grouped values. Only present when groupBy is specified. When both windowSize and groupBy are set, groupedValues[i] is index-aligned with windowedValues[i] (same window and group).
43
47
  */
44
48
  groupedValues?: Array<GroupedValue> | undefined;
49
+ /**
50
+ * Total distinct groups before groupLimit/groupOffset truncation. Only present when groupLimit is specified; use it to drive pagination totals.
51
+ */
52
+ groupCount?: number | undefined;
45
53
  };
46
54
 
47
55
  /** @internal */
@@ -80,6 +88,7 @@ export const GroupedValue$inboundSchema: z.ZodType<
80
88
  > = z.object({
81
89
  groupBy: z.record(z.string()),
82
90
  value: z.number(),
91
+ eventCount: z.number().int().optional(),
83
92
  });
84
93
 
85
94
  export function groupedValueFromJSON(
@@ -103,6 +112,7 @@ export const UsageResponse$inboundSchema: z.ZodType<
103
112
  totalValue: z.number(),
104
113
  windowedValues: z.array(z.lazy(() => WindowedValue$inboundSchema)).optional(),
105
114
  groupedValues: z.array(z.lazy(() => GroupedValue$inboundSchema)).optional(),
115
+ groupCount: z.number().int().optional(),
106
116
  });
107
117
 
108
118
  export function usageResponseFromJSON(