@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.
Files changed (88) hide show
  1. package/README.md +42 -46
  2. package/clients/client.ts +153 -0
  3. package/clients/event.ts +109 -0
  4. package/clients/meter.ts +84 -0
  5. package/dist/clients/client.d.ts +40 -0
  6. package/dist/clients/client.js +101 -0
  7. package/dist/clients/event.d.ts +65 -0
  8. package/dist/clients/event.js +38 -0
  9. package/dist/clients/meter.d.ts +52 -0
  10. package/dist/clients/meter.js +52 -0
  11. package/dist/index.d.ts +10 -22
  12. package/dist/index.js +7 -25
  13. package/dist/schemas/openapi.d.ts +414 -0
  14. package/dist/schemas/openapi.js +5 -0
  15. package/dist/test/agent.d.ts +2 -0
  16. package/dist/test/agent.js +105 -0
  17. package/dist/test/mocks.d.ts +11 -0
  18. package/dist/test/mocks.js +21 -0
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/index.ts +13 -49
  21. package/package.json +53 -56
  22. package/schemas/openapi.ts +421 -0
  23. package/dist/generated/HttpService.d.ts +0 -14
  24. package/dist/generated/HttpService.js +0 -27
  25. package/dist/generated/core/ApiError.d.ts +0 -10
  26. package/dist/generated/core/ApiError.js +0 -17
  27. package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
  28. package/dist/generated/core/ApiRequestOptions.js +0 -2
  29. package/dist/generated/core/ApiResult.d.ts +0 -7
  30. package/dist/generated/core/ApiResult.js +0 -2
  31. package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
  32. package/dist/generated/core/BaseHttpRequest.js +0 -7
  33. package/dist/generated/core/CancelablePromise.d.ts +0 -20
  34. package/dist/generated/core/CancelablePromise.js +0 -93
  35. package/dist/generated/core/NodeHttpRequest.d.ts +0 -14
  36. package/dist/generated/core/NodeHttpRequest.js +0 -17
  37. package/dist/generated/core/OpenAPI.d.ts +0 -16
  38. package/dist/generated/core/OpenAPI.js +0 -12
  39. package/dist/generated/core/request.d.ts +0 -34
  40. package/dist/generated/core/request.js +0 -268
  41. package/dist/generated/index.d.ts +0 -29
  42. package/dist/generated/index.js +0 -22
  43. package/dist/generated/models/Event.d.ts +0 -49
  44. package/dist/generated/models/Event.js +0 -11
  45. package/dist/generated/models/IdOrSlug.d.ts +0 -1
  46. package/dist/generated/models/IdOrSlug.js +0 -2
  47. package/dist/generated/models/Meter.d.ts +0 -30
  48. package/dist/generated/models/Meter.js +0 -2
  49. package/dist/generated/models/MeterAggregation.d.ts +0 -10
  50. package/dist/generated/models/MeterAggregation.js +0 -12
  51. package/dist/generated/models/MeterValue.d.ts +0 -10
  52. package/dist/generated/models/MeterValue.js +0 -2
  53. package/dist/generated/models/Namespace.d.ts +0 -6
  54. package/dist/generated/models/Namespace.js +0 -2
  55. package/dist/generated/models/Problem.d.ts +0 -4
  56. package/dist/generated/models/Problem.js +0 -2
  57. package/dist/generated/models/WindowSize.d.ts +0 -5
  58. package/dist/generated/models/WindowSize.js +0 -7
  59. package/dist/generated/models/meterIdOrSlug.d.ts +0 -5
  60. package/dist/generated/models/meterIdOrSlug.js +0 -2
  61. package/dist/generated/models/namespaceParam.d.ts +0 -4
  62. package/dist/generated/models/namespaceParam.js +0 -2
  63. package/dist/generated/schemas/$Event.d.ts +0 -59
  64. package/dist/generated/schemas/$Event.js +0 -60
  65. package/dist/generated/schemas/$IdOrSlug.d.ts +0 -13
  66. package/dist/generated/schemas/$IdOrSlug.js +0 -14
  67. package/dist/generated/schemas/$Meter.d.ts +0 -44
  68. package/dist/generated/schemas/$Meter.js +0 -45
  69. package/dist/generated/schemas/$MeterAggregation.d.ts +0 -3
  70. package/dist/generated/schemas/$MeterAggregation.js +0 -4
  71. package/dist/generated/schemas/$MeterValue.d.ts +0 -26
  72. package/dist/generated/schemas/$MeterValue.js +0 -27
  73. package/dist/generated/schemas/$Namespace.d.ts +0 -9
  74. package/dist/generated/schemas/$Namespace.js +0 -10
  75. package/dist/generated/schemas/$Problem.d.ts +0 -6
  76. package/dist/generated/schemas/$Problem.js +0 -7
  77. package/dist/generated/schemas/$WindowSize.d.ts +0 -3
  78. package/dist/generated/schemas/$WindowSize.js +0 -4
  79. package/dist/generated/schemas/$meterIdOrSlug.d.ts +0 -4
  80. package/dist/generated/schemas/$meterIdOrSlug.js +0 -5
  81. package/dist/generated/schemas/$namespaceParam.d.ts +0 -5
  82. package/dist/generated/schemas/$namespaceParam.js +0 -6
  83. package/dist/generated/services/DefaultService.d.ts +0 -16
  84. package/dist/generated/services/DefaultService.js +0 -22
  85. package/dist/generated/services/EventsService.d.ts +0 -17
  86. package/dist/generated/services/EventsService.js +0 -29
  87. package/dist/generated/services/MetersService.d.ts +0 -75
  88. package/dist/generated/services/MetersService.js +0 -140
