Skip to content

Commit

Permalink
chore: upgrade to latest package version
Browse files Browse the repository at this point in the history
This applies the fixes for hey-api/openapi-ts#474 and hey-api/openapi-ts#484
  • Loading branch information
paambaati committed May 7, 2024
1 parent a4ee6aa commit 4706718
Show file tree
Hide file tree
Showing 15 changed files with 8,805 additions and 661 deletions.
87 changes: 47 additions & 40 deletions generated/NeonClient.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,53 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseHttpRequest } from './core/BaseHttpRequest';
import type { OpenAPIConfig } from './core/OpenAPI';
import { Interceptors } from './core/OpenAPI';
import { FetchHttpRequest } from './core/FetchHttpRequest';
import { ApiKeyService } from './services/ApiKeyService';
import { BranchService } from './services/BranchService';
import { ConsumptionService } from './services/ConsumptionService';
import { EndpointService } from './services/EndpointService';
import { OperationService } from './services/OperationService';
import { ProjectService } from './services/ProjectService';
import { UsersService } from './services/UsersService';

import { ApiKeyService } from './services.gen';
import { BranchService } from './services.gen';
import { ConsumptionService } from './services.gen';
import { EndpointService } from './services.gen';
import { OperationService } from './services.gen';
import { ProjectService } from './services.gen';
import { UsersService } from './services.gen';

type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;

export class NeonClient {
public readonly apiKey: ApiKeyService;
public readonly branch: BranchService;
public readonly consumption: ConsumptionService;
public readonly endpoint: EndpointService;
public readonly operation: OperationService;
public readonly project: ProjectService;
public readonly users: UsersService;
public readonly request: BaseHttpRequest;
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = FetchHttpRequest) {
this.request = new HttpRequest({
BASE: config?.BASE ?? 'https://console.neon.tech/api/v2',
VERSION: config?.VERSION ?? '2',
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
CREDENTIALS: config?.CREDENTIALS ?? 'include',
TOKEN: config?.TOKEN,
USERNAME: config?.USERNAME,
PASSWORD: config?.PASSWORD,
HEADERS: config?.HEADERS,
ENCODE_PATH: config?.ENCODE_PATH,
});
this.apiKey = new ApiKeyService(this.request);
this.branch = new BranchService(this.request);
this.consumption = new ConsumptionService(this.request);
this.endpoint = new EndpointService(this.request);
this.operation = new OperationService(this.request);
this.project = new ProjectService(this.request);
this.users = new UsersService(this.request);
}
}

public readonly apiKey: ApiKeyService;
public readonly branch: BranchService;
public readonly consumption: ConsumptionService;
public readonly endpoint: EndpointService;
public readonly operation: OperationService;
public readonly project: ProjectService;
public readonly users: UsersService;

public readonly request: BaseHttpRequest;

constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = FetchHttpRequest) {
this.request = new HttpRequest({
BASE: config?.BASE ?? 'https://console.neon.tech/api/v2',
VERSION: config?.VERSION ?? '2',
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
CREDENTIALS: config?.CREDENTIALS ?? 'include',
TOKEN: config?.TOKEN,
USERNAME: config?.USERNAME,
PASSWORD: config?.PASSWORD,
HEADERS: config?.HEADERS,
ENCODE_PATH: config?.ENCODE_PATH,
interceptors: {
request: config?.interceptors?.request ?? new Interceptors(),
response: config?.interceptors?.response ?? new Interceptors(),
},
});

this.apiKey = new ApiKeyService(this.request);
this.branch = new BranchService(this.request);
this.consumption = new ConsumptionService(this.request);
this.endpoint = new EndpointService(this.request);
this.operation = new OperationService(this.request);
this.project = new ProjectService(this.request);
this.users = new UsersService(this.request);
}
}
34 changes: 15 additions & 19 deletions generated/core/ApiError.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';

export class ApiError extends Error {
public readonly url: string;
public readonly status: number;
public readonly statusText: string;
public readonly body: any;
public readonly request: ApiRequestOptions;
public readonly url: string;
public readonly status: number;
public readonly statusText: string;
public readonly body: unknown;
public readonly request: ApiRequestOptions;

constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
super(message);
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
super(message);

this.name = 'ApiError';
this.url = response.url;
this.status = response.status;
this.statusText = response.statusText;
this.body = response.body;
this.request = request;
}
}
this.name = 'ApiError';
this.url = response.url;
this.status = response.status;
this.statusText = response.statusText;
this.body = response.body;
this.request = request;
}
}
28 changes: 12 additions & 16 deletions generated/core/ApiRequestOptions.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ApiRequestOptions = {
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly url: string;
readonly path?: Record<string, any>;
readonly cookies?: Record<string, any>;
readonly headers?: Record<string, any>;
readonly query?: Record<string, any>;
readonly formData?: Record<string, any>;
readonly body?: any;
readonly mediaType?: string;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly url: string;
readonly path?: Record<string, unknown>;
readonly cookies?: Record<string, unknown>;
readonly headers?: Record<string, unknown>;
readonly query?: Record<string, unknown>;
readonly formData?: Record<string, unknown>;
readonly body?: any;
readonly mediaType?: string;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};
18 changes: 7 additions & 11 deletions generated/core/ApiResult.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ApiResult = {
readonly url: string;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly body: any;
};
export type ApiResult<TData = any> = {
readonly body: TData;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly url: string;
};
10 changes: 3 additions & 7 deletions generated/core/BaseHttpRequest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { CancelablePromise } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';

export abstract class BaseHttpRequest {

constructor(public readonly config: OpenAPIConfig) {}
constructor(public readonly config: OpenAPIConfig) {}

public abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
}
public abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
}

0 comments on commit 4706718

Please sign in to comment.