update swagger and api-client
This commit is contained in:
@@ -6,6 +6,7 @@ export namespace Schemas {
|
||||
up_since: string;
|
||||
version: string;
|
||||
};
|
||||
export type LoginRequest = { password: string; username: string };
|
||||
|
||||
// </Schemas>
|
||||
}
|
||||
@@ -13,6 +14,15 @@ export namespace Schemas {
|
||||
export namespace Endpoints {
|
||||
// <Endpoints>
|
||||
|
||||
export type post_Login = {
|
||||
method: "POST";
|
||||
path: "/api/auth/login";
|
||||
requestFormat: "json";
|
||||
parameters: {
|
||||
body: Schemas.LoginRequest;
|
||||
};
|
||||
responses: { 200: unknown; 401: unknown; 500: unknown };
|
||||
};
|
||||
export type get_Get_health_info = {
|
||||
method: "GET";
|
||||
path: "/api/health/info";
|
||||
@@ -26,6 +36,9 @@ export namespace Endpoints {
|
||||
|
||||
// <EndpointByMethod>
|
||||
export type EndpointByMethod = {
|
||||
post: {
|
||||
"/api/auth/login": Endpoints.post_Login;
|
||||
};
|
||||
get: {
|
||||
"/api/health/info": Endpoints.get_Get_health_info;
|
||||
};
|
||||
@@ -34,6 +47,7 @@ export type EndpointByMethod = {
|
||||
// </EndpointByMethod>
|
||||
|
||||
// <EndpointByMethod.Shorthands>
|
||||
export type PostEndpoints = EndpointByMethod["post"];
|
||||
export type GetEndpoints = EndpointByMethod["get"];
|
||||
// </EndpointByMethod.Shorthands>
|
||||
|
||||
@@ -267,6 +281,37 @@ export class ApiClient {
|
||||
return;
|
||||
};
|
||||
|
||||
// <ApiClient.post>
|
||||
post<Path extends keyof PostEndpoints, TEndpoint extends PostEndpoints[Path]>(
|
||||
path: Path,
|
||||
...params: MaybeOptionalArg<
|
||||
TEndpoint extends { parameters: infer UParams }
|
||||
? NotNever<UParams> extends true
|
||||
? UParams & { overrides?: RequestInit; withResponse?: false; throwOnStatusError?: boolean }
|
||||
: { overrides?: RequestInit; withResponse?: false; throwOnStatusError?: boolean }
|
||||
: { overrides?: RequestInit; withResponse?: false; throwOnStatusError?: boolean }
|
||||
>
|
||||
): Promise<Extract<InferResponseByStatus<TEndpoint, SuccessStatusCode>, { data: {} }>["data"]>;
|
||||
|
||||
post<Path extends keyof PostEndpoints, TEndpoint extends PostEndpoints[Path]>(
|
||||
path: Path,
|
||||
...params: MaybeOptionalArg<
|
||||
TEndpoint extends { parameters: infer UParams }
|
||||
? NotNever<UParams> extends true
|
||||
? UParams & { overrides?: RequestInit; withResponse?: true; throwOnStatusError?: boolean }
|
||||
: { overrides?: RequestInit; withResponse?: true; throwOnStatusError?: boolean }
|
||||
: { overrides?: RequestInit; withResponse?: true; throwOnStatusError?: boolean }
|
||||
>
|
||||
): Promise<SafeApiResponse<TEndpoint>>;
|
||||
|
||||
post<Path extends keyof PostEndpoints, _TEndpoint extends PostEndpoints[Path]>(
|
||||
path: Path,
|
||||
...params: MaybeOptionalArg<any>
|
||||
): Promise<any> {
|
||||
return this.request("post", path, ...params);
|
||||
}
|
||||
// </ApiClient.post>
|
||||
|
||||
// <ApiClient.get>
|
||||
get<Path extends keyof GetEndpoints, TEndpoint extends GetEndpoints[Path]>(
|
||||
path: Path,
|
||||
|
||||
Reference in New Issue
Block a user