@openmeter/sdk 1.0.0-beta.6 → 1.0.0-beta.60
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 +76 -1
- package/dist/clients/client.d.ts +1 -1
- package/dist/clients/client.js +8 -1
- package/dist/clients/event.d.ts +16 -2
- package/dist/clients/event.js +39 -18
- package/dist/clients/meter.d.ts +12 -32
- package/dist/clients/meter.js +0 -15
- package/dist/clients/portal.d.ts +22 -0
- package/dist/clients/portal.js +36 -0
- package/dist/clients/subject.d.ts +27 -0
- package/dist/clients/subject.js +55 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +7 -1
- package/dist/schemas/openapi.d.ts +702 -220
- package/dist/test/agent.js +119 -28
- package/dist/test/mocks.d.ts +4 -1
- package/dist/test/mocks.js +19 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +8 -7
- package/package.json +30 -31
|
@@ -3,50 +3,137 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
export interface paths {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
6
|
+
'/api/v1/events': {
|
|
7
|
+
/**
|
|
8
|
+
* List ingested events
|
|
9
|
+
* @description List ingested events within a time range.
|
|
10
|
+
*/
|
|
11
|
+
get: operations['listEvents'];
|
|
12
|
+
/**
|
|
13
|
+
* Ingest events
|
|
14
|
+
* @description Ingests an event or batch of events following the CloudEvents specification.
|
|
15
|
+
*/
|
|
16
|
+
post: operations['ingestEvents'];
|
|
17
|
+
};
|
|
18
|
+
'/api/v1/meters': {
|
|
19
|
+
/**
|
|
20
|
+
* List meters
|
|
21
|
+
* @description List meters.
|
|
22
|
+
*/
|
|
23
|
+
get: operations['listMeters'];
|
|
24
|
+
/**
|
|
25
|
+
* ☁ Create meter
|
|
26
|
+
* @description *Available in OpenMeter Cloud.*
|
|
27
|
+
* *In the open-source version, meters are created in the configuration file.*
|
|
28
|
+
*
|
|
29
|
+
* Create a meter.
|
|
30
|
+
*/
|
|
31
|
+
post: operations['createMeter'];
|
|
32
|
+
};
|
|
33
|
+
'/api/v1/meters/{meterIdOrSlug}': {
|
|
34
|
+
/**
|
|
35
|
+
* Get meter
|
|
36
|
+
* @description Get meter by ID or slug
|
|
37
|
+
*/
|
|
38
|
+
get: operations['getMeter'];
|
|
39
|
+
/**
|
|
40
|
+
* ☁ Delete meter
|
|
41
|
+
* @description *Available in OpenMeter Cloud.*
|
|
42
|
+
*
|
|
43
|
+
* Delete a meter by ID or slug.
|
|
44
|
+
*/
|
|
45
|
+
delete: operations['deleteMeter'];
|
|
46
|
+
};
|
|
47
|
+
'/api/v1/meters/{meterIdOrSlug}/query': {
|
|
48
|
+
/**
|
|
49
|
+
* Query meter
|
|
50
|
+
* @description Query meter for usage.
|
|
51
|
+
*/
|
|
52
|
+
get: operations['queryMeter'];
|
|
9
53
|
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
54
|
+
'/api/v1/meters/{meterIdOrSlug}/subjects': {
|
|
55
|
+
/**
|
|
56
|
+
* List meter subjects
|
|
57
|
+
* @description List subjects for a meter.
|
|
58
|
+
*/
|
|
59
|
+
get: operations['listMeterSubjects'];
|
|
15
60
|
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
61
|
+
'/api/v1/portal/tokens': {
|
|
62
|
+
/**
|
|
63
|
+
* ☁ List portal tokens
|
|
64
|
+
* @description *Available in OpenMeter Cloud.*
|
|
65
|
+
*
|
|
66
|
+
* List consumer portal tokens.
|
|
67
|
+
*/
|
|
68
|
+
get: operations['listPortalTokens'];
|
|
69
|
+
/**
|
|
70
|
+
* Create portal token
|
|
71
|
+
* @description Create a consumer portal token.
|
|
72
|
+
*/
|
|
73
|
+
post: operations['createPortalToken'];
|
|
21
74
|
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
75
|
+
'/api/v1/portal/tokens/invalidate': {
|
|
76
|
+
/**
|
|
77
|
+
* ☁ Invalidate portal tokens
|
|
78
|
+
* @description *Available in OpenMeter Cloud.*
|
|
79
|
+
*
|
|
80
|
+
* Invalidates consumer portal tokens by ID or subject.
|
|
81
|
+
*/
|
|
82
|
+
post: operations['invalidatePortalTokens'];
|
|
25
83
|
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
84
|
+
'/api/v1/subjects': {
|
|
85
|
+
/**
|
|
86
|
+
* ☁ List subjects
|
|
87
|
+
* @description *Available in OpenMeter Cloud.*
|
|
88
|
+
*
|
|
89
|
+
* List subjects.
|
|
90
|
+
*/
|
|
91
|
+
get: operations['listSubjects'];
|
|
92
|
+
/**
|
|
93
|
+
* ☁ Upsert subject
|
|
94
|
+
* @description *Available in OpenMeter Cloud.*
|
|
95
|
+
*
|
|
96
|
+
* Upserts a subject. Creates or updates subject.
|
|
97
|
+
* If the subject doesn't exist, it will be created.
|
|
98
|
+
* If the subject exists, it will be partially updated with the provided fields.
|
|
99
|
+
*/
|
|
100
|
+
post: operations['upsertSubject'];
|
|
29
101
|
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
102
|
+
'/api/v1/subjects/{subjectIdOrKey}': {
|
|
103
|
+
/**
|
|
104
|
+
* ☁ Get subject
|
|
105
|
+
* @description *Available in OpenMeter Cloud.*
|
|
106
|
+
*
|
|
107
|
+
* Get subject by ID or key.
|
|
108
|
+
*/
|
|
109
|
+
get: operations['getSubject'];
|
|
110
|
+
/**
|
|
111
|
+
* ☁ Delete subject
|
|
112
|
+
* @description *Available in OpenMeter Cloud.*
|
|
113
|
+
*
|
|
114
|
+
* Delete a subject by ID or key.
|
|
115
|
+
*/
|
|
116
|
+
delete: operations['deleteSubject'];
|
|
33
117
|
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
118
|
+
'/api/v1/portal/meters/{meterSlug}/query': {
|
|
119
|
+
/**
|
|
120
|
+
* Query portal meter
|
|
121
|
+
* @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
|
|
122
|
+
*/
|
|
123
|
+
get: operations['queryPortalMeter'];
|
|
37
124
|
};
|
|
38
125
|
}
|
|
39
126
|
export type webhooks = Record<string, never>;
|
|
40
127
|
export interface components {
|
|
41
128
|
schemas: {
|
|
42
129
|
/**
|
|
43
|
-
* @description A Problem Details object (RFC 7807)
|
|
130
|
+
* @description A Problem Details object (RFC 7807).
|
|
131
|
+
* Additional properties specific to the problem type may be present.
|
|
44
132
|
* @example {
|
|
45
133
|
* "type": "urn:problem-type:bad-request",
|
|
46
134
|
* "title": "Bad Request",
|
|
47
135
|
* "status": 400,
|
|
48
|
-
* "detail": "
|
|
49
|
-
* "instance": "urn:request:local/JMOlctsKV8-000001"
|
|
136
|
+
* "detail": "body must be a JSON object"
|
|
50
137
|
* }
|
|
51
138
|
*/
|
|
52
139
|
Problem: {
|
|
@@ -69,7 +156,7 @@ export interface components {
|
|
|
69
156
|
status: number;
|
|
70
157
|
/**
|
|
71
158
|
* @description A human-readable explanation specific to this occurrence of the problem.
|
|
72
|
-
* @example
|
|
159
|
+
* @example body must be a JSON object
|
|
73
160
|
*/
|
|
74
161
|
detail: string;
|
|
75
162
|
/**
|
|
@@ -80,7 +167,22 @@ export interface components {
|
|
|
80
167
|
instance?: string;
|
|
81
168
|
[key: string]: unknown;
|
|
82
169
|
};
|
|
83
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* @description CloudEvents Specification JSON Schema
|
|
172
|
+
* @example {
|
|
173
|
+
* "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
|
|
174
|
+
* "source": "service-name",
|
|
175
|
+
* "specversion": "1.0",
|
|
176
|
+
* "type": "prompt",
|
|
177
|
+
* "subject": "customer-id",
|
|
178
|
+
* "time": "2023-01-01T01:01:01.001Z",
|
|
179
|
+
* "data": {
|
|
180
|
+
* "tokens": "1234",
|
|
181
|
+
* "model": "gpt-4-turbo",
|
|
182
|
+
* "type": "input"
|
|
183
|
+
* }
|
|
184
|
+
* }
|
|
185
|
+
*/
|
|
84
186
|
Event: {
|
|
85
187
|
/**
|
|
86
188
|
* @description Identifies the event.
|
|
@@ -90,7 +192,7 @@ export interface components {
|
|
|
90
192
|
/**
|
|
91
193
|
* Format: uri-reference
|
|
92
194
|
* @description Identifies the context in which an event happened.
|
|
93
|
-
* @example
|
|
195
|
+
* @example service-name
|
|
94
196
|
*/
|
|
95
197
|
source: string;
|
|
96
198
|
/**
|
|
@@ -100,7 +202,7 @@ export interface components {
|
|
|
100
202
|
specversion: string;
|
|
101
203
|
/**
|
|
102
204
|
* @description Describes the type of event related to the originating occurrence.
|
|
103
|
-
* @example
|
|
205
|
+
* @example prompt
|
|
104
206
|
*/
|
|
105
207
|
type: string;
|
|
106
208
|
/**
|
|
@@ -108,7 +210,7 @@ export interface components {
|
|
|
108
210
|
* @example application/json
|
|
109
211
|
* @enum {string|null}
|
|
110
212
|
*/
|
|
111
|
-
datacontenttype?:
|
|
213
|
+
datacontenttype?: 'application/json' | null;
|
|
112
214
|
/**
|
|
113
215
|
* Format: uri
|
|
114
216
|
* @description Identifies the schema that data adheres to.
|
|
@@ -116,7 +218,7 @@ export interface components {
|
|
|
116
218
|
dataschema?: string | null;
|
|
117
219
|
/**
|
|
118
220
|
* @description Describes the subject of the event in the context of the event producer (identified by source).
|
|
119
|
-
* @example
|
|
221
|
+
* @example customer-id
|
|
120
222
|
*/
|
|
121
223
|
subject: string;
|
|
122
224
|
/**
|
|
@@ -128,14 +230,52 @@ export interface components {
|
|
|
128
230
|
/**
|
|
129
231
|
* @description The event payload.
|
|
130
232
|
* @example {
|
|
131
|
-
* "
|
|
132
|
-
* "
|
|
233
|
+
* "tokens": "1234",
|
|
234
|
+
* "model": "gpt-4-turbo"
|
|
133
235
|
* }
|
|
134
236
|
*/
|
|
135
237
|
data?: {
|
|
136
238
|
[key: string]: unknown;
|
|
137
239
|
};
|
|
138
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* @description An ingested event with optional validation error.
|
|
243
|
+
* @example {
|
|
244
|
+
* "event": {
|
|
245
|
+
* "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3d",
|
|
246
|
+
* "source": "service-name",
|
|
247
|
+
* "specversion": "1.0",
|
|
248
|
+
* "type": "prompt",
|
|
249
|
+
* "subject": "customer-id",
|
|
250
|
+
* "time": "2023-01-01T01:01:01.001Z",
|
|
251
|
+
* "data": {
|
|
252
|
+
* "tokens": "1234",
|
|
253
|
+
* "model": "gpt-4-turbo"
|
|
254
|
+
* }
|
|
255
|
+
* },
|
|
256
|
+
* "validationError": "meter not found for event"
|
|
257
|
+
* }
|
|
258
|
+
*/
|
|
259
|
+
IngestedEvent: {
|
|
260
|
+
event: components['schemas']['Event'];
|
|
261
|
+
/** @example invalid event */
|
|
262
|
+
validationError?: string;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* @description A meter is a configuration that defines how to match and aggregate events.
|
|
266
|
+
* @example {
|
|
267
|
+
* "slug": "tokens_total",
|
|
268
|
+
* "description": "AI token usage",
|
|
269
|
+
* "aggregation": "SUM",
|
|
270
|
+
* "windowSize": "MINUTE",
|
|
271
|
+
* "eventType": "prompt",
|
|
272
|
+
* "valueProperty": "$.tokens",
|
|
273
|
+
* "groupBy": {
|
|
274
|
+
* "model": "$.model",
|
|
275
|
+
* "type": "$.type"
|
|
276
|
+
* }
|
|
277
|
+
* }
|
|
278
|
+
*/
|
|
139
279
|
Meter: {
|
|
140
280
|
/**
|
|
141
281
|
* @description A unique identifier for the meter.
|
|
@@ -143,363 +283,705 @@ export interface components {
|
|
|
143
283
|
*/
|
|
144
284
|
id?: string;
|
|
145
285
|
/**
|
|
146
|
-
* @description A unique identifier for the meter.
|
|
147
|
-
* @example
|
|
286
|
+
* @description A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.
|
|
287
|
+
* @example tokens_total
|
|
148
288
|
*/
|
|
149
289
|
slug: string;
|
|
150
290
|
/**
|
|
151
291
|
* @description A description of the meter.
|
|
152
|
-
* @example
|
|
292
|
+
* @example AI Token Usage
|
|
153
293
|
*/
|
|
154
294
|
description?: string | null;
|
|
155
|
-
aggregation: components[
|
|
295
|
+
aggregation: components['schemas']['MeterAggregation'];
|
|
296
|
+
windowSize: components['schemas']['WindowSize'];
|
|
156
297
|
/**
|
|
157
298
|
* @description The event type to aggregate.
|
|
158
|
-
* @example
|
|
299
|
+
* @example prompt
|
|
159
300
|
*/
|
|
160
301
|
eventType: string;
|
|
161
302
|
/**
|
|
162
303
|
* @description JSONPath expression to extract the value from the event data.
|
|
163
|
-
* @example $.
|
|
304
|
+
* @example $.tokens
|
|
164
305
|
*/
|
|
165
306
|
valueProperty?: string;
|
|
166
307
|
/**
|
|
167
|
-
* @description Named JSONPath expressions to extract the group by values from the event data.
|
|
308
|
+
* @description Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters.
|
|
168
309
|
* @example {
|
|
169
|
-
* "
|
|
170
|
-
* "
|
|
310
|
+
* "model": "$.model",
|
|
311
|
+
* "type": "$.type"
|
|
171
312
|
* }
|
|
172
313
|
*/
|
|
173
314
|
groupBy?: {
|
|
174
315
|
[key: string]: string;
|
|
175
316
|
};
|
|
176
|
-
windowSize: components["schemas"]["WindowSize"];
|
|
177
317
|
};
|
|
178
318
|
/**
|
|
179
319
|
* @description The aggregation type to use for the meter.
|
|
320
|
+
* @example SUM
|
|
180
321
|
* @enum {string}
|
|
181
322
|
*/
|
|
182
|
-
MeterAggregation:
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
323
|
+
MeterAggregation: 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX';
|
|
324
|
+
/**
|
|
325
|
+
* @description Aggregation window size.
|
|
326
|
+
* @example MINUTE
|
|
327
|
+
* @enum {string}
|
|
328
|
+
*/
|
|
329
|
+
WindowSize: 'MINUTE' | 'HOUR' | 'DAY';
|
|
330
|
+
/**
|
|
331
|
+
* @description The result of a meter query.
|
|
332
|
+
* @example {
|
|
333
|
+
* "from": "2023-01-01T00:00:00Z",
|
|
334
|
+
* "to": "2023-01-02T00:00:00Z",
|
|
335
|
+
* "windowSize": "MINUTE",
|
|
336
|
+
* "data": [
|
|
337
|
+
* {
|
|
338
|
+
* "value": 12,
|
|
339
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
340
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
341
|
+
* "subject": "customer-id",
|
|
342
|
+
* "groupBy": {
|
|
343
|
+
* "model": "gpt-4-turbo",
|
|
344
|
+
* "type": "prompt"
|
|
345
|
+
* }
|
|
346
|
+
* }
|
|
347
|
+
* ]
|
|
348
|
+
* }
|
|
349
|
+
*/
|
|
350
|
+
MeterQueryResult: {
|
|
351
|
+
/**
|
|
352
|
+
* Format: date-time
|
|
353
|
+
* @example 2023-01-01T00:00:00Z
|
|
354
|
+
*/
|
|
355
|
+
from?: string;
|
|
356
|
+
/**
|
|
357
|
+
* Format: date-time
|
|
358
|
+
* @example 2023-01-02T00:00:00Z
|
|
359
|
+
*/
|
|
360
|
+
to?: string;
|
|
361
|
+
windowSize?: components['schemas']['WindowSize'];
|
|
362
|
+
/**
|
|
363
|
+
* @example [
|
|
364
|
+
* {
|
|
365
|
+
* "value": 12,
|
|
366
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
367
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
368
|
+
* "subject": "customer-id",
|
|
369
|
+
* "groupBy": {
|
|
370
|
+
* "model": "gpt-4-turbo",
|
|
371
|
+
* "type": "prompt"
|
|
372
|
+
* }
|
|
373
|
+
* }
|
|
374
|
+
* ]
|
|
375
|
+
*/
|
|
376
|
+
data: components['schemas']['MeterQueryRow'][];
|
|
196
377
|
};
|
|
378
|
+
/**
|
|
379
|
+
* @description A row in the result of a meter query.
|
|
380
|
+
* @example {
|
|
381
|
+
* "value": 12,
|
|
382
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
383
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
384
|
+
* "subject": "customer-id",
|
|
385
|
+
* "groupBy": {
|
|
386
|
+
* "model": "gpt-4-turbo",
|
|
387
|
+
* "type": "prompt"
|
|
388
|
+
* }
|
|
389
|
+
* }
|
|
390
|
+
*/
|
|
197
391
|
MeterQueryRow: {
|
|
392
|
+
/** @example 12 */
|
|
198
393
|
value: number;
|
|
199
|
-
/**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
394
|
+
/**
|
|
395
|
+
* Format: date-time
|
|
396
|
+
* @example 2023-01-01T00:00:00Z
|
|
397
|
+
*/
|
|
398
|
+
windowStart: string;
|
|
399
|
+
/**
|
|
400
|
+
* Format: date-time
|
|
401
|
+
* @example 2023-01-02T00:00:00Z
|
|
402
|
+
*/
|
|
403
|
+
windowEnd: string;
|
|
404
|
+
/**
|
|
405
|
+
* @description The subject of the meter value.
|
|
406
|
+
* @example customer-id
|
|
407
|
+
*/
|
|
204
408
|
subject?: string | null;
|
|
409
|
+
/**
|
|
410
|
+
* @example {
|
|
411
|
+
* "model": "gpt-4-turbo",
|
|
412
|
+
* "type": "prompt"
|
|
413
|
+
* }
|
|
414
|
+
*/
|
|
205
415
|
groupBy?: {
|
|
206
416
|
[key: string]: string;
|
|
207
417
|
} | null;
|
|
208
418
|
};
|
|
209
|
-
|
|
210
|
-
|
|
419
|
+
/**
|
|
420
|
+
* @description A consumer portal token.
|
|
421
|
+
* @example {
|
|
422
|
+
* "id": "01G65Z755AFWAKHE12NY0CQ9FH",
|
|
423
|
+
* "subject": "customer-id",
|
|
424
|
+
* "expiresAt": "2023-01-02T00:00:00Z",
|
|
425
|
+
* "expired": false,
|
|
426
|
+
* "createdAt": "2023-01-01T00:00:00Z",
|
|
427
|
+
* "token": "om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo",
|
|
428
|
+
* "allowedMeterSlugs": [
|
|
429
|
+
* "tokens_total"
|
|
430
|
+
* ]
|
|
431
|
+
* }
|
|
432
|
+
*/
|
|
433
|
+
PortalToken: {
|
|
434
|
+
/** @example 01G65Z755AFWAKHE12NY0CQ9FH */
|
|
435
|
+
id?: string;
|
|
436
|
+
/** @example customer-id */
|
|
437
|
+
subject: string;
|
|
438
|
+
/**
|
|
439
|
+
* Format: date-time
|
|
440
|
+
* @example 2023-01-02T00:00:00Z
|
|
441
|
+
*/
|
|
442
|
+
expiresAt?: string;
|
|
443
|
+
expired?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Format: date-time
|
|
446
|
+
* @example 2023-01-01T00:00:00Z
|
|
447
|
+
*/
|
|
448
|
+
createdAt?: string;
|
|
449
|
+
/**
|
|
450
|
+
* @description The token is only returned at creation.
|
|
451
|
+
* @example om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo
|
|
452
|
+
*/
|
|
453
|
+
token?: string;
|
|
454
|
+
/**
|
|
455
|
+
* @description Optional, if defined only the specified meters will be allowed
|
|
456
|
+
* @example [
|
|
457
|
+
* "tokens_total"
|
|
458
|
+
* ]
|
|
459
|
+
*/
|
|
460
|
+
allowedMeterSlugs?: string[];
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* @description A subject is a unique identifier for a user or entity.
|
|
464
|
+
* @example {
|
|
465
|
+
* "id": "01G65Z755AFWAKHE12NY0CQ9FH",
|
|
466
|
+
* "key": "customer-id",
|
|
467
|
+
* "displayName": "Customer Name",
|
|
468
|
+
* "metadata": {
|
|
469
|
+
* "hubspotId": "123456"
|
|
470
|
+
* },
|
|
471
|
+
* "currentPeriodStart": "2023-01-01T00:00:00Z",
|
|
472
|
+
* "currentPeriodEnd": "2023-02-01T00:00:00Z",
|
|
473
|
+
* "stripeCustomerId": "cus_JMOlctsKV8"
|
|
474
|
+
* }
|
|
475
|
+
*/
|
|
476
|
+
Subject: {
|
|
477
|
+
/** @example 01G65Z755AFWAKHE12NY0CQ9FH */
|
|
478
|
+
id?: string;
|
|
479
|
+
/** @example customer-id */
|
|
480
|
+
key: string;
|
|
481
|
+
/** @example Customer Name */
|
|
482
|
+
displayName?: string | null;
|
|
483
|
+
/**
|
|
484
|
+
* @example {
|
|
485
|
+
* "hubspotId": "123456"
|
|
486
|
+
* }
|
|
487
|
+
*/
|
|
488
|
+
metadata?: {
|
|
489
|
+
[key: string]: unknown;
|
|
490
|
+
} | null;
|
|
491
|
+
/**
|
|
492
|
+
* Format: date-time
|
|
493
|
+
* @example 2023-01-01T00:00:00Z
|
|
494
|
+
*/
|
|
495
|
+
currentPeriodStart?: string | null;
|
|
211
496
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
497
|
+
* Format: date-time
|
|
498
|
+
* @example 2023-02-01T00:00:00Z
|
|
214
499
|
*/
|
|
215
|
-
|
|
500
|
+
currentPeriodEnd?: string | null;
|
|
501
|
+
/** @example cus_JMOlctsKV8 */
|
|
502
|
+
stripeCustomerId?: string | null;
|
|
216
503
|
};
|
|
504
|
+
/**
|
|
505
|
+
* @description A unique identifier.
|
|
506
|
+
* @example tokens_total
|
|
507
|
+
*/
|
|
508
|
+
IdOrSlug: string;
|
|
217
509
|
};
|
|
218
510
|
responses: {
|
|
219
511
|
/** @description Bad Request */
|
|
220
512
|
BadRequestProblemResponse: {
|
|
221
513
|
content: {
|
|
222
|
-
|
|
514
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
223
515
|
};
|
|
224
516
|
};
|
|
225
|
-
/** @description
|
|
226
|
-
|
|
517
|
+
/** @description Unauthorized */
|
|
518
|
+
UnauthorizedProblemResponse: {
|
|
227
519
|
content: {
|
|
228
|
-
|
|
520
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
229
521
|
};
|
|
230
522
|
};
|
|
231
523
|
/** @description Not Found */
|
|
232
524
|
NotFoundProblemResponse: {
|
|
233
525
|
content: {
|
|
234
|
-
|
|
526
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
235
527
|
};
|
|
236
528
|
};
|
|
237
529
|
/** @description Not Implemented */
|
|
238
530
|
NotImplementedProblemResponse: {
|
|
239
531
|
content: {
|
|
240
|
-
|
|
532
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
241
533
|
};
|
|
242
534
|
};
|
|
243
535
|
/** @description Unexpected error */
|
|
244
536
|
UnexpectedProblemResponse: {
|
|
245
537
|
content: {
|
|
246
|
-
|
|
538
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
247
539
|
};
|
|
248
540
|
};
|
|
249
541
|
};
|
|
250
542
|
parameters: {
|
|
251
543
|
/** @description A unique identifier for the meter. */
|
|
252
|
-
meterIdOrSlug: components[
|
|
253
|
-
/** @description
|
|
254
|
-
|
|
544
|
+
meterIdOrSlug: components['schemas']['IdOrSlug'];
|
|
545
|
+
/** @description A unique identifier for a subject. */
|
|
546
|
+
subjectIdOrKey: string;
|
|
547
|
+
/**
|
|
548
|
+
* @description Start date-time in RFC 3339 format.
|
|
549
|
+
* Inclusive.
|
|
550
|
+
*/
|
|
551
|
+
queryFrom?: string;
|
|
552
|
+
/**
|
|
553
|
+
* @description End date-time in RFC 3339 format.
|
|
554
|
+
* Inclusive.
|
|
555
|
+
*/
|
|
556
|
+
queryTo?: string;
|
|
557
|
+
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
558
|
+
queryWindowSize?: components['schemas']['WindowSize'];
|
|
559
|
+
/**
|
|
560
|
+
* @description The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
|
|
561
|
+
* If not specified, the UTC timezone will be used.
|
|
562
|
+
*/
|
|
563
|
+
queryWindowTimeZone?: string;
|
|
564
|
+
/**
|
|
565
|
+
* @description Filtering and group by multiple subjects.
|
|
566
|
+
* Usage: ?subject=customer-1&subject=customer-2
|
|
567
|
+
*/
|
|
568
|
+
queryFilterSubject?: string[];
|
|
569
|
+
queryFilterGroupBy?: {
|
|
570
|
+
[key: string]: string;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* @description If not specified a single aggregate will be returned for each subject and time window.
|
|
574
|
+
* `subject` is a reserved group by value.
|
|
575
|
+
*/
|
|
576
|
+
queryGroupBy?: string[];
|
|
255
577
|
};
|
|
256
578
|
requestBodies: never;
|
|
257
579
|
headers: never;
|
|
258
580
|
pathItems: never;
|
|
259
581
|
}
|
|
582
|
+
export type $defs = Record<string, never>;
|
|
260
583
|
export type external = Record<string, never>;
|
|
261
584
|
export interface operations {
|
|
262
|
-
/**
|
|
263
|
-
|
|
585
|
+
/**
|
|
586
|
+
* List ingested events
|
|
587
|
+
* @description List ingested events within a time range.
|
|
588
|
+
*/
|
|
589
|
+
listEvents: {
|
|
264
590
|
parameters: {
|
|
265
|
-
|
|
266
|
-
|
|
591
|
+
query?: {
|
|
592
|
+
from?: components['parameters']['queryFrom'];
|
|
593
|
+
to?: components['parameters']['queryTo'];
|
|
594
|
+
/** @description Number of events to return */
|
|
595
|
+
limit?: number;
|
|
267
596
|
};
|
|
268
597
|
};
|
|
598
|
+
responses: {
|
|
599
|
+
/** @description List of events for debugging. */
|
|
600
|
+
200: {
|
|
601
|
+
content: {
|
|
602
|
+
'application/json': components['schemas']['IngestedEvent'][];
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
606
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
607
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* Ingest events
|
|
612
|
+
* @description Ingests an event or batch of events following the CloudEvents specification.
|
|
613
|
+
*/
|
|
614
|
+
ingestEvents: {
|
|
615
|
+
/**
|
|
616
|
+
* @description The event or batch of events to ingest.
|
|
617
|
+
* The request body must be a CloudEvents JSON object or an array of CloudEvents JSON objects.
|
|
618
|
+
* The CloudEvents JSON object must adhere to the CloudEvents Specification JSON Schema.
|
|
619
|
+
*/
|
|
269
620
|
requestBody: {
|
|
270
621
|
content: {
|
|
271
|
-
|
|
272
|
-
|
|
622
|
+
'application/cloudevents+json': components['schemas']['Event'];
|
|
623
|
+
'application/cloudevents-batch+json': components['schemas']['Event'][];
|
|
273
624
|
};
|
|
274
625
|
};
|
|
275
626
|
responses: {
|
|
276
|
-
/** @description
|
|
627
|
+
/** @description Successfully ingested. */
|
|
277
628
|
204: {
|
|
278
629
|
content: never;
|
|
279
630
|
};
|
|
280
|
-
400: components[
|
|
281
|
-
|
|
631
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
632
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
633
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
282
634
|
};
|
|
283
635
|
};
|
|
284
|
-
/**
|
|
636
|
+
/**
|
|
637
|
+
* List meters
|
|
638
|
+
* @description List meters.
|
|
639
|
+
*/
|
|
285
640
|
listMeters: {
|
|
286
|
-
parameters: {
|
|
287
|
-
header?: {
|
|
288
|
-
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
641
|
responses: {
|
|
292
|
-
/** @description
|
|
642
|
+
/** @description List of meters. */
|
|
293
643
|
200: {
|
|
294
644
|
content: {
|
|
295
|
-
|
|
645
|
+
'application/json': components['schemas']['Meter'][];
|
|
296
646
|
};
|
|
297
647
|
};
|
|
298
|
-
|
|
648
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
649
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
299
650
|
};
|
|
300
651
|
};
|
|
301
|
-
/**
|
|
652
|
+
/**
|
|
653
|
+
* ☁ Create meter
|
|
654
|
+
* @description *Available in OpenMeter Cloud.*
|
|
655
|
+
* *In the open-source version, meters are created in the configuration file.*
|
|
656
|
+
*
|
|
657
|
+
* Create a meter.
|
|
658
|
+
*/
|
|
302
659
|
createMeter: {
|
|
303
|
-
|
|
304
|
-
header?: {
|
|
305
|
-
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
306
|
-
};
|
|
307
|
-
};
|
|
660
|
+
/** @description The meter to create. */
|
|
308
661
|
requestBody: {
|
|
309
662
|
content: {
|
|
310
|
-
|
|
663
|
+
'application/json': components['schemas']['Meter'];
|
|
311
664
|
};
|
|
312
665
|
};
|
|
313
666
|
responses: {
|
|
314
|
-
/** @description Created */
|
|
667
|
+
/** @description Created. */
|
|
315
668
|
201: {
|
|
316
669
|
content: {
|
|
317
|
-
|
|
670
|
+
'application/json': components['schemas']['Meter'];
|
|
318
671
|
};
|
|
319
672
|
};
|
|
320
|
-
400: components[
|
|
321
|
-
|
|
322
|
-
|
|
673
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
674
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
675
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
676
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
323
677
|
};
|
|
324
678
|
};
|
|
325
|
-
/**
|
|
679
|
+
/**
|
|
680
|
+
* Get meter
|
|
681
|
+
* @description Get meter by ID or slug
|
|
682
|
+
*/
|
|
326
683
|
getMeter: {
|
|
327
684
|
parameters: {
|
|
328
|
-
header?: {
|
|
329
|
-
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
330
|
-
};
|
|
331
685
|
path: {
|
|
332
|
-
meterIdOrSlug: components[
|
|
686
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
333
687
|
};
|
|
334
688
|
};
|
|
335
689
|
responses: {
|
|
336
|
-
/** @description
|
|
690
|
+
/** @description Meter found. */
|
|
337
691
|
200: {
|
|
338
692
|
content: {
|
|
339
|
-
|
|
693
|
+
'application/json': components['schemas']['Meter'];
|
|
340
694
|
};
|
|
341
695
|
};
|
|
342
|
-
404: components[
|
|
343
|
-
default: components[
|
|
696
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
697
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
344
698
|
};
|
|
345
699
|
};
|
|
346
|
-
/**
|
|
700
|
+
/**
|
|
701
|
+
* ☁ Delete meter
|
|
702
|
+
* @description *Available in OpenMeter Cloud.*
|
|
703
|
+
*
|
|
704
|
+
* Delete a meter by ID or slug.
|
|
705
|
+
*/
|
|
347
706
|
deleteMeter: {
|
|
348
707
|
parameters: {
|
|
349
|
-
header?: {
|
|
350
|
-
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
351
|
-
};
|
|
352
708
|
path: {
|
|
353
|
-
meterIdOrSlug: components[
|
|
709
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
354
710
|
};
|
|
355
711
|
};
|
|
356
712
|
responses: {
|
|
357
|
-
/** @description
|
|
713
|
+
/** @description Meter deleted. */
|
|
358
714
|
204: {
|
|
359
715
|
content: never;
|
|
360
716
|
};
|
|
361
|
-
404: components[
|
|
362
|
-
501: components[
|
|
363
|
-
default: components[
|
|
717
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
718
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
719
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
364
720
|
};
|
|
365
721
|
};
|
|
366
|
-
/**
|
|
367
|
-
|
|
722
|
+
/**
|
|
723
|
+
* Query meter
|
|
724
|
+
* @description Query meter for usage.
|
|
725
|
+
*/
|
|
726
|
+
queryMeter: {
|
|
368
727
|
parameters: {
|
|
369
728
|
query?: {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
* Inclusive.
|
|
381
|
-
*/
|
|
382
|
-
to?: string;
|
|
383
|
-
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
384
|
-
windowSize?: components["schemas"]["WindowSize"];
|
|
385
|
-
/**
|
|
386
|
-
* @description If not specified, OpenMeter will use the default aggregation type.
|
|
387
|
-
* As OpenMeter stores aggregates defined by meter config, passing a different aggregate can lead to inaccurate results.
|
|
388
|
-
* For example getting the MIN of SUMs.
|
|
389
|
-
*/
|
|
390
|
-
aggregation?: components["schemas"]["MeterAggregation"];
|
|
391
|
-
/** @description If not specified a single aggregate will be returned for each subject and time window. */
|
|
392
|
-
groupBy?: string;
|
|
729
|
+
from?: components['parameters']['queryFrom'];
|
|
730
|
+
to?: components['parameters']['queryTo'];
|
|
731
|
+
windowSize?: components['parameters']['queryWindowSize'];
|
|
732
|
+
windowTimeZone?: components['parameters']['queryWindowTimeZone'];
|
|
733
|
+
subject?: components['parameters']['queryFilterSubject'];
|
|
734
|
+
filterGroupBy?: components['parameters']['queryFilterGroupBy'];
|
|
735
|
+
groupBy?: components['parameters']['queryGroupBy'];
|
|
736
|
+
};
|
|
737
|
+
path: {
|
|
738
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
393
739
|
};
|
|
394
|
-
|
|
395
|
-
|
|
740
|
+
};
|
|
741
|
+
responses: {
|
|
742
|
+
/** @description Usage data. */
|
|
743
|
+
200: {
|
|
744
|
+
content: {
|
|
745
|
+
'application/json': components['schemas']['MeterQueryResult'];
|
|
746
|
+
'text/csv': string;
|
|
747
|
+
};
|
|
396
748
|
};
|
|
749
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
750
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
751
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
752
|
+
};
|
|
753
|
+
};
|
|
754
|
+
/**
|
|
755
|
+
* List meter subjects
|
|
756
|
+
* @description List subjects for a meter.
|
|
757
|
+
*/
|
|
758
|
+
listMeterSubjects: {
|
|
759
|
+
parameters: {
|
|
397
760
|
path: {
|
|
398
|
-
meterIdOrSlug: components[
|
|
761
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
399
762
|
};
|
|
400
763
|
};
|
|
401
764
|
responses: {
|
|
402
|
-
/** @description
|
|
765
|
+
/** @description List of subjects. */
|
|
403
766
|
200: {
|
|
404
767
|
content: {
|
|
405
|
-
|
|
406
|
-
windowSize?: components["schemas"]["WindowSize"];
|
|
407
|
-
data: components["schemas"]["MeterValue"][];
|
|
408
|
-
};
|
|
768
|
+
'application/json': string[];
|
|
409
769
|
};
|
|
410
770
|
};
|
|
411
|
-
400: components[
|
|
412
|
-
default: components[
|
|
771
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
772
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
413
773
|
};
|
|
414
774
|
};
|
|
415
|
-
/**
|
|
416
|
-
|
|
775
|
+
/**
|
|
776
|
+
* ☁ List portal tokens
|
|
777
|
+
* @description *Available in OpenMeter Cloud.*
|
|
778
|
+
*
|
|
779
|
+
* List consumer portal tokens.
|
|
780
|
+
*/
|
|
781
|
+
listPortalTokens: {
|
|
417
782
|
parameters: {
|
|
418
783
|
query?: {
|
|
784
|
+
/** @description Number of portal tokens to return. Default is 25. */
|
|
785
|
+
limit?: number;
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
responses: {
|
|
789
|
+
/** @description List of portal tokens. */
|
|
790
|
+
200: {
|
|
791
|
+
content: {
|
|
792
|
+
'application/json': components['schemas']['PortalToken'][];
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
796
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
797
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
798
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
799
|
+
};
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Create portal token
|
|
803
|
+
* @description Create a consumer portal token.
|
|
804
|
+
*/
|
|
805
|
+
createPortalToken: {
|
|
806
|
+
/** @description The portal token to create. */
|
|
807
|
+
requestBody: {
|
|
808
|
+
content: {
|
|
419
809
|
/**
|
|
420
|
-
* @
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
* @description End date-time in RFC 3339 format in UTC timezone.
|
|
427
|
-
* Must be aligned with the window size.
|
|
428
|
-
* Inclusive.
|
|
429
|
-
*/
|
|
430
|
-
to?: string;
|
|
431
|
-
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
432
|
-
windowSize?: components["schemas"]["WindowSize"];
|
|
433
|
-
/**
|
|
434
|
-
* @deprecated
|
|
435
|
-
* @description If not specified, OpenMeter will use the default aggregation type.
|
|
436
|
-
* As OpenMeter stores aggregates defined by meter config, passing a different aggregate can lead to inaccurate results.
|
|
437
|
-
* For example getting the MIN of SUMs.
|
|
810
|
+
* @example {
|
|
811
|
+
* "subject": "customer-id",
|
|
812
|
+
* "allowedMeterSlugs": [
|
|
813
|
+
* "tokens_total"
|
|
814
|
+
* ]
|
|
815
|
+
* }
|
|
438
816
|
*/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
817
|
+
'application/json': components['schemas']['PortalToken'];
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
responses: {
|
|
821
|
+
/** @description Created. */
|
|
822
|
+
200: {
|
|
823
|
+
content: {
|
|
824
|
+
'application/json': components['schemas']['PortalToken'];
|
|
825
|
+
};
|
|
443
826
|
};
|
|
444
|
-
|
|
445
|
-
|
|
827
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
828
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
829
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
/**
|
|
833
|
+
* ☁ Invalidate portal tokens
|
|
834
|
+
* @description *Available in OpenMeter Cloud.*
|
|
835
|
+
*
|
|
836
|
+
* Invalidates consumer portal tokens by ID or subject.
|
|
837
|
+
*/
|
|
838
|
+
invalidatePortalTokens: {
|
|
839
|
+
/** @description If no id or subject is specified, all tokens will be invalidated. */
|
|
840
|
+
requestBody: {
|
|
841
|
+
content: {
|
|
842
|
+
'application/json': {
|
|
843
|
+
/** @description Invalidate a portal token by ID. */
|
|
844
|
+
id?: string;
|
|
845
|
+
/** @description Invalidate all portal tokens for a subject. */
|
|
846
|
+
subject?: string;
|
|
847
|
+
};
|
|
446
848
|
};
|
|
447
|
-
|
|
448
|
-
|
|
849
|
+
};
|
|
850
|
+
responses: {
|
|
851
|
+
/** @description Portal tokens invalidated. */
|
|
852
|
+
204: {
|
|
853
|
+
content: never;
|
|
449
854
|
};
|
|
855
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
856
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
857
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
858
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
450
859
|
};
|
|
860
|
+
};
|
|
861
|
+
/**
|
|
862
|
+
* ☁ List subjects
|
|
863
|
+
* @description *Available in OpenMeter Cloud.*
|
|
864
|
+
*
|
|
865
|
+
* List subjects.
|
|
866
|
+
*/
|
|
867
|
+
listSubjects: {
|
|
451
868
|
responses: {
|
|
452
|
-
/** @description
|
|
869
|
+
/** @description List of subjects. */
|
|
453
870
|
200: {
|
|
454
871
|
content: {
|
|
455
|
-
|
|
456
|
-
/** Format: date-time */
|
|
457
|
-
from?: string;
|
|
458
|
-
/** Format: date-time */
|
|
459
|
-
to?: string;
|
|
460
|
-
windowSize?: components["schemas"]["WindowSize"];
|
|
461
|
-
data: components["schemas"]["MeterQueryRow"][];
|
|
462
|
-
};
|
|
872
|
+
'application/json': components['schemas']['Subject'][];
|
|
463
873
|
};
|
|
464
874
|
};
|
|
465
|
-
|
|
466
|
-
default: components[
|
|
875
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
876
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
467
877
|
};
|
|
468
878
|
};
|
|
469
|
-
/**
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
879
|
+
/**
|
|
880
|
+
* ☁ Upsert subject
|
|
881
|
+
* @description *Available in OpenMeter Cloud.*
|
|
882
|
+
*
|
|
883
|
+
* Upserts a subject. Creates or updates subject.
|
|
884
|
+
* If the subject doesn't exist, it will be created.
|
|
885
|
+
* If the subject exists, it will be partially updated with the provided fields.
|
|
886
|
+
*/
|
|
887
|
+
upsertSubject: {
|
|
888
|
+
/** @description The subject to upsert. */
|
|
889
|
+
requestBody: {
|
|
890
|
+
content: {
|
|
891
|
+
'application/json': components['schemas']['Subject'][];
|
|
892
|
+
};
|
|
893
|
+
};
|
|
894
|
+
responses: {
|
|
895
|
+
/** @description Subject upserted. */
|
|
896
|
+
200: {
|
|
897
|
+
content: {
|
|
898
|
+
'application/json': components['schemas']['Subject'][];
|
|
899
|
+
};
|
|
474
900
|
};
|
|
901
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
902
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
903
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
904
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
/**
|
|
908
|
+
* ☁ Get subject
|
|
909
|
+
* @description *Available in OpenMeter Cloud.*
|
|
910
|
+
*
|
|
911
|
+
* Get subject by ID or key.
|
|
912
|
+
*/
|
|
913
|
+
getSubject: {
|
|
914
|
+
parameters: {
|
|
475
915
|
path: {
|
|
476
|
-
|
|
916
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
477
917
|
};
|
|
478
918
|
};
|
|
479
919
|
responses: {
|
|
480
|
-
/** @description
|
|
920
|
+
/** @description Subject found. */
|
|
481
921
|
200: {
|
|
482
922
|
content: {
|
|
483
|
-
|
|
923
|
+
'application/json': components['schemas']['Subject'];
|
|
484
924
|
};
|
|
485
925
|
};
|
|
486
|
-
|
|
487
|
-
|
|
926
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
927
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
928
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
488
929
|
};
|
|
489
930
|
};
|
|
490
|
-
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
931
|
+
/**
|
|
932
|
+
* ☁ Delete subject
|
|
933
|
+
* @description *Available in OpenMeter Cloud.*
|
|
934
|
+
*
|
|
935
|
+
* Delete a subject by ID or key.
|
|
936
|
+
*/
|
|
937
|
+
deleteSubject: {
|
|
938
|
+
parameters: {
|
|
939
|
+
path: {
|
|
940
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
495
941
|
};
|
|
496
942
|
};
|
|
497
943
|
responses: {
|
|
498
|
-
/** @description
|
|
499
|
-
|
|
944
|
+
/** @description Subject deleted. */
|
|
945
|
+
204: {
|
|
500
946
|
content: never;
|
|
501
947
|
};
|
|
502
|
-
|
|
948
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
949
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
950
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
951
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
952
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
/**
|
|
956
|
+
* Query portal meter
|
|
957
|
+
* @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
|
|
958
|
+
*/
|
|
959
|
+
queryPortalMeter: {
|
|
960
|
+
parameters: {
|
|
961
|
+
query?: {
|
|
962
|
+
from?: components['parameters']['queryFrom'];
|
|
963
|
+
to?: components['parameters']['queryTo'];
|
|
964
|
+
windowSize?: components['parameters']['queryWindowSize'];
|
|
965
|
+
windowTimeZone?: components['parameters']['queryWindowTimeZone'];
|
|
966
|
+
filterGroupBy?: components['parameters']['queryFilterGroupBy'];
|
|
967
|
+
groupBy?: components['parameters']['queryGroupBy'];
|
|
968
|
+
};
|
|
969
|
+
path: {
|
|
970
|
+
/** @description A unique identifier for the meter. */
|
|
971
|
+
meterSlug: string;
|
|
972
|
+
};
|
|
973
|
+
};
|
|
974
|
+
responses: {
|
|
975
|
+
/** @description Usage data. */
|
|
976
|
+
200: {
|
|
977
|
+
content: {
|
|
978
|
+
'application/json': components['schemas']['MeterQueryResult'];
|
|
979
|
+
'text/csv': string;
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
983
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
984
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
503
985
|
};
|
|
504
986
|
};
|
|
505
987
|
}
|