@openmeter/sdk 1.0.0-alpha.4 → 1.0.0-beta.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.
- package/README.md +42 -46
- package/clients/client.ts +153 -0
- package/clients/event.ts +109 -0
- package/clients/meter.ts +84 -0
- package/dist/clients/client.d.ts +40 -0
- package/dist/clients/client.js +101 -0
- package/dist/clients/event.d.ts +65 -0
- package/dist/clients/event.js +38 -0
- package/dist/clients/meter.d.ts +52 -0
- package/dist/clients/meter.js +52 -0
- package/dist/index.d.ts +10 -22
- package/dist/index.js +7 -25
- package/dist/schemas/openapi.d.ts +414 -0
- package/dist/schemas/openapi.js +5 -0
- package/dist/test/agent.d.ts +2 -0
- package/dist/test/agent.js +105 -0
- package/dist/test/mocks.d.ts +11 -0
- package/dist/test/mocks.js +21 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +13 -49
- package/package.json +53 -56
- package/schemas/openapi.ts +421 -0
- package/dist/generated/HttpService.d.ts +0 -14
- package/dist/generated/HttpService.js +0 -27
- package/dist/generated/core/ApiError.d.ts +0 -10
- package/dist/generated/core/ApiError.js +0 -17
- package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
- package/dist/generated/core/ApiRequestOptions.js +0 -2
- package/dist/generated/core/ApiResult.d.ts +0 -7
- package/dist/generated/core/ApiResult.js +0 -2
- package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
- package/dist/generated/core/BaseHttpRequest.js +0 -7
- package/dist/generated/core/CancelablePromise.d.ts +0 -20
- package/dist/generated/core/CancelablePromise.js +0 -93
- package/dist/generated/core/NodeHttpRequest.d.ts +0 -14
- package/dist/generated/core/NodeHttpRequest.js +0 -17
- package/dist/generated/core/OpenAPI.d.ts +0 -16
- package/dist/generated/core/OpenAPI.js +0 -12
- package/dist/generated/core/request.d.ts +0 -34
- package/dist/generated/core/request.js +0 -268
- package/dist/generated/index.d.ts +0 -29
- package/dist/generated/index.js +0 -22
- package/dist/generated/models/Event.d.ts +0 -49
- package/dist/generated/models/Event.js +0 -11
- package/dist/generated/models/IdOrSlug.d.ts +0 -1
- package/dist/generated/models/IdOrSlug.js +0 -2
- package/dist/generated/models/Meter.d.ts +0 -30
- package/dist/generated/models/Meter.js +0 -2
- package/dist/generated/models/MeterAggregation.d.ts +0 -10
- package/dist/generated/models/MeterAggregation.js +0 -12
- package/dist/generated/models/MeterValue.d.ts +0 -10
- package/dist/generated/models/MeterValue.js +0 -2
- package/dist/generated/models/Namespace.d.ts +0 -6
- package/dist/generated/models/Namespace.js +0 -2
- package/dist/generated/models/Problem.d.ts +0 -4
- package/dist/generated/models/Problem.js +0 -2
- package/dist/generated/models/WindowSize.d.ts +0 -5
- package/dist/generated/models/WindowSize.js +0 -7
- package/dist/generated/models/meterIdOrSlug.d.ts +0 -5
- package/dist/generated/models/meterIdOrSlug.js +0 -2
- package/dist/generated/models/namespaceParam.d.ts +0 -4
- package/dist/generated/models/namespaceParam.js +0 -2
- package/dist/generated/schemas/$Event.d.ts +0 -59
- package/dist/generated/schemas/$Event.js +0 -60
- package/dist/generated/schemas/$IdOrSlug.d.ts +0 -13
- package/dist/generated/schemas/$IdOrSlug.js +0 -14
- package/dist/generated/schemas/$Meter.d.ts +0 -44
- package/dist/generated/schemas/$Meter.js +0 -45
- package/dist/generated/schemas/$MeterAggregation.d.ts +0 -3
- package/dist/generated/schemas/$MeterAggregation.js +0 -4
- package/dist/generated/schemas/$MeterValue.d.ts +0 -26
- package/dist/generated/schemas/$MeterValue.js +0 -27
- package/dist/generated/schemas/$Namespace.d.ts +0 -9
- package/dist/generated/schemas/$Namespace.js +0 -10
- package/dist/generated/schemas/$Problem.d.ts +0 -6
- package/dist/generated/schemas/$Problem.js +0 -7
- package/dist/generated/schemas/$WindowSize.d.ts +0 -3
- package/dist/generated/schemas/$WindowSize.js +0 -4
- package/dist/generated/schemas/$meterIdOrSlug.d.ts +0 -4
- package/dist/generated/schemas/$meterIdOrSlug.js +0 -5
- package/dist/generated/schemas/$namespaceParam.d.ts +0 -5
- package/dist/generated/schemas/$namespaceParam.js +0 -6
- package/dist/generated/services/DefaultService.d.ts +0 -16
- package/dist/generated/services/DefaultService.js +0 -22
- package/dist/generated/services/EventsService.d.ts +0 -17
- package/dist/generated/services/EventsService.js +0 -29
- package/dist/generated/services/MetersService.d.ts +0 -75
- package/dist/generated/services/MetersService.js +0 -140
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface paths {
|
|
8
|
+
"/api/v1/events": {
|
|
9
|
+
/** @description Ingest events */
|
|
10
|
+
post: operations["ingestEvents"];
|
|
11
|
+
};
|
|
12
|
+
"/api/v1/meters": {
|
|
13
|
+
/** @description List meters */
|
|
14
|
+
get: operations["listMeters"];
|
|
15
|
+
/** @description Create meter */
|
|
16
|
+
post: operations["createMeter"];
|
|
17
|
+
};
|
|
18
|
+
"/api/v1/meters/{meterIdOrSlug}": {
|
|
19
|
+
/** @description Get meter by slugs */
|
|
20
|
+
get: operations["getMeter"];
|
|
21
|
+
/** @description Delete meter by slug */
|
|
22
|
+
delete: operations["deleteMeter"];
|
|
23
|
+
};
|
|
24
|
+
"/api/v1/meters/{meterIdOrSlug}/values": {
|
|
25
|
+
/** @description Get meter values */
|
|
26
|
+
get: operations["getMeterValues"];
|
|
27
|
+
};
|
|
28
|
+
"/api/v1/namespaces": {
|
|
29
|
+
/** @description Create namespace */
|
|
30
|
+
post: operations["createNamespace"];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type webhooks = Record<string, never>;
|
|
35
|
+
|
|
36
|
+
export interface components {
|
|
37
|
+
schemas: {
|
|
38
|
+
/**
|
|
39
|
+
* @description A Problem Details object (RFC 7807)
|
|
40
|
+
* @example {
|
|
41
|
+
* "type": "urn:problem-type:bad-request",
|
|
42
|
+
* "title": "Bad Request",
|
|
43
|
+
* "status": 400,
|
|
44
|
+
* "detail": "header Content-Type has unexpected value \"application/xml\"",
|
|
45
|
+
* "instance": "urn:request:local/JMOlctsKV8-000001"
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
Problem: {
|
|
49
|
+
/**
|
|
50
|
+
* Format: uri
|
|
51
|
+
* @description Type contains a URI that identifies the problem type.
|
|
52
|
+
* @example urn:problem-type:bad-request
|
|
53
|
+
*/
|
|
54
|
+
type: string;
|
|
55
|
+
/**
|
|
56
|
+
* @description A a short, human-readable summary of the problem type.
|
|
57
|
+
* @example Bad Request
|
|
58
|
+
*/
|
|
59
|
+
title: string;
|
|
60
|
+
/**
|
|
61
|
+
* Format: int32
|
|
62
|
+
* @description The HTTP status code generated by the origin server for this occurrence of the problem.
|
|
63
|
+
* @example 400
|
|
64
|
+
*/
|
|
65
|
+
status: number;
|
|
66
|
+
/**
|
|
67
|
+
* @description A human-readable explanation specific to this occurrence of the problem.
|
|
68
|
+
* @example header Content-Type has unexpected value \"application/xml\"
|
|
69
|
+
*/
|
|
70
|
+
detail: string;
|
|
71
|
+
/**
|
|
72
|
+
* Format: uri
|
|
73
|
+
* @description A URI reference that identifies the specific occurrence of the problem.
|
|
74
|
+
* @example urn:request:local/JMOlctsKV8-000001
|
|
75
|
+
*/
|
|
76
|
+
instance?: string;
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
};
|
|
79
|
+
/** @description CloudEvents Specification JSON Schema */
|
|
80
|
+
Event: {
|
|
81
|
+
/**
|
|
82
|
+
* @description Identifies the event.
|
|
83
|
+
* @example 5c10fade-1c9e-4d6c-8275-c52c36731d3c
|
|
84
|
+
*/
|
|
85
|
+
id: string;
|
|
86
|
+
/**
|
|
87
|
+
* Format: uri-reference
|
|
88
|
+
* @description Identifies the context in which an event happened.
|
|
89
|
+
* @example services/service-0
|
|
90
|
+
*/
|
|
91
|
+
source: string;
|
|
92
|
+
/**
|
|
93
|
+
* @description The version of the CloudEvents specification which the event uses.
|
|
94
|
+
* @example 1.0
|
|
95
|
+
*/
|
|
96
|
+
specversion: string;
|
|
97
|
+
/**
|
|
98
|
+
* @description Describes the type of event related to the originating occurrence.
|
|
99
|
+
* @example api_request
|
|
100
|
+
*/
|
|
101
|
+
type: string;
|
|
102
|
+
/**
|
|
103
|
+
* @description Content type of the data value. Must adhere to RFC 2046 format.
|
|
104
|
+
* @example application/json
|
|
105
|
+
* @enum {string|null}
|
|
106
|
+
*/
|
|
107
|
+
datacontenttype?: "application/json" | null;
|
|
108
|
+
/**
|
|
109
|
+
* Format: uri
|
|
110
|
+
* @description Identifies the schema that data adheres to.
|
|
111
|
+
*/
|
|
112
|
+
dataschema?: string | null;
|
|
113
|
+
/**
|
|
114
|
+
* @description Describes the subject of the event in the context of the event producer (identified by source).
|
|
115
|
+
* @example customer_id
|
|
116
|
+
*/
|
|
117
|
+
subject: string;
|
|
118
|
+
/**
|
|
119
|
+
* Format: date-time
|
|
120
|
+
* @description Timestamp of when the occurrence happened. Must adhere to RFC 3339.
|
|
121
|
+
* @example 2023-01-01T01:01:01.001Z
|
|
122
|
+
*/
|
|
123
|
+
time?: string | null;
|
|
124
|
+
/**
|
|
125
|
+
* @description The event payload.
|
|
126
|
+
* @example {
|
|
127
|
+
* "duration_ms": "12",
|
|
128
|
+
* "path": "/hello"
|
|
129
|
+
* }
|
|
130
|
+
*/
|
|
131
|
+
data?: {
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
Meter: {
|
|
136
|
+
/**
|
|
137
|
+
* @description A unique identifier for the meter.
|
|
138
|
+
* @example 01G65Z755AFWAKHE12NY0CQ9FH
|
|
139
|
+
*/
|
|
140
|
+
id?: string;
|
|
141
|
+
/**
|
|
142
|
+
* @description A unique identifier for the meter.
|
|
143
|
+
* @example my-meter
|
|
144
|
+
*/
|
|
145
|
+
slug: string;
|
|
146
|
+
/**
|
|
147
|
+
* @description A description of the meter.
|
|
148
|
+
* @example My Meter Description
|
|
149
|
+
*/
|
|
150
|
+
description?: string | null;
|
|
151
|
+
aggregation: components["schemas"]["MeterAggregation"];
|
|
152
|
+
/**
|
|
153
|
+
* @description The event type to aggregate.
|
|
154
|
+
* @example api_request
|
|
155
|
+
*/
|
|
156
|
+
eventType: string;
|
|
157
|
+
/**
|
|
158
|
+
* @description JSONPath expression to extract the value from the event data.
|
|
159
|
+
* @example $.duration_ms
|
|
160
|
+
*/
|
|
161
|
+
valueProperty: string;
|
|
162
|
+
/**
|
|
163
|
+
* @description Named JSONPath expressions to extract the group by values from the event data.
|
|
164
|
+
* @example {
|
|
165
|
+
* "duration_ms": "$.duration_ms",
|
|
166
|
+
* "path": "$.path"
|
|
167
|
+
* }
|
|
168
|
+
*/
|
|
169
|
+
groupBy?: {
|
|
170
|
+
[key: string]: string;
|
|
171
|
+
};
|
|
172
|
+
windowSize: components["schemas"]["WindowSize"];
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* @description The aggregation type to use for the meter.
|
|
176
|
+
* @enum {string}
|
|
177
|
+
*/
|
|
178
|
+
MeterAggregation: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX";
|
|
179
|
+
/** @enum {string} */
|
|
180
|
+
WindowSize: "MINUTE" | "HOUR" | "DAY";
|
|
181
|
+
MeterValue: {
|
|
182
|
+
/** @description The subject of the meter value. */
|
|
183
|
+
subject?: string;
|
|
184
|
+
/** Format: date-time */
|
|
185
|
+
windowStart: string;
|
|
186
|
+
/** Format: date-time */
|
|
187
|
+
windowEnd: string;
|
|
188
|
+
value: number;
|
|
189
|
+
groupBy?: {
|
|
190
|
+
[key: string]: string;
|
|
191
|
+
} | null;
|
|
192
|
+
};
|
|
193
|
+
IdOrSlug: string;
|
|
194
|
+
Namespace: {
|
|
195
|
+
/**
|
|
196
|
+
* @description A namespace
|
|
197
|
+
* @example my-namesapce
|
|
198
|
+
*/
|
|
199
|
+
namespace: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
responses: {
|
|
203
|
+
/** @description Bad Request */
|
|
204
|
+
BadRequestProblemResponse: {
|
|
205
|
+
content: {
|
|
206
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
/** @description Method not allowed, feature not supported */
|
|
210
|
+
MethodNotAllowedProblemResponse: {
|
|
211
|
+
content: {
|
|
212
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
/** @description Not Found */
|
|
216
|
+
NotFoundProblemResponse: {
|
|
217
|
+
content: {
|
|
218
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
/** @description Not Implemented */
|
|
222
|
+
NotImplementedProblemResponse: {
|
|
223
|
+
content: {
|
|
224
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
/** @description Unexpected error */
|
|
228
|
+
UnexpectedProblemResponse: {
|
|
229
|
+
content: {
|
|
230
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
parameters: {
|
|
235
|
+
/** @description A unique identifier for the meter. */
|
|
236
|
+
meterIdOrSlug: components["schemas"]["IdOrSlug"];
|
|
237
|
+
/**
|
|
238
|
+
* @description Optional namespace
|
|
239
|
+
* @default default
|
|
240
|
+
*/
|
|
241
|
+
namespaceParam?: string;
|
|
242
|
+
};
|
|
243
|
+
requestBodies: never;
|
|
244
|
+
headers: never;
|
|
245
|
+
pathItems: never;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type external = Record<string, never>;
|
|
249
|
+
|
|
250
|
+
export interface operations {
|
|
251
|
+
|
|
252
|
+
/** @description Ingest events */
|
|
253
|
+
ingestEvents: {
|
|
254
|
+
parameters: {
|
|
255
|
+
header?: {
|
|
256
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
requestBody: {
|
|
260
|
+
content: {
|
|
261
|
+
"application/cloudevents+json": components["schemas"]["Event"];
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
responses: {
|
|
265
|
+
/** @description OK */
|
|
266
|
+
200: {
|
|
267
|
+
content: never;
|
|
268
|
+
};
|
|
269
|
+
400: components["responses"]["BadRequestProblemResponse"];
|
|
270
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
/** @description List meters */
|
|
274
|
+
listMeters: {
|
|
275
|
+
parameters: {
|
|
276
|
+
header?: {
|
|
277
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
responses: {
|
|
281
|
+
/** @description Meters response */
|
|
282
|
+
200: {
|
|
283
|
+
content: {
|
|
284
|
+
"application/json": components["schemas"]["Meter"][];
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
/** @description Create meter */
|
|
291
|
+
createMeter: {
|
|
292
|
+
parameters: {
|
|
293
|
+
header?: {
|
|
294
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
requestBody: {
|
|
298
|
+
content: {
|
|
299
|
+
"application/json": components["schemas"]["Meter"];
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
responses: {
|
|
303
|
+
/** @description Created */
|
|
304
|
+
201: {
|
|
305
|
+
content: {
|
|
306
|
+
"application/json": components["schemas"]["Meter"];
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
400: components["responses"]["BadRequestProblemResponse"];
|
|
310
|
+
501: components["responses"]["NotImplementedProblemResponse"];
|
|
311
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
/** @description Get meter by slugs */
|
|
315
|
+
getMeter: {
|
|
316
|
+
parameters: {
|
|
317
|
+
header?: {
|
|
318
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
319
|
+
};
|
|
320
|
+
path: {
|
|
321
|
+
meterIdOrSlug: components["parameters"]["meterIdOrSlug"];
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
responses: {
|
|
325
|
+
/** @description OK */
|
|
326
|
+
200: {
|
|
327
|
+
content: {
|
|
328
|
+
"application/json": components["schemas"]["Meter"];
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
404: components["responses"]["NotFoundProblemResponse"];
|
|
332
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
/** @description Delete meter by slug */
|
|
336
|
+
deleteMeter: {
|
|
337
|
+
parameters: {
|
|
338
|
+
header?: {
|
|
339
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
340
|
+
};
|
|
341
|
+
path: {
|
|
342
|
+
meterIdOrSlug: components["parameters"]["meterIdOrSlug"];
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
responses: {
|
|
346
|
+
/** @description No Content */
|
|
347
|
+
204: {
|
|
348
|
+
content: never;
|
|
349
|
+
};
|
|
350
|
+
404: components["responses"]["NotFoundProblemResponse"];
|
|
351
|
+
501: components["responses"]["NotImplementedProblemResponse"];
|
|
352
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
/** @description Get meter values */
|
|
356
|
+
getMeterValues: {
|
|
357
|
+
parameters: {
|
|
358
|
+
query?: {
|
|
359
|
+
subject?: string;
|
|
360
|
+
/**
|
|
361
|
+
* @description Start date-time in RFC 3339 format.
|
|
362
|
+
* Must be aligned with the window size.
|
|
363
|
+
* Inclusive.
|
|
364
|
+
*/
|
|
365
|
+
from?: string;
|
|
366
|
+
/**
|
|
367
|
+
* @description End date-time in RFC 3339 format.
|
|
368
|
+
* Must be aligned with the window size.
|
|
369
|
+
* Inclusive.
|
|
370
|
+
*/
|
|
371
|
+
to?: string;
|
|
372
|
+
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
373
|
+
windowSize?: components["schemas"]["WindowSize"];
|
|
374
|
+
/**
|
|
375
|
+
* @description If not specified, OpenMeter will use the default aggregation type.
|
|
376
|
+
* As OpenMeter stores aggregates defined by meter config, passing a different aggregate can lead to inaccurate results.
|
|
377
|
+
* For example getting the MIN of SUMs.
|
|
378
|
+
*/
|
|
379
|
+
aggregation?: components["schemas"]["MeterAggregation"];
|
|
380
|
+
/** @description If not specified a single aggregate will be returned for each subject and time window. */
|
|
381
|
+
groupBy?: string;
|
|
382
|
+
};
|
|
383
|
+
header?: {
|
|
384
|
+
"OM-Namespace"?: components["parameters"]["namespaceParam"];
|
|
385
|
+
};
|
|
386
|
+
path: {
|
|
387
|
+
meterIdOrSlug: components["parameters"]["meterIdOrSlug"];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
responses: {
|
|
391
|
+
/** @description OK */
|
|
392
|
+
200: {
|
|
393
|
+
content: {
|
|
394
|
+
"application/json": {
|
|
395
|
+
windowSize?: components["schemas"]["WindowSize"];
|
|
396
|
+
data: components["schemas"]["MeterValue"][];
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
400: components["responses"]["BadRequestProblemResponse"];
|
|
401
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
/** @description Create namespace */
|
|
405
|
+
createNamespace: {
|
|
406
|
+
requestBody: {
|
|
407
|
+
content: {
|
|
408
|
+
"application/json": components["schemas"]["Namespace"];
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
responses: {
|
|
412
|
+
/** @description Created */
|
|
413
|
+
201: {
|
|
414
|
+
content: {
|
|
415
|
+
"application/json": components["schemas"]["Namespace"];
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
default: components["responses"]["UnexpectedProblemResponse"];
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DefaultService } from './services/DefaultService.js';
|
|
2
|
-
import { EventsService } from './services/EventsService.js';
|
|
3
|
-
import { MetersService } from './services/MetersService.js';
|
|
4
|
-
import type { BaseHttpRequest } from './core/BaseHttpRequest.js';
|
|
5
|
-
import type { OpenAPIConfig } from './core/OpenAPI.js';
|
|
6
|
-
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
7
|
-
export declare class HttpService {
|
|
8
|
-
readonly default: DefaultService;
|
|
9
|
-
readonly events: EventsService;
|
|
10
|
-
readonly meters: MetersService;
|
|
11
|
-
readonly request: BaseHttpRequest;
|
|
12
|
-
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
import { NodeHttpRequest } from './core/NodeHttpRequest.js';
|
|
3
|
-
import { DefaultService } from './services/DefaultService.js';
|
|
4
|
-
import { EventsService } from './services/EventsService.js';
|
|
5
|
-
import { MetersService } from './services/MetersService.js';
|
|
6
|
-
export class HttpService {
|
|
7
|
-
default;
|
|
8
|
-
events;
|
|
9
|
-
meters;
|
|
10
|
-
request;
|
|
11
|
-
constructor(config, HttpRequest = NodeHttpRequest) {
|
|
12
|
-
this.request = new HttpRequest({
|
|
13
|
-
BASE: config?.BASE ?? '',
|
|
14
|
-
VERSION: config?.VERSION ?? '1.0.0-alpha.2',
|
|
15
|
-
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
16
|
-
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
17
|
-
TOKEN: config?.TOKEN,
|
|
18
|
-
USERNAME: config?.USERNAME,
|
|
19
|
-
PASSWORD: config?.PASSWORD,
|
|
20
|
-
HEADERS: config?.HEADERS,
|
|
21
|
-
ENCODE_PATH: config?.ENCODE_PATH,
|
|
22
|
-
});
|
|
23
|
-
this.default = new DefaultService(this.request);
|
|
24
|
-
this.events = new EventsService(this.request);
|
|
25
|
-
this.meters = new MetersService(this.request);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from './ApiRequestOptions.js';
|
|
2
|
-
import type { ApiResult } from './ApiResult.js';
|
|
3
|
-
export declare class ApiError extends Error {
|
|
4
|
-
readonly url: string;
|
|
5
|
-
readonly status: number;
|
|
6
|
-
readonly statusText: string;
|
|
7
|
-
readonly body: any;
|
|
8
|
-
readonly request: ApiRequestOptions;
|
|
9
|
-
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export class ApiError extends Error {
|
|
3
|
-
url;
|
|
4
|
-
status;
|
|
5
|
-
statusText;
|
|
6
|
-
body;
|
|
7
|
-
request;
|
|
8
|
-
constructor(request, response, message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = 'ApiError';
|
|
11
|
-
this.url = response.url;
|
|
12
|
-
this.status = response.status;
|
|
13
|
-
this.statusText = response.statusText;
|
|
14
|
-
this.body = response.body;
|
|
15
|
-
this.request = request;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type ApiRequestOptions = {
|
|
2
|
-
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
-
readonly url: string;
|
|
4
|
-
readonly path?: Record<string, any>;
|
|
5
|
-
readonly cookies?: Record<string, any>;
|
|
6
|
-
readonly headers?: Record<string, any>;
|
|
7
|
-
readonly query?: Record<string, any>;
|
|
8
|
-
readonly formData?: Record<string, any>;
|
|
9
|
-
readonly body?: any;
|
|
10
|
-
readonly mediaType?: string;
|
|
11
|
-
readonly responseHeader?: string;
|
|
12
|
-
readonly errors?: Record<number, string>;
|
|
13
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from './ApiRequestOptions.js';
|
|
2
|
-
import type { CancelablePromise } from './CancelablePromise.js';
|
|
3
|
-
import type { OpenAPIConfig } from './OpenAPI.js';
|
|
4
|
-
export declare abstract class BaseHttpRequest {
|
|
5
|
-
readonly config: OpenAPIConfig;
|
|
6
|
-
constructor(config: OpenAPIConfig);
|
|
7
|
-
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
8
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class CancelError extends Error {
|
|
2
|
-
constructor(message: string);
|
|
3
|
-
get isCancelled(): boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface OnCancel {
|
|
6
|
-
readonly isResolved: boolean;
|
|
7
|
-
readonly isRejected: boolean;
|
|
8
|
-
readonly isCancelled: boolean;
|
|
9
|
-
(cancelHandler: () => void): void;
|
|
10
|
-
}
|
|
11
|
-
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
-
#private;
|
|
13
|
-
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
-
get [Symbol.toStringTag](): string;
|
|
15
|
-
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
16
|
-
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
17
|
-
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
18
|
-
cancel(): void;
|
|
19
|
-
get isCancelled(): boolean;
|
|
20
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export class CancelError extends Error {
|
|
3
|
-
constructor(message) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.name = 'CancelError';
|
|
6
|
-
}
|
|
7
|
-
get isCancelled() {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export class CancelablePromise {
|
|
12
|
-
#isResolved;
|
|
13
|
-
#isRejected;
|
|
14
|
-
#isCancelled;
|
|
15
|
-
#cancelHandlers;
|
|
16
|
-
#promise;
|
|
17
|
-
#resolve;
|
|
18
|
-
#reject;
|
|
19
|
-
constructor(executor) {
|
|
20
|
-
this.#isResolved = false;
|
|
21
|
-
this.#isRejected = false;
|
|
22
|
-
this.#isCancelled = false;
|
|
23
|
-
this.#cancelHandlers = [];
|
|
24
|
-
this.#promise = new Promise((resolve, reject) => {
|
|
25
|
-
this.#resolve = resolve;
|
|
26
|
-
this.#reject = reject;
|
|
27
|
-
const onResolve = (value) => {
|
|
28
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.#isResolved = true;
|
|
32
|
-
this.#resolve?.(value);
|
|
33
|
-
};
|
|
34
|
-
const onReject = (reason) => {
|
|
35
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.#isRejected = true;
|
|
39
|
-
this.#reject?.(reason);
|
|
40
|
-
};
|
|
41
|
-
const onCancel = (cancelHandler) => {
|
|
42
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.#cancelHandlers.push(cancelHandler);
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(onCancel, 'isResolved', {
|
|
48
|
-
get: () => this.#isResolved,
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(onCancel, 'isRejected', {
|
|
51
|
-
get: () => this.#isRejected,
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(onCancel, 'isCancelled', {
|
|
54
|
-
get: () => this.#isCancelled,
|
|
55
|
-
});
|
|
56
|
-
return executor(onResolve, onReject, onCancel);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
get [Symbol.toStringTag]() {
|
|
60
|
-
return "Cancellable Promise";
|
|
61
|
-
}
|
|
62
|
-
then(onFulfilled, onRejected) {
|
|
63
|
-
return this.#promise.then(onFulfilled, onRejected);
|
|
64
|
-
}
|
|
65
|
-
catch(onRejected) {
|
|
66
|
-
return this.#promise.catch(onRejected);
|
|
67
|
-
}
|
|
68
|
-
finally(onFinally) {
|
|
69
|
-
return this.#promise.finally(onFinally);
|
|
70
|
-
}
|
|
71
|
-
cancel() {
|
|
72
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
this.#isCancelled = true;
|
|
76
|
-
if (this.#cancelHandlers.length) {
|
|
77
|
-
try {
|
|
78
|
-
for (const cancelHandler of this.#cancelHandlers) {
|
|
79
|
-
cancelHandler();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.warn('Cancellation threw an error', error);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
this.#cancelHandlers.length = 0;
|
|
88
|
-
this.#reject?.(new CancelError('Request aborted'));
|
|
89
|
-
}
|
|
90
|
-
get isCancelled() {
|
|
91
|
-
return this.#isCancelled;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseHttpRequest } from './BaseHttpRequest.js';
|
|
2
|
-
import type { ApiRequestOptions } from './ApiRequestOptions.js';
|
|
3
|
-
import type { CancelablePromise } from './CancelablePromise.js';
|
|
4
|
-
import type { OpenAPIConfig } from './OpenAPI.js';
|
|
5
|
-
export declare class NodeHttpRequest extends BaseHttpRequest {
|
|
6
|
-
constructor(config: OpenAPIConfig);
|
|
7
|
-
/**
|
|
8
|
-
* Request method
|
|
9
|
-
* @param options The request options from the service
|
|
10
|
-
* @returns CancelablePromise<T>
|
|
11
|
-
* @throws ApiError
|
|
12
|
-
*/
|
|
13
|
-
request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
import { BaseHttpRequest } from './BaseHttpRequest.js';
|
|
3
|
-
import { request as __request } from './request.js';
|
|
4
|
-
export class NodeHttpRequest extends BaseHttpRequest {
|
|
5
|
-
constructor(config) {
|
|
6
|
-
super(config);
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Request method
|
|
10
|
-
* @param options The request options from the service
|
|
11
|
-
* @returns CancelablePromise<T>
|
|
12
|
-
* @throws ApiError
|
|
13
|
-
*/
|
|
14
|
-
request(options) {
|
|
15
|
-
return __request(this.config, options);
|
|
16
|
-
}
|
|
17
|
-
}
|