@@ -1,16 +0,0 @@
1
- import type { ApiRequestOptions } from './ApiRequestOptions.js';
2
- type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
3
- type Headers = Record<string, string>;
4
- export type OpenAPIConfig = {
5
- BASE: string;
6
- VERSION: string;
7
- WITH_CREDENTIALS: boolean;
8
- CREDENTIALS: 'include' | 'omit' | 'same-origin';
9
- TOKEN?: string | Resolver<string> | undefined;
10
- USERNAME?: string | Resolver<string> | undefined;
11
- PASSWORD?: string | Resolver<string> | undefined;
12
- HEADERS?: Headers | Resolver<Headers> | undefined;
13
- ENCODE_PATH?: ((path: string) => string) | undefined;
14
- };
15
- export declare const OpenAPI: OpenAPIConfig;
16
- export {};
@@ -1,12 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export const OpenAPI = {
3
- BASE: '',
4
- VERSION: '1.0.0-alpha.2',
5
- WITH_CREDENTIALS: false,
6
- CREDENTIALS: 'include',
7
- TOKEN: undefined,
8
- USERNAME: undefined,
9
- PASSWORD: undefined,
10
- HEADERS: undefined,
11
- ENCODE_PATH: undefined,
12
- };
@@ -1,34 +0,0 @@
1
- /// <reference types="node" />
2
- import FormData from 'form-data';
3
- import { Headers } from 'node-fetch';
4
- import { CancelablePromise } from './CancelablePromise.js';
5
- import type { ApiRequestOptions } from './ApiRequestOptions.js';
6
- import type { ApiResult } from './ApiResult.js';
7
- import type { OnCancel } from './CancelablePromise.js';
8
- import type { OpenAPIConfig } from './OpenAPI.js';
9
- import type { Response } from 'node-fetch';
10
- export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
11
- export declare const isString: (value: any) => value is string;
12
- export declare const isStringWithValue: (value: any) => value is string;
13
- export declare const isBlob: (value: any) => value is Blob;
14
- export declare const isFormData: (value: any) => value is FormData;
15
- export declare const base64: (str: string) => string;
16
- export declare const getQueryString: (params: Record<string, any>) => string;
17
- export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
18
- type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
19
- export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T> | undefined) => Promise<T | undefined>;
20
- export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Headers>;
21
- export declare const getRequestBody: (options: ApiRequestOptions) => any;
22
- export declare const sendRequest: (options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<Response>;
23
- export declare const getResponseHeader: (response: Response, responseHeader?: string) => string | undefined;
24
- export declare const getResponseBody: (response: Response) => Promise<any>;
25
- export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
26
- /**
27
- * Request method
28
- * @param config The OpenAPI configuration object
29
- * @param options The request options from the service
30
- * @returns CancelablePromise<T>
31
- * @throws ApiError
32
- */
33
- export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
34
- export {};
@@ -1,268 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- import FormData from 'form-data';
3
- import fetch, { Headers } from 'node-fetch';
4
- import { ApiError } from './ApiError.js';
5
- import { CancelablePromise } from './CancelablePromise.js';
6
- export const isDefined = (value) => {
7
- return value !== undefined && value !== null;
8
- };
9
- export const isString = (value) => {
10
- return typeof value === 'string';
11
- };
12
- export const isStringWithValue = (value) => {
13
- return isString(value) && value !== '';
14
- };
15
- export const isBlob = (value) => {
16
- return (typeof value === 'object' &&
17
- typeof value.type === 'string' &&
18
- typeof value.stream === 'function' &&
19
- typeof value.arrayBuffer === 'function' &&
20
- typeof value.constructor === 'function' &&
21
- typeof value.constructor.name === 'string' &&
22
- /^(Blob|File)$/.test(value.constructor.name) &&
23
- /^(Blob|File)$/.test(value[Symbol.toStringTag]));
24
- };
25
- export const isFormData = (value) => {
26
- return value instanceof FormData;
27
- };
28
- export const base64 = (str) => {
29
- try {
30
- return btoa(str);
31
- }
32
- catch (err) {
33
- return Buffer.from(str).toString('base64');
34
- }
35
- };
36
- export const getQueryString = (params) => {
37
- const qs = [];
38
- const append = (key, value) => {
39
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
40
- };
41
- const process = (key, value) => {
42
- if (isDefined(value)) {
43
- if (Array.isArray(value)) {
44
- value.forEach(v => {
45
- process(key, v);
46
- });
47
- }
48
- else if (typeof value === 'object') {
49
- Object.entries(value).forEach(([k, v]) => {
50
- process(`${key}[${k}]`, v);
51
- });
52
- }
53
- else {
54
- append(key, value);
55
- }
56
- }
57
- };
58
- Object.entries(params).forEach(([key, value]) => {
59
- process(key, value);
60
- });
61
- if (qs.length > 0) {
62
- return `?${qs.join('&')}`;
63
- }
64
- return '';
65
- };
66
- const getUrl = (config, options) => {
67
- const encoder = config.ENCODE_PATH || encodeURI;
68
- const path = options.url
69
- .replace('{api-version}', config.VERSION)
70
- .replace(/{(.*?)}/g, (substring, group) => {
71
- if (options.path?.hasOwnProperty(group)) {
72
- return encoder(String(options.path[group]));
73
- }
74
- return substring;
75
- });
76
- const url = `${config.BASE}${path}`;
77
- if (options.query) {
78
- return `${url}${getQueryString(options.query)}`;
79
- }
80
- return url;
81
- };
82
- export const getFormData = (options) => {
83
- if (options.formData) {
84
- const formData = new FormData();
85
- const process = (key, value) => {
86
- if (isString(value) || isBlob(value)) {
87
- formData.append(key, value);
88
- }
89
- else {
90
- formData.append(key, JSON.stringify(value));
91
- }
92
- };
93
- Object.entries(options.formData)
94
- .filter(([_, value]) => isDefined(value))
95
- .forEach(([key, value]) => {
96
- if (Array.isArray(value)) {
97
- value.forEach(v => process(key, v));
98
- }
99
- else {
100
- process(key, value);
101
- }
102
- });
103
- return formData;
104
- }
105
- return undefined;
106
- };
107
- export const resolve = async (options, resolver) => {
108
- if (typeof resolver === 'function') {
109
- return resolver(options);
110
- }
111
- return resolver;
112
- };
113
- export const getHeaders = async (config, options) => {
114
- const token = await resolve(options, config.TOKEN);
115
- const username = await resolve(options, config.USERNAME);
116
- const password = await resolve(options, config.PASSWORD);
117
- const additionalHeaders = await resolve(options, config.HEADERS);
118
- const headers = Object.entries({
119
- Accept: 'application/json',
120
- ...additionalHeaders,
121
- ...options.headers,
122
- })
123
- .filter(([_, value]) => isDefined(value))
124
- .reduce((headers, [key, value]) => ({
125
- ...headers,
126
- [key]: String(value),
127
- }), {});
128
- if (isStringWithValue(token)) {
129
- headers['Authorization'] = `Bearer ${token}`;
130
- }
131
- if (isStringWithValue(username) && isStringWithValue(password)) {
132
- const credentials = base64(`${username}:${password}`);
133
- headers['Authorization'] = `Basic ${credentials}`;
134
- }
135
- if (options.body) {
136
- if (options.mediaType) {
137
- headers['Content-Type'] = options.mediaType;
138
- }
139
- else if (isBlob(options.body)) {
140
- headers['Content-Type'] = 'application/octet-stream';
141
- }
142
- else if (isString(options.body)) {
143
- headers['Content-Type'] = 'text/plain';
144
- }
145
- else if (!isFormData(options.body)) {
146
- headers['Content-Type'] = 'application/json';
147
- }
148
- }
149
- return new Headers(headers);
150
- };
151
- export const getRequestBody = (options) => {
152
- if (options.body !== undefined) {
153
- if (options.mediaType?.includes('/json')) {
154
- return JSON.stringify(options.body);
155
- }
156
- else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
157
- return options.body;
158
- }
159
- else {
160
- return JSON.stringify(options.body);
161
- }
162
- }
163
- return undefined;
164
- };
165
- export const sendRequest = async (options, url, body, formData, headers, onCancel) => {
166
- const controller = new AbortController();
167
- const request = {
168
- headers,
169
- method: options.method,
170
- body: body ?? formData,
171
- signal: controller.signal,
172
- };
173
- onCancel(() => controller.abort());
174
- return await fetch(url, request);
175
- };
176
- export const getResponseHeader = (response, responseHeader) => {
177
- if (responseHeader) {
178
- const content = response.headers.get(responseHeader);
179
- if (isString(content)) {
180
- return content;
181
- }
182
- }
183
- return undefined;
184
- };
185
- export const getResponseBody = async (response) => {
186
- if (response.status !== 204) {
187
- try {
188
- const contentType = response.headers.get('Content-Type');
189
- if (contentType) {
190
- const jsonTypes = ['application/json', 'application/problem+json'];
191
- const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
192
- if (isJSON) {
193
- return await response.json();
194
- }
195
- else {
196
- return await response.text();
197
- }
198
- }
199
- }
200
- catch (error) {
201
- console.error(error);
202
- }
203
- }
204
- return undefined;
205
- };
206
- export const catchErrorCodes = (options, result) => {
207
- const errors = {
208
- 400: 'Bad Request',
209
- 401: 'Unauthorized',
210
- 403: 'Forbidden',
211
- 404: 'Not Found',
212
- 500: 'Internal Server Error',
213
- 502: 'Bad Gateway',
214
- 503: 'Service Unavailable',
215
- ...options.errors,
216
- };
217
- const error = errors[result.status];
218
- if (error) {
219
- throw new ApiError(options, result, error);
220
- }
221
- if (!result.ok) {
222
- const errorStatus = result.status ?? 'unknown';
223
- const errorStatusText = result.statusText ?? 'unknown';
224
- const errorBody = (() => {
225
- try {
226
- return JSON.stringify(result.body, null, 2);
227
- }
228
- catch (e) {
229
- return undefined;
230
- }
231
- })();
232
- throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
233
- }
234
- };
235
- /**
236
- * Request method
237
- * @param config The OpenAPI configuration object
238
- * @param options The request options from the service
239
- * @returns CancelablePromise<T>
240
- * @throws ApiError
241
- */
242
- export const request = (config, options) => {
243
- return new CancelablePromise(async (resolve, reject, onCancel) => {
244
- try {
245
- const url = getUrl(config, options);
246
- const formData = getFormData(options);
247
- const body = getRequestBody(options);
248
- const headers = await getHeaders(config, options);
249
- if (!onCancel.isCancelled) {
250
- const response = await sendRequest(options, url, body, formData, headers, onCancel);
251
- const responseBody = await getResponseBody(response);
252
- const responseHeader = getResponseHeader(response, options.responseHeader);
253
- const result = {
254
- url,
255
- ok: response.ok,
256
- status: response.status,
257
- statusText: response.statusText,
258
- body: responseHeader ?? responseBody,
259
- };
260
- catchErrorCodes(options, result);
261
- resolve(result.body);
262
- }
263
- }
264
- catch (error) {
265
- reject(error);
266
- }
267
- });
268
- };
@@ -1,29 +0,0 @@
1
- export { HttpService } from './HttpService.js';
2
- export { ApiError } from './core/ApiError.js';
3
- export { BaseHttpRequest } from './core/BaseHttpRequest.js';
4
- export { CancelablePromise, CancelError } from './core/CancelablePromise.js';
5
- export { OpenAPI } from './core/OpenAPI.js';
6
- export type { OpenAPIConfig } from './core/OpenAPI.js';
7
- export { Event } from './models/Event.js';
8
- export type { IdOrSlug } from './models/IdOrSlug.js';
9
- export type { Meter } from './models/Meter.js';
10
- export { MeterAggregation } from './models/MeterAggregation.js';
11
- export type { meterIdOrSlug } from './models/meterIdOrSlug.js';
12
- export type { MeterValue } from './models/MeterValue.js';
13
- export type { Namespace } from './models/Namespace.js';
14
- export type { namespaceParam } from './models/namespaceParam.js';
15
- export type { Problem } from './models/Problem.js';
16
- export { WindowSize } from './models/WindowSize.js';
17
- export { $Event } from './schemas/$Event.js';
18
- export { $IdOrSlug } from './schemas/$IdOrSlug.js';
19
- export { $Meter } from './schemas/$Meter.js';
20
- export { $MeterAggregation } from './schemas/$MeterAggregation.js';
21
- export { $meterIdOrSlug } from './schemas/$meterIdOrSlug.js';
22
- export { $MeterValue } from './schemas/$MeterValue.js';
23
- export { $Namespace } from './schemas/$Namespace.js';
24
- export { $namespaceParam } from './schemas/$namespaceParam.js';
25
- export { $Problem } from './schemas/$Problem.js';
26
- export { $WindowSize } from './schemas/$WindowSize.js';
27
- export { DefaultService } from './services/DefaultService.js';
28
- export { EventsService } from './services/EventsService.js';
29
- export { MetersService } from './services/MetersService.js';
@@ -1,22 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export { HttpService } from './HttpService.js';
3
- export { ApiError } from './core/ApiError.js';
4
- export { BaseHttpRequest } from './core/BaseHttpRequest.js';
5
- export { CancelablePromise, CancelError } from './core/CancelablePromise.js';
6
- export { OpenAPI } from './core/OpenAPI.js';
7
- export { Event } from './models/Event.js';
8
- export { MeterAggregation } from './models/MeterAggregation.js';
9
- export { WindowSize } from './models/WindowSize.js';
10
- export { $Event } from './schemas/$Event.js';
11
- export { $IdOrSlug } from './schemas/$IdOrSlug.js';
12
- export { $Meter } from './schemas/$Meter.js';
13
- export { $MeterAggregation } from './schemas/$MeterAggregation.js';
14
- export { $meterIdOrSlug } from './schemas/$meterIdOrSlug.js';
15
- export { $MeterValue } from './schemas/$MeterValue.js';
16
- export { $Namespace } from './schemas/$Namespace.js';
17
- export { $namespaceParam } from './schemas/$namespaceParam.js';
18
- export { $Problem } from './schemas/$Problem.js';
19
- export { $WindowSize } from './schemas/$WindowSize.js';
20
- export { DefaultService } from './services/DefaultService.js';
21
- export { EventsService } from './services/EventsService.js';
22
- export { MetersService } from './services/MetersService.js';
@@ -1,49 +0,0 @@
1
- /**
2
- * CloudEvents Specification JSON Schema
3
- */
4
- export type Event = {
5
- /**
6
- * Identifies the event.
7
- */
8
- id: string;
9
- /**
10
- * Identifies the context in which an event happened.
11
- */
12
- source: string;
13
- /**
14
- * The version of the CloudEvents specification which the event uses.
15
- */
16
- specversion: string;
17
- /**
18
- * Describes the type of event related to the originating occurrence.
19
- */
20
- type: string;
21
- /**
22
- * Content type of the data value. Must adhere to RFC 2046 format.
23
- */
24
- datacontenttype?: Event.datacontenttype | null;
25
- /**
26
- * Identifies the schema that data adheres to.
27
- */
28
- dataschema?: string | null;
29
- /**
30
- * Describes the subject of the event in the context of the event producer (identified by source).
31
- */
32
- subject: string;
33
- /**
34
- * Timestamp of when the occurrence happened. Must adhere to RFC 3339.
35
- */
36
- time?: string | null;
37
- /**
38
- * The event payload.
39
- */
40
- data?: Record<string, any>;
41
- };
42
- export declare namespace Event {
43
- /**
44
- * Content type of the data value. Must adhere to RFC 2046 format.
45
- */
46
- enum datacontenttype {
47
- APPLICATION_JSON = "application/json"
48
- }
49
- }
@@ -1,11 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export var Event;
3
- (function (Event) {
4
- /**
5
- * Content type of the data value. Must adhere to RFC 2046 format.
6
- */
7
- let datacontenttype;
8
- (function (datacontenttype) {
9
- datacontenttype["APPLICATION_JSON"] = "application/json";
10
- })(datacontenttype = Event.datacontenttype || (Event.datacontenttype = {}));
11
- })(Event || (Event = {}));
@@ -1 +0,0 @@
1
- export type IdOrSlug = string;
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,30 +0,0 @@
1
- import type { MeterAggregation } from './MeterAggregation.js';
2
- import type { WindowSize } from './WindowSize.js';
3
- export type Meter = {
4
- /**
5
- * A unique identifier for the meter.
6
- */
7
- readonly id?: string;
8
- /**
9
- * A unique identifier for the meter.
10
- */
11
- slug: string;
12
- /**
13
- * A description of the meter.
14
- */
15
- description?: string | null;
16
- aggregation: MeterAggregation;
17
- /**
18
- * The event type to aggregate.
19
- */
20
- eventType: string;
21
- /**
22
- * JSONPath expression to extract the value from the event data.
23
- */
24
- valueProperty: string;
25
- /**
26
- * Named JSONPath expressions to extract the group by values from the event data.
27
- */
28
- groupBy?: Record<string, string>;
29
- windowSize: WindowSize;
30
- };
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * The aggregation type to use for the meter.
3
- */
4
- export declare enum MeterAggregation {
5
- SUM = "SUM",
6
- COUNT = "COUNT",
7
- AVG = "AVG",
8
- MIN = "MIN",
9
- MAX = "MAX"
10
- }
@@ -1,12 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- /**
3
- * The aggregation type to use for the meter.
4
- */
5
- export var MeterAggregation;
6
- (function (MeterAggregation) {
7
- MeterAggregation["SUM"] = "SUM";
8
- MeterAggregation["COUNT"] = "COUNT";
9
- MeterAggregation["AVG"] = "AVG";
10
- MeterAggregation["MIN"] = "MIN";
11
- MeterAggregation["MAX"] = "MAX";
12
- })(MeterAggregation || (MeterAggregation = {}));
@@ -1,10 +0,0 @@
1
- export type MeterValue = {
2
- /**
3
- * The subject of the meter value.
4
- */
5
- subject?: string;
6
- windowStart?: string;
7
- windowEnd?: string;
8
- value?: number;
9
- groupBy?: Record<string, string> | null;
10
- };
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,6 +0,0 @@
1
- export type Namespace = {
2
- /**
3
- * A namespace
4
- */
5
- namespace: string;
6
- };
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * A Problem Details object (RFC 7807)
3
- */
4
- export type Problem = Record<string, any>;
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,5 +0,0 @@
1
- export declare enum WindowSize {
2
- MINUTE = "MINUTE",
3
- HOUR = "HOUR",
4
- DAY = "DAY"
5
- }
@@ -1,7 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export var WindowSize;
3
- (function (WindowSize) {
4
- WindowSize["MINUTE"] = "MINUTE";
5
- WindowSize["HOUR"] = "HOUR";
6
- WindowSize["DAY"] = "DAY";
7
- })(WindowSize || (WindowSize = {}));
@@ -1,5 +0,0 @@
1
- import type { IdOrSlug } from './IdOrSlug.js';
2
- /**
3
- * A unique identifier for the meter.
4
- */
5
- export type meterIdOrSlug = IdOrSlug;
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Optional namespace
3
- */
4
- export type namespaceParam = string;
@@ -1,2 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do no edit */
2
- export {};
@@ -1,59 +0,0 @@
1
- export declare const $Event: {
2
- readonly description: "CloudEvents Specification JSON Schema";
3
- readonly properties: {
4
- readonly id: {
5
- readonly type: "string";
6
- readonly description: "Identifies the event.";
7
- readonly isRequired: true;
8
- readonly minLength: 1;
9
- };
10
- readonly source: {
11
- readonly type: "string";
12
- readonly description: "Identifies the context in which an event happened.";
13
- readonly isRequired: true;
14
- readonly format: "uri-reference";
15
- readonly minLength: 1;
16
- };
17
- readonly specversion: {
18
- readonly type: "string";
19
- readonly description: "The version of the CloudEvents specification which the event uses.";
20
- readonly isRequired: true;
21
- readonly minLength: 1;
22
- };
23
- readonly type: {
24
- readonly type: "string";
25
- readonly description: "Describes the type of event related to the originating occurrence.";
26
- readonly isRequired: true;
27
- };
28
- readonly datacontenttype: {
29
- readonly type: "Enum";
30
- readonly isNullable: true;
31
- };
32
- readonly dataschema: {
33
- readonly type: "string";
34
- readonly description: "Identifies the schema that data adheres to.";
35
- readonly isNullable: true;
36
- readonly format: "uri";
37
- readonly minLength: 1;
38
- };
39
- readonly subject: {
40
- readonly type: "string";
41
- readonly description: "Describes the subject of the event in the context of the event producer (identified by source).";
42
- readonly isRequired: true;
43
- readonly minLength: 1;
44
- };
45
- readonly time: {
46
- readonly type: "string";
47
- readonly description: "Timestamp of when the occurrence happened. Must adhere to RFC 3339.";
48
- readonly isNullable: true;
49
- readonly format: "date-time";
50
- readonly minLength: 1;
51
- };
52
- readonly data: {
53
- readonly type: "dictionary";
54
- readonly contains: {
55
- readonly properties: {};
56
- };
57
- };
58
- };
59
- };