Skip to content

Commit

Permalink
chore(client): regenerate with latest openapi typescript codegen version
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Mar 11, 2024
1 parent b8715a1 commit 94f8d3c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/client/src/generated/core/ApiResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ApiResult = {
readonly url: string;
export type ApiResult<TData = any> = {
readonly body: TData;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly body: any;
readonly url: string;
};
37 changes: 27 additions & 10 deletions packages/client/src/generated/core/OpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,47 @@
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { TConfig, TResult } from './types';

type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;

export type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
ENCODE_PATH?: ((path: string) => string) | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
RESULT?: TResult;
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
ENCODE_PATH?: ((path: string) => string) | undefined;
VERSION: string;
WITH_CREDENTIALS: boolean;
};

export const OpenAPI: OpenAPIConfig = {
BASE: '',
VERSION: '1.0.0',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
ENCODE_PATH: undefined,
HEADERS: undefined,
PASSWORD: undefined,
RESULT: 'body',
TOKEN: undefined,
USERNAME: undefined,
PASSWORD: undefined,
HEADERS: undefined,
ENCODE_PATH: undefined,
VERSION: '1.0.0',
WITH_CREDENTIALS: false,
};

export const mergeOpenApiConfig = <T extends TResult>(config: OpenAPIConfig, overrides: TConfig<T>) => {
const merged = { ...config };
Object.entries(overrides)
.filter(([key]) => key.startsWith('_'))
.forEach(([key, value]) => {
const k = key.slice(1).toLocaleUpperCase() as keyof typeof merged;
if (merged.hasOwnProperty(k)) {
// @ts-ignore
merged[k] = value;
}
});
return merged;
};
16 changes: 16 additions & 0 deletions packages/client/src/generated/core/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiResult } from './ApiResult';

export type TResult = 'body' | 'raw';

export type TApiResponse<T extends TResult, TData> =
Exclude<T, 'raw'> extends never
? ApiResult<TData>
: ApiResult<TData>['body'];

export type TConfig<T extends TResult> = {
_result?: T;
};

0 comments on commit 94f8d3c

Please sign in to comment.