@openmeter/sdk 1.0.0-beta.21 → 1.0.0-beta.211

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 (138) hide show
  1. package/README.md +38 -150
  2. package/dist/cjs/index.cjs +18 -0
  3. package/dist/cjs/index.d.cts +1 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/src/client/apps.cjs +174 -0
  6. package/dist/cjs/src/client/apps.d.cts +286 -0
  7. package/dist/cjs/src/client/apps.js.map +1 -0
  8. package/dist/cjs/src/client/billing.cjs +309 -0
  9. package/dist/cjs/src/client/billing.d.cts +502 -0
  10. package/dist/cjs/src/client/billing.js.map +1 -0
  11. package/dist/cjs/src/client/common.cjs +47 -0
  12. package/dist/cjs/src/client/common.d.cts +30 -0
  13. package/dist/cjs/src/client/common.js.map +1 -0
  14. package/dist/cjs/src/client/customers.cjs +199 -0
  15. package/dist/cjs/src/client/customers.d.cts +179 -0
  16. package/dist/cjs/src/client/customers.js.map +1 -0
  17. package/dist/cjs/src/client/entitlements.cjs +244 -0
  18. package/dist/cjs/src/client/entitlements.d.cts +472 -0
  19. package/dist/cjs/src/client/entitlements.js.map +1 -0
  20. package/dist/cjs/src/client/events.cjs +66 -0
  21. package/dist/cjs/src/client/events.d.cts +31 -0
  22. package/dist/cjs/src/client/events.js.map +1 -0
  23. package/dist/cjs/src/client/features.cjs +78 -0
  24. package/dist/cjs/src/client/features.d.cts +78 -0
  25. package/dist/cjs/src/client/features.js.map +1 -0
  26. package/dist/cjs/src/client/index.cjs +108 -0
  27. package/dist/cjs/src/client/index.d.cts +45 -0
  28. package/dist/cjs/src/client/index.js.map +1 -0
  29. package/dist/cjs/src/client/meters.cjs +96 -0
  30. package/dist/cjs/src/client/meters.d.cts +99 -0
  31. package/dist/cjs/src/client/meters.js.map +1 -0
  32. package/dist/cjs/src/client/notifications.cjs +249 -0
  33. package/dist/cjs/src/client/notifications.d.cts +219 -0
  34. package/dist/cjs/src/client/notifications.js.map +1 -0
  35. package/dist/cjs/src/client/plans.cjs +127 -0
  36. package/dist/cjs/src/client/plans.d.cts +142 -0
  37. package/dist/cjs/src/client/plans.js.map +1 -0
  38. package/dist/cjs/src/client/portal.cjs +55 -0
  39. package/dist/cjs/src/client/portal.d.cts +48 -0
  40. package/dist/cjs/src/client/portal.js.map +1 -0
  41. package/dist/cjs/src/client/schemas.cjs +3 -0
  42. package/dist/cjs/src/client/schemas.d.cts +22438 -0
  43. package/dist/cjs/src/client/schemas.js.map +1 -0
  44. package/dist/cjs/src/client/subjects.cjs +76 -0
  45. package/dist/cjs/src/client/subjects.d.cts +70 -0
  46. package/dist/cjs/src/client/subjects.js.map +1 -0
  47. package/dist/cjs/src/client/subscriptions.cjs +116 -0
  48. package/dist/cjs/src/client/subscriptions.d.cts +147 -0
  49. package/dist/cjs/src/client/subscriptions.js.map +1 -0
  50. package/dist/cjs/src/client/utils.cjs +69 -0
  51. package/dist/cjs/src/client/utils.d.cts +12 -0
  52. package/dist/cjs/src/client/utils.js.map +1 -0
  53. package/dist/cjs/src/portal/index.cjs +60 -0
  54. package/dist/cjs/src/portal/index.d.cts +43 -0
  55. package/dist/cjs/src/portal/index.js.map +1 -0
  56. package/dist/cjs/src/react/context.cjs +35 -0
  57. package/dist/cjs/src/react/context.d.cts +9 -0
  58. package/dist/cjs/src/react/context.js.map +1 -0
  59. package/dist/cjs/tsconfig.341d9ef4.tsbuildinfo +1 -0
  60. package/dist/cjs/tsconfig.523d9ac8.tsbuildinfo +1 -0
  61. package/dist/index.d.ts +1 -14
  62. package/dist/index.js +2 -15
  63. package/dist/index.js.map +1 -0
  64. package/dist/src/client/apps.d.ts +286 -0
  65. package/dist/src/client/apps.js +168 -0
  66. package/dist/src/client/apps.js.map +1 -0
  67. package/dist/src/client/billing.d.ts +502 -0
  68. package/dist/src/client/billing.js +302 -0
  69. package/dist/src/client/billing.js.map +1 -0
  70. package/dist/src/client/common.d.ts +30 -0
  71. package/dist/src/client/common.js +42 -0
  72. package/dist/src/client/common.js.map +1 -0
  73. package/dist/src/client/customers.d.ts +179 -0
  74. package/dist/src/client/customers.js +193 -0
  75. package/dist/src/client/customers.js.map +1 -0
  76. package/dist/src/client/entitlements.d.ts +472 -0
  77. package/dist/src/client/entitlements.js +239 -0
  78. package/dist/src/client/entitlements.js.map +1 -0
  79. package/dist/src/client/events.d.ts +31 -0
  80. package/dist/src/client/events.js +58 -0
  81. package/dist/src/client/events.js.map +1 -0
  82. package/dist/src/client/features.d.ts +78 -0
  83. package/dist/src/client/features.js +74 -0
  84. package/dist/src/client/features.js.map +1 -0
  85. package/dist/src/client/index.d.ts +45 -0
  86. package/dist/src/client/index.js +68 -0
  87. package/dist/src/client/index.js.map +1 -0
  88. package/dist/src/client/meters.d.ts +99 -0
  89. package/dist/src/client/meters.js +92 -0
  90. package/dist/src/client/meters.js.map +1 -0
  91. package/dist/src/client/notifications.d.ts +219 -0
  92. package/dist/src/client/notifications.js +242 -0
  93. package/dist/src/client/notifications.js.map +1 -0
  94. package/dist/src/client/plans.d.ts +142 -0
  95. package/dist/src/client/plans.js +123 -0
  96. package/dist/src/client/plans.js.map +1 -0
  97. package/dist/src/client/portal.d.ts +48 -0
  98. package/dist/src/client/portal.js +51 -0
  99. package/dist/src/client/portal.js.map +1 -0
  100. package/dist/src/client/schemas.d.ts +22438 -0
  101. package/dist/src/client/schemas.js +2 -0
  102. package/dist/src/client/schemas.js.map +1 -0
  103. package/dist/src/client/subjects.d.ts +70 -0
  104. package/dist/src/client/subjects.js +72 -0
  105. package/dist/src/client/subjects.js.map +1 -0
  106. package/dist/src/client/subscriptions.d.ts +147 -0
  107. package/dist/src/client/subscriptions.js +112 -0
  108. package/dist/src/client/subscriptions.js.map +1 -0
  109. package/dist/src/client/utils.d.ts +12 -0
  110. package/dist/src/client/utils.js +63 -0
  111. package/dist/src/client/utils.js.map +1 -0
  112. package/dist/src/portal/index.d.ts +43 -0
  113. package/dist/src/portal/index.js +53 -0
  114. package/dist/src/portal/index.js.map +1 -0
  115. package/dist/src/react/context.d.ts +9 -0
  116. package/dist/src/react/context.js +16 -0
  117. package/dist/src/react/context.js.map +1 -0
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +75 -35
  120. package/patches/openapi-typescript.patch +73 -0
  121. package/dist/clients/client.d.ts +0 -40
  122. package/dist/clients/client.js +0 -104
  123. package/dist/clients/event.d.ts +0 -79
  124. package/dist/clients/event.js +0 -53
  125. package/dist/clients/meter.d.ts +0 -96
  126. package/dist/clients/meter.js +0 -64
  127. package/dist/clients/portal.d.ts +0 -23
  128. package/dist/clients/portal.js +0 -37
  129. package/dist/next.d.ts +0 -15
  130. package/dist/next.js +0 -46
  131. package/dist/schemas/openapi.d.ts +0 -460
  132. package/dist/schemas/openapi.js +0 -5
  133. package/dist/test/agent.d.ts +0 -2
  134. package/dist/test/agent.js +0 -178
  135. package/dist/test/mocks.d.ts +0 -12
  136. package/dist/test/mocks.js +0 -32
  137. package/index.ts +0 -22
  138. package/next.ts +0 -76
