feat(chat): added base for chat service
added front html nigel in the mud route function with openapi - gen clean up the code a little after pull request
This commit is contained in:
parent
73a4946d17
commit
9ce9fa44e4
122 changed files with 9354 additions and 2615 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* @fastify/swagger
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 9.6.0
|
||||
* The version of the OpenAPI document: 9.6.1
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
|
@ -15,10 +15,12 @@
|
|||
|
||||
import * as runtime from '../runtime';
|
||||
import type {
|
||||
ChatTest200Response,
|
||||
DisableOtp200Response,
|
||||
DisableOtp401Response,
|
||||
DisableOtp500Response,
|
||||
EnableOtp200Response,
|
||||
EnableOtp401Response,
|
||||
GetUser200Response,
|
||||
GetUser403Response,
|
||||
GetUser404Response,
|
||||
|
|
@ -40,9 +42,12 @@ import type {
|
|||
Signin400Response,
|
||||
Signin500Response,
|
||||
StatusOtp200Response,
|
||||
StatusOtp401Response,
|
||||
StatusOtp500Response,
|
||||
} from '../models/index';
|
||||
import {
|
||||
ChatTest200ResponseFromJSON,
|
||||
ChatTest200ResponseToJSON,
|
||||
DisableOtp200ResponseFromJSON,
|
||||
DisableOtp200ResponseToJSON,
|
||||
DisableOtp401ResponseFromJSON,
|
||||
|
|
@ -51,6 +56,8 @@ import {
|
|||
DisableOtp500ResponseToJSON,
|
||||
EnableOtp200ResponseFromJSON,
|
||||
EnableOtp200ResponseToJSON,
|
||||
EnableOtp401ResponseFromJSON,
|
||||
EnableOtp401ResponseToJSON,
|
||||
GetUser200ResponseFromJSON,
|
||||
GetUser200ResponseToJSON,
|
||||
GetUser403ResponseFromJSON,
|
||||
|
|
@ -93,6 +100,8 @@ import {
|
|||
Signin500ResponseToJSON,
|
||||
StatusOtp200ResponseFromJSON,
|
||||
StatusOtp200ResponseToJSON,
|
||||
StatusOtp401ResponseFromJSON,
|
||||
StatusOtp401ResponseToJSON,
|
||||
StatusOtp500ResponseFromJSON,
|
||||
StatusOtp500ResponseToJSON,
|
||||
} from '../models/index';
|
||||
|
|
@ -118,6 +127,48 @@ export interface SigninRequest {
|
|||
*/
|
||||
export class OpenapiOtherApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async chatTestRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChatTest200Response | StatusOtp401Response>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
|
||||
let urlPath = `/api/chat/test`;
|
||||
|
||||
const response = await this.request({
|
||||
path: urlPath,
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
|
||||
// This allows typed access to error responses (4xx, 5xx) and other status codes.
|
||||
// The code routes responses based on the actual HTTP status code and returns
|
||||
// appropriately typed ApiResponse wrappers for each status code.
|
||||
if (response.status === 200) {
|
||||
// Object response for status 200
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => ChatTest200ResponseFromJSON(jsonValue));
|
||||
}
|
||||
if (response.status === 401) {
|
||||
// Object response for status 401
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => StatusOtp401ResponseFromJSON(jsonValue));
|
||||
}
|
||||
// CHANGED: Throw error if status code is not handled by any of the defined responses
|
||||
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
|
||||
// Only throw if responses were defined but none matched the actual status code
|
||||
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 401`);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async chatTest(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChatTest200Response | StatusOtp401Response> {
|
||||
const response = await this.chatTestRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async disableOtpRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DisableOtp200Response | DisableOtp401Response | DisableOtp500Response>> {
|
||||
|
|
@ -166,7 +217,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
|
||||
/**
|
||||
*/
|
||||
async enableOtpRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnableOtp200Response | DisableOtp401Response>> {
|
||||
async enableOtpRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnableOtp200Response | EnableOtp401Response>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
|
@ -191,7 +242,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
}
|
||||
if (response.status === 401) {
|
||||
// Object response for status 401
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => DisableOtp401ResponseFromJSON(jsonValue));
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => EnableOtp401ResponseFromJSON(jsonValue));
|
||||
}
|
||||
// CHANGED: Throw error if status code is not handled by any of the defined responses
|
||||
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
|
||||
|
|
@ -201,14 +252,14 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
|
||||
/**
|
||||
*/
|
||||
async enableOtp(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnableOtp200Response | DisableOtp401Response> {
|
||||
async enableOtp(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnableOtp200Response | EnableOtp401Response> {
|
||||
const response = await this.enableOtpRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetUser200Response | DisableOtp401Response | GetUser403Response | GetUser404Response>> {
|
||||
async getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetUser200Response | StatusOtp401Response | GetUser403Response | GetUser404Response>> {
|
||||
if (requestParameters['user'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'user',
|
||||
|
|
@ -241,7 +292,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
}
|
||||
if (response.status === 401) {
|
||||
// Object response for status 401
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => DisableOtp401ResponseFromJSON(jsonValue));
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => StatusOtp401ResponseFromJSON(jsonValue));
|
||||
}
|
||||
if (response.status === 403) {
|
||||
// Object response for status 403
|
||||
|
|
@ -259,7 +310,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
|
||||
/**
|
||||
*/
|
||||
async getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetUser200Response | DisableOtp401Response | GetUser403Response | GetUser404Response> {
|
||||
async getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetUser200Response | StatusOtp401Response | GetUser403Response | GetUser404Response> {
|
||||
const response = await this.getUserRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
|
@ -522,7 +573,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
|
||||
/**
|
||||
*/
|
||||
async statusOtpRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StatusOtp200Response | DisableOtp401Response | StatusOtp500Response>> {
|
||||
async statusOtpRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StatusOtp200Response | StatusOtp401Response | StatusOtp500Response>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
|
@ -547,7 +598,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
}
|
||||
if (response.status === 401) {
|
||||
// Object response for status 401
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => DisableOtp401ResponseFromJSON(jsonValue));
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => StatusOtp401ResponseFromJSON(jsonValue));
|
||||
}
|
||||
if (response.status === 500) {
|
||||
// Object response for status 500
|
||||
|
|
@ -561,7 +612,7 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
|
|||
|
||||
/**
|
||||
*/
|
||||
async statusOtp(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StatusOtp200Response | DisableOtp401Response | StatusOtp500Response> {
|
||||
async statusOtp(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StatusOtp200Response | StatusOtp401Response | StatusOtp500Response> {
|
||||
const response = await this.statusOtpRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue