Skip to content

Commit

Permalink
fix(client): generate node client
Browse files Browse the repository at this point in the history
  • Loading branch information
hekike committed Nov 5, 2024
1 parent 7008721 commit 1dc3dc4
Show file tree
Hide file tree
Showing 7 changed files with 11,816 additions and 3,036 deletions.
34 changes: 32 additions & 2 deletions api/client/node/clients/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IncomingHttpHeaders } from 'http'
import { Dispatcher, request } from 'undici'
import { components } from '../schemas/openapi.js'

export type OpenMeterConfig = {
baseUrl: string
Expand All @@ -14,7 +13,38 @@ export type RequestOptions = {
headers?: IncomingHttpHeaders
}

export type Problem = components['schemas']['Problem']
export type Problem = {
/**
* Format: uri
* @description Type contains a URI that identifies the problem type.
* @default about:blank
* @example about:blank
*/
type: string
/**
* @description A a short, human-readable summary of the problem type.
* @example Bad Request
*/
title: string
/**
* Format: int16
* @description The HTTP status code generated by the origin server for this occurrence of the problem.
* @example 400
*/
status?: number
/**
* @description A human-readable explanation specific to this occurrence of the problem.
* @example The request body must be a JSON object.
*/
detail: string
/**
* Format: uri
* @description A URI reference that identifies the specific occurrence of the problem.
* @example urn:request:local/JMOlctsKV8-000001
*/
instance: string
[key: string]: (string | number) | undefined
}

type UndiciRequestOptions = { dispatcher?: Dispatcher } & Omit<
Dispatcher.RequestOptions,
Expand Down
2 changes: 1 addition & 1 deletion api/client/node/clients/entitlement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type Entitlement =
export type EntitlementMetered = components['schemas']['EntitlementMetered']
export type EntitlementStatic = components['schemas']['EntitlementStatic']
export type EntitlementBoolean = components['schemas']['EntitlementBoolean']
export type RecurringPeriodEnum = components['schemas']['RecurringPeriodEnum']
export type RecurringPeriodEnum = components['schemas']['RecurringPeriod']
export type EntitlementValue = components['schemas']['EntitlementValue']
export type WindowedBalanceHistory =
components['schemas']['WindowedBalanceHistory']
Expand Down
1 change: 1 addition & 0 deletions api/client/node/clients/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class EventsClient extends BaseClient {
time: ev.time?.toISOString(),
datacontenttype: ev.datacontenttype,
dataschema: ev.dataschema,
// @ts-expect-error data type
data: ev.data,
}

Expand Down
6 changes: 3 additions & 3 deletions api/client/node/clients/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ export type NotificationChannelCreateRequest =
export type ListNotificationChannelsQueryParams =
operations['listNotificationChannels']['parameters']['query']
export type NotificationChannelsResponse =
components['schemas']['NotificationChannelsResponse']
components['schemas']['NotificationChannelPaginatedResponse']

export type NotificationRule = components['schemas']['NotificationRule']
export type NotificationRuleCreateRequest =
components['schemas']['NotificationRuleCreateRequest']
export type ListNotificationRulesQueryParams =
operations['listNotificationRules']['parameters']['query']
export type NotificationRulesResponse =
components['schemas']['NotificationRulesResponse']
components['schemas']['NotificationRulePaginatedResponse']

export type NotificationEvent = components['schemas']['NotificationEvent']
export type ListNotificationEventsQueryParams =
operations['listNotificationEvents']['parameters']['query']
export type NotificationEventsResponse =
components['schemas']['NotificationEventsResponse']
components['schemas']['NotificationEventPaginatedResponse']

export class NotificationClient extends BaseClient {
public channels: NotificationChannelsClient
Expand Down
Loading

0 comments on commit 1dc3dc4

Please sign in to comment.