@@ -0,0 +1,78 @@
1
+ import type { RequestOptions } from './common.cjs';
2
+ import type { FeatureCreateInputs, operations, paths } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Features
6
+ * @description Features are the building blocks of your application. They represent the capabilities or services that your application offers.
7
+ */
8
+ export declare class Features {
9
+ private client;
10
+ constructor(client: Client<paths, `${string}/${string}`>);
11
+ /**
12
+ * Create a feature
13
+ * @param feature - The feature to create
14
+ * @param signal - An optional abort signal
15
+ * @returns The created feature
16
+ */
17
+ create(feature: FeatureCreateInputs, options?: RequestOptions): Promise<{
18
+ readonly createdAt: Date;
19
+ readonly updatedAt: Date;
20
+ readonly deletedAt?: Date;
21
+ readonly archivedAt?: Date;
22
+ key: string;
23
+ name: string;
24
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
25
+ meterSlug?: string;
26
+ meterGroupByFilters?: {
27
+ [key: string]: string;
28
+ };
29
+ readonly id: string;
30
+ }>;
31
+ /**
32
+ * Get a feature by ID
33
+ * @param id - The ID of the feature
34
+ * @param signal - An optional abort signal
35
+ * @returns The feature
36
+ */
37
+ get(id: operations['getFeature']['parameters']['path']['featureId'], options?: RequestOptions): Promise<{
38
+ readonly createdAt: Date;
39
+ readonly updatedAt: Date;
40
+ readonly deletedAt?: Date;
41
+ readonly archivedAt?: Date;
42
+ key: string;
43
+ name: string;
44
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
45
+ meterSlug?: string;
46
+ meterGroupByFilters?: {
47
+ [key: string]: string;
48
+ };
49
+ readonly id: string;
50
+ }>;
51
+ /**
52
+ * List features
53
+ * @param query - The query parameters
54
+ * @param signal - An optional abort signal
55
+ * @returns The features
56
+ */
57
+ list(query?: Omit<operations['listFeatures']['parameters']['query'], 'page' | 'pageSize'>, options?: RequestOptions): Promise<{
58
+ readonly createdAt: Date;
59
+ readonly updatedAt: Date;
60
+ readonly deletedAt?: Date;
61
+ readonly archivedAt?: Date;
62
+ key: string;
63
+ name: string;
64
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
65
+ meterSlug?: string;
66
+ meterGroupByFilters?: {
67
+ [key: string]: string;
68
+ };
69
+ readonly id: string;
70
+ }[]>;
71
+ /**
72
+ * Delete a feature by ID
73
+ * @param id - The ID of the feature
74
+ * @param signal - An optional abort signal
75
+ * @returns The deleted feature
76
+ */
77
+ delete(id: operations['deleteFeature']['parameters']['path']['featureId'], options?: RequestOptions): Promise<undefined>;
78
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/client/features.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAU9C;;;GAGG;AACH,MAAa,QAAQ;IACC;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,OAA4B,EAAE,OAAwB;QACxE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE;YACtD,IAAI,EAAE,OAAO;YACb,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,EAA+D,EAC/D,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,EAAE;YACjE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,SAAS,EAAE,EAAE;iBACd;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CACf,KAGC,EACD,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE;YACrD,MAAM,EAAE;gBACN,KAAK;aACN;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAc,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CACjB,EAAkE,EAClE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,8BAA8B,EAAE;YACpE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,SAAS,EAAE,EAAE;iBACd;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AApFD,4BAoFC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.OpenMeter = void 0;
40
+ const openapi_fetch_1 = __importStar(require("openapi-fetch"));
41
+ const apps_js_1 = require("./apps.cjs");
42
+ const billing_js_1 = require("./billing.cjs");
43
+ const customers_js_1 = require("./customers.cjs");
44
+ const entitlements_js_1 = require("./entitlements.cjs");
45
+ const events_js_1 = require("./events.cjs");
46
+ const features_js_1 = require("./features.cjs");
47
+ const meters_js_1 = require("./meters.cjs");
48
+ const notifications_js_1 = require("./notifications.cjs");
49
+ const plans_js_1 = require("./plans.cjs");
50
+ const portal_js_1 = require("./portal.cjs");
51
+ const subjects_js_1 = require("./subjects.cjs");
52
+ const subscriptions_js_1 = require("./subscriptions.cjs");
53
+ const utils_js_1 = require("./utils.cjs");
54
+ __exportStar(require("./schemas.cjs"), exports);
55
+ __exportStar(require("./common.cjs"), exports);
56
+ /**
57
+ * OpenMeter Client
58
+ */
59
+ class OpenMeter {
60
+ config;
61
+ client;
62
+ apps;
63
+ billing;
64
+ customers;
65
+ entitlements;
66
+ events;
67
+ features;
68
+ meters;
69
+ notifications;
70
+ plans;
71
+ portal;
72
+ subjects;
73
+ subscriptions;
74
+ constructor(config) {
75
+ this.config = config;
76
+ this.client = (0, openapi_fetch_1.default)({
77
+ ...config,
78
+ headers: {
79
+ ...config.headers,
80
+ Authorization: config.apiKey ? `Bearer ${config.apiKey}` : undefined,
81
+ },
82
+ querySerializer: (q) => (0, openapi_fetch_1.createQuerySerializer)({
83
+ array: {
84
+ explode: true,
85
+ style: 'form',
86
+ },
87
+ object: {
88
+ explode: true,
89
+ style: 'deepObject',
90
+ },
91
+ })((0, utils_js_1.encodeDates)(q)),
92
+ });
93
+ this.apps = new apps_js_1.Apps(this.client);
94
+ this.billing = new billing_js_1.Billing(this.client);
95
+ this.customers = new customers_js_1.Customers(this.client);
96
+ this.entitlements = new entitlements_js_1.Entitlements(this.client);
97
+ this.events = new events_js_1.Events(this.client);
98
+ this.features = new features_js_1.Features(this.client);
99
+ this.meters = new meters_js_1.Meters(this.client);
100
+ this.notifications = new notifications_js_1.Notifications(this.client);
101
+ this.plans = new plans_js_1.Plans(this.client);
102
+ this.portal = new portal_js_1.Portal(this.client);
103
+ this.subjects = new subjects_js_1.Subjects(this.client);
104
+ this.subscriptions = new subscriptions_js_1.Subscriptions(this.client);
105
+ }
106
+ }
107
+ exports.OpenMeter = OpenMeter;
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,45 @@
1
+ import { type Client, type ClientOptions } from 'openapi-fetch';
2
+ import { Apps } from './apps.cjs';
3
+ import { Billing } from './billing.cjs';
4
+ import { Customers } from './customers.cjs';
5
+ import { Entitlements } from './entitlements.cjs';
6
+ import { Events } from './events.cjs';
7
+ import { Features } from './features.cjs';
8
+ import { Meters } from './meters.cjs';
9
+ import { Notifications } from './notifications.cjs';
10
+ import { Plans } from './plans.cjs';
11
+ import { Portal } from './portal.cjs';
12
+ import { Subjects } from './subjects.cjs';
13
+ import { Subscriptions } from './subscriptions.cjs';
14
+ import type { paths } from './schemas.cjs';
15
+ export * from './schemas.cjs';
16
+ export * from './common.cjs';
17
+ /**
18
+ * OpenMeter Config
19
+ */
20
+ export type Config = Pick<ClientOptions, 'baseUrl' | 'headers' | 'fetch' | 'Request' | 'requestInitExt'> & ({
21
+ apiKey?: string;
22
+ } | {
23
+ baseUrl: 'https://openmeter.cloud';
24
+ apiKey: string;
25
+ });
26
+ /**
27
+ * OpenMeter Client
28
+ */
29
+ export declare class OpenMeter {
30
+ config: Config;
31
+ client: Client<paths, `${string}/${string}`>;
32
+ apps: Apps;
33
+ billing: Billing;
34
+ customers: Customers;
35
+ entitlements: Entitlements;
36
+ events: Events;
37
+ features: Features;
38
+ meters: Meters;
39
+ notifications: Notifications;
40
+ plans: Plans;
41
+ portal: Portal;
42
+ subjects: Subjects;
43
+ subscriptions: Subscriptions;
44
+ constructor(config: Config);
45
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAIsB;AACtB,uCAAgC;AAChC,6CAAsC;AACtC,iDAA0C;AAC1C,uDAAgD;AAChD,2CAAoC;AACpC,+CAAwC;AACxC,2CAAoC;AACpC,yDAAkD;AAClD,yCAAkC;AAClC,2CAAoC;AACpC,+CAAwC;AACxC,yDAAkD;AAClD,yCAAwC;AAGxC,+CAA4B;AAC5B,8CAA2B;AAmB3B;;GAEG;AACH,MAAa,SAAS;IAgBD;IAfZ,MAAM,CAAsC;IAE5C,IAAI,CAAM;IACV,OAAO,CAAS;IAChB,SAAS,CAAW;IACpB,YAAY,CAAc;IAC1B,MAAM,CAAQ;IACd,QAAQ,CAAU;IAClB,MAAM,CAAQ;IACd,aAAa,CAAe;IAC5B,KAAK,CAAO;IACZ,MAAM,CAAQ;IACd,QAAQ,CAAU;IAClB,aAAa,CAAe;IAEnC,YAAmB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAA,uBAAY,EAAQ;YAChC,GAAG,MAAM;YACT,OAAO,EAAE;gBACP,GAAG,MAAM,CAAC,OAAO;gBACjB,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;aACrE;YACD,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,CACrB,IAAA,qCAAqB,EAAC;gBACpB,KAAK,EAAE;oBACL,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,MAAM;iBACd;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,YAAY;iBACpB;aACF,CAAC,CAAC,IAAA,sBAAW,EAAC,CAAC,CAAC,CAAC;SACrB,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,GAAG,IAAI,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,oBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,CAAC,YAAY,GAAG,IAAI,8BAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,gCAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,gBAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,gCAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrD,CAAC;CACF;AAjDD,8BAiDC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Meters = void 0;
4
+ const utils_js_1 = require("./utils.cjs");
5
+ /**
6
+ * Meters
7
+ * @description Meters are used to track and manage usage of your application.
8
+ */
9
+ class Meters {
10
+ client;
11
+ constructor(client) {
12
+ this.client = client;
13
+ }
14
+ /**
15
+ * Create a meter
16
+ * @param meter - The meter to create
17
+ * @param signal - An optional abort signal
18
+ * @returns The created meter
19
+ */
20
+ async create(meter, options) {
21
+ const resp = await this.client.POST('/api/v1/meters', {
22
+ body: meter,
23
+ ...options,
24
+ });
25
+ return (0, utils_js_1.transformResponse)(resp);
26
+ }
27
+ /**
28
+ * Get a meter by ID or slug
29
+ * @param idOrSlug - The ID or slug of the meter
30
+ * @param signal - An optional abort signal
31
+ * @returns The meter
32
+ */
33
+ async get(idOrSlug, options) {
34
+ const resp = await this.client.GET('/api/v1/meters/{meterIdOrSlug}', {
35
+ params: {
36
+ path: {
37
+ meterIdOrSlug: idOrSlug,
38
+ },
39
+ },
40
+ ...options,
41
+ });
42
+ return (0, utils_js_1.transformResponse)(resp);
43
+ }
44
+ /**
45
+ * List meters
46
+ * @param signal - An optional abort signal
47
+ * @returns The meters
48
+ */
49
+ async list(options) {
50
+ const resp = await this.client.GET('/api/v1/meters', {
51
+ ...options,
52
+ });
53
+ return (0, utils_js_1.transformResponse)(resp);
54
+ }
55
+ /**
56
+ * Query usage data for a meter by ID or slug
57
+ * @param idOrSlug - The ID or slug of the meter
58
+ * @param query - The query parameters
59
+ * @param signal - An optional abort signal
60
+ * @returns The meter data
61
+ */
62
+ async query(idOrSlug, query, options) {
63
+ const resp = await this.client.GET('/api/v1/meters/{meterIdOrSlug}/query', {
64
+ headers: {
65
+ Accept: 'application/json',
66
+ },
67
+ params: {
68
+ path: {
69
+ meterIdOrSlug: idOrSlug,
70
+ },
71
+ query,
72
+ },
73
+ ...options,
74
+ });
75
+ return (0, utils_js_1.transformResponse)(resp);
76
+ }
77
+ /**
78
+ * Delete a meter by ID or slug
79
+ * @param idOrSlug - The ID or slug of the meter
80
+ * @param signal - An optional abort signal
81
+ * @returns The deleted meter
82
+ */
83
+ async delete(idOrSlug, options) {
84
+ const resp = await this.client.DELETE('/api/v1/meters/{meterIdOrSlug}', {
85
+ params: {
86
+ path: {
87
+ meterIdOrSlug: idOrSlug,
88
+ },
89
+ },
90
+ ...options,
91
+ });
92
+ return (0, utils_js_1.transformResponse)(resp);
93
+ }
94
+ }
95
+ exports.Meters = Meters;
96
+ //# sourceMappingURL=meters.js.map
@@ -0,0 +1,99 @@
1
+ import type { RequestOptions } from './common.cjs';
2
+ import type { MeterCreate, operations, paths } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Meters
6
+ * @description Meters are used to track and manage usage of your application.
7
+ */
8
+ export declare class Meters {
9
+ private client;
10
+ constructor(client: Client<paths, `${string}/${string}`>);
11
+ /**
12
+ * Create a meter
13
+ * @param meter - The meter to create
14
+ * @param signal - An optional abort signal
15
+ * @returns The created meter
16
+ */
17
+ create(meter: MeterCreate, options?: RequestOptions): Promise<{
18
+ readonly id: string;
19
+ description?: string;
20
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
21
+ readonly createdAt: Date;
22
+ readonly updatedAt: Date;
23
+ readonly deletedAt?: Date;
24
+ name?: string;
25
+ slug: string;
26
+ aggregation: import("./schemas.cjs").components["schemas"]["MeterAggregation"];
27
+ eventType: string;
28
+ eventFrom?: Date;
29
+ valueProperty?: string;
30
+ groupBy?: {
31
+ [key: string]: string;
32
+ };
33
+ }>;
34
+ /**
35
+ * Get a meter by ID or slug
36
+ * @param idOrSlug - The ID or slug of the meter
37
+ * @param signal - An optional abort signal
38
+ * @returns The meter
39
+ */
40
+ get(idOrSlug: operations['getMeter']['parameters']['path']['meterIdOrSlug'], options?: RequestOptions): Promise<{
41
+ readonly id: string;
42
+ description?: string;
43
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
44
+ readonly createdAt: Date;
45
+ readonly updatedAt: Date;
46
+ readonly deletedAt?: Date;
47
+ name?: string;
48
+ slug: string;
49
+ aggregation: import("./schemas.cjs").components["schemas"]["MeterAggregation"];
50
+ eventType: string;
51
+ eventFrom?: Date;
52
+ valueProperty?: string;
53
+ groupBy?: {
54
+ [key: string]: string;
55
+ };
56
+ }>;
57
+ /**
58
+ * List meters
59
+ * @param signal - An optional abort signal
60
+ * @returns The meters
61
+ */
62
+ list(options?: RequestOptions): Promise<{
63
+ readonly id: string;
64
+ description?: string;
65
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
66
+ readonly createdAt: Date;
67
+ readonly updatedAt: Date;
68
+ readonly deletedAt?: Date;
69
+ name?: string;
70
+ slug: string;
71
+ aggregation: import("./schemas.cjs").components["schemas"]["MeterAggregation"];
72
+ eventType: string;
73
+ eventFrom?: Date;
74
+ valueProperty?: string;
75
+ groupBy?: {
76
+ [key: string]: string;
77
+ };
78
+ }[]>;
79
+ /**
80
+ * Query usage data for a meter by ID or slug
81
+ * @param idOrSlug - The ID or slug of the meter
82
+ * @param query - The query parameters
83
+ * @param signal - An optional abort signal
84
+ * @returns The meter data
85
+ */
86
+ query(idOrSlug: operations['queryMeter']['parameters']['path']['meterIdOrSlug'], query?: operations['queryMeter']['parameters']['query'], options?: RequestOptions): Promise<{
87
+ from?: Date;
88
+ to?: Date;
89
+ windowSize?: import("./schemas.cjs").components["schemas"]["WindowSize"];
90
+ data: import("./schemas.cjs").components["schemas"]["MeterQueryRow"][];
91
+ }>;
92
+ /**
93
+ * Delete a meter by ID or slug
94
+ * @param idOrSlug - The ID or slug of the meter
95
+ * @param signal - An optional abort signal
96
+ * @returns The deleted meter
97
+ */
98
+ delete(idOrSlug: operations['deleteMeter']['parameters']['path']['meterIdOrSlug'], options?: RequestOptions): Promise<undefined>;
99
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meters.js","sourceRoot":"","sources":["../../../../src/client/meters.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C;;;GAGG;AACH,MAAa,MAAM;IACG;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,KAAkB,EAAE,OAAwB;QAC9D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACpD,IAAI,EAAE,KAAK;YACX,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,QAAuE,EACvE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE;YACnE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,aAAa,EAAE,QAAQ;iBACxB;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAAC,OAAwB;QACxC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE;YACnD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,KAAK,CAChB,QAAyE,EACzE,KAAuD,EACvD,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sCAAsC,EAAE;YACzE,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,aAAa,EAAE,QAAQ;iBACxB;gBACD,KAAK;aACN;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EACtB,IAAI,CAC0E,CAAA;IAClF,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CACjB,QAA0E,EAC1E,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gCAAgC,EAAE;YACtE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,aAAa,EAAE,QAAQ;iBACxB;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAxGD,wBAwGC"}
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationEvents = exports.NotificationRules = exports.NotificationChannels = exports.Notifications = void 0;
4
+ const utils_js_1 = require("./utils.cjs");
5
+ /**
6
+ * Notifications
7
+ * @description Notifications provide automated triggers when specific entitlement balances and usage thresholds are reached, ensuring that your customers and sales teams are always informed. Notify customers and internal teams when specific conditions are met, like reaching 75%, 100%, and 150% of their monthly usage allowance.
8
+ */
9
+ class Notifications {
10
+ client;
11
+ channels;
12
+ rules;
13
+ events;
14
+ constructor(client) {
15
+ this.client = client;
16
+ this.channels = new NotificationChannels(this.client);
17
+ this.rules = new NotificationRules(this.client);
18
+ this.events = new NotificationEvents(this.client);
19
+ }
20
+ }
21
+ exports.Notifications = Notifications;
22
+ /**
23
+ * Notification Channels
24
+ * @description Notification channels are the destinations for notifications.
25
+ */
26
+ class NotificationChannels {
27
+ client;
28
+ constructor(client) {
29
+ this.client = client;
30
+ }
31
+ /**
32
+ * Create a notification channel
33
+ * @param notification - The notification to create
34
+ * @param signal - An optional abort signal
35
+ * @returns The created notification
36
+ */
37
+ async create(notification, options) {
38
+ const resp = await this.client.POST('/api/v1/notification/channels', {
39
+ body: notification,
40
+ ...options,
41
+ });
42
+ return (0, utils_js_1.transformResponse)(resp);
43
+ }
44
+ /**
45
+ * Get a notification channel by ID
46
+ * @param id - The ID of the notification channel
47
+ * @param signal - An optional abort signal
48
+ * @returns The notification channel
49
+ */
50
+ async get(id, options) {
51
+ const resp = await this.client.GET('/api/v1/notification/channels/{channelId}', {
52
+ params: {
53
+ path: {
54
+ channelId: id,
55
+ },
56
+ },
57
+ ...options,
58
+ });
59
+ return (0, utils_js_1.transformResponse)(resp);
60
+ }
61
+ /**
62
+ * Update a notification channel
63
+ * @param id - The ID of the notification channel
64
+ * @param notification - The notification to update
65
+ * @param signal - An optional abort signal
66
+ * @returns The updated notification
67
+ */
68
+ async update(id, notification, options) {
69
+ const resp = await this.client.PUT('/api/v1/notification/channels/{channelId}', {
70
+ body: notification,
71
+ params: {
72
+ path: {
73
+ channelId: id,
74
+ },
75
+ },
76
+ ...options,
77
+ });
78
+ return (0, utils_js_1.transformResponse)(resp);
79
+ }
80
+ /**
81
+ * List notification channels
82
+ * @param query - The query parameters
83
+ * @param signal - An optional abort signal
84
+ * @returns The list of notification channels
85
+ */
86
+ async list(query, options) {
87
+ const resp = await this.client.GET('/api/v1/notification/channels', {
88
+ params: {
89
+ query,
90
+ },
91
+ ...options,
92
+ });
93
+ return (0, utils_js_1.transformResponse)(resp);
94
+ }
95
+ /**
96
+ * Delete a notification channel
97
+ * @param id - The ID of the notification channel
98
+ * @param signal - An optional abort signal
99
+ * @returns The deleted notification
100
+ */
101
+ async delete(id, options) {
102
+ const resp = await this.client.DELETE('/api/v1/notification/channels/{channelId}', {
103
+ params: {
104
+ path: {
105
+ channelId: id,
106
+ },
107
+ },
108
+ ...options,
109
+ });
110
+ return (0, utils_js_1.transformResponse)(resp);
111
+ }
112
+ }
113
+ exports.NotificationChannels = NotificationChannels;
114
+ /**
115
+ * Notification Rules
116
+ * @description Notification rules are the conditions that trigger notifications.
117
+ */
118
+ class NotificationRules {
119
+ client;
120
+ constructor(client) {
121
+ this.client = client;
122
+ }
123
+ /**
124
+ * Create a notification rule
125
+ * @param rule - The rule to create
126
+ * @param signal - An optional abort signal
127
+ * @returns The created rule
128
+ */
129
+ async create(rule, options) {
130
+ const resp = await this.client.POST('/api/v1/notification/rules', {
131
+ body: rule,
132
+ ...options,
133
+ });
134
+ return (0, utils_js_1.transformResponse)(resp);
135
+ }
136
+ /**
137
+ * Get a notification rule by ID
138
+ * @param id - The ID of the notification rule
139
+ * @param signal - An optional abort signal
140
+ * @returns The notification rule
141
+ */
142
+ async get(id, options) {
143
+ const resp = await this.client.GET('/api/v1/notification/rules/{ruleId}', {
144
+ params: {
145
+ path: {
146
+ ruleId: id,
147
+ },
148
+ },
149
+ ...options,
150
+ });
151
+ return (0, utils_js_1.transformResponse)(resp);
152
+ }
153
+ /**
154
+ * Update a notification rule
155
+ * @param id - The ID of the notification rule
156
+ * @param rule - The rule to update
157
+ * @param signal - An optional abort signal
158
+ * @returns The updated rule
159
+ */
160
+ async update(id, rule, options) {
161
+ const resp = await this.client.PUT('/api/v1/notification/rules/{ruleId}', {
162
+ body: rule,
163
+ params: {
164
+ path: {
165
+ ruleId: id,
166
+ },
167
+ },
168
+ ...options,
169
+ });
170
+ return (0, utils_js_1.transformResponse)(resp);
171
+ }
172
+ /**
173
+ * List notification rules
174
+ * @param query - The query parameters
175
+ * @param signal - An optional abort signal
176
+ * @returns The list of notification rules
177
+ */
178
+ async list(query, options) {
179
+ const resp = await this.client.GET('/api/v1/notification/rules', {
180
+ params: {
181
+ query,
182
+ },
183
+ ...options,
184
+ });
185
+ return (0, utils_js_1.transformResponse)(resp);
186
+ }
187
+ /**
188
+ * Delete a notification rule
189
+ * @param id - The ID of the notification rule
190
+ * @param signal - An optional abort signal
191
+ * @returns The deleted notification
192
+ */
193
+ async delete(id, options) {
194
+ const resp = await this.client.DELETE('/api/v1/notification/rules/{ruleId}', {
195
+ params: {
196
+ path: {
197
+ ruleId: id,
198
+ },
199
+ },
200
+ ...options,
201
+ });
202
+ return (0, utils_js_1.transformResponse)(resp);
203
+ }
204
+ }
205
+ exports.NotificationRules = NotificationRules;
206
+ /**
207
+ * Notification Events
208
+ * @description Notification events are the events that trigger notifications.
209
+ */
210
+ class NotificationEvents {
211
+ client;
212
+ constructor(client) {
213
+ this.client = client;
214
+ }
215
+ /**
216
+ * Get a notification event by ID
217
+ * @param id - The ID of the notification event
218
+ * @param signal - An optional abort signal
219
+ * @returns The notification event
220
+ */
221
+ async get(id, options) {
222
+ const resp = await this.client.GET('/api/v1/notification/events/{eventId}', {
223
+ params: {
224
+ path: {
225
+ eventId: id,
226
+ },
227
+ },
228
+ ...options,
229
+ });
230
+ return (0, utils_js_1.transformResponse)(resp);
231
+ }
232
+ /**
233
+ * List notification events
234
+ * @param query - The query parameters
235
+ * @param signal - An optional abort signal
236
+ * @returns The list of notification events
237
+ */
238
+ async list(query, options) {
239
+ const resp = await this.client.GET('/api/v1/notification/events', {
240
+ params: {
241
+ query,
242
+ },
243
+ ...options,
244
+ });
245
+ return (0, utils_js_1.transformResponse)(resp);
246
+ }
247
+ }
248
+ exports.NotificationEvents = NotificationEvents;
249
+ //# sourceMappingURL=notifications.js.map