```yaml
docs(api): 更新Swagger文档以统一路径和定义引用格式 Swagger文档中的路径和定义引用格式已标准化,确保一致性和减少混乱。此更改包括将所有路径和引用转换为小写,并移除定义中的重复引号。 修复了由不一致的引用格式引起的解析错误,提高了文档的准确性和可读性。 ```
This commit is contained in:
parent
4439b142e3
commit
43a79e9bd4
152
api/swagger.yaml
152
api/swagger.yaml
@ -32,7 +32,7 @@ definitions:
|
||||
rag-new_internal_entity.AssistantToolType:
|
||||
properties:
|
||||
assistant:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
assistant_id:
|
||||
type: integer
|
||||
created_at:
|
||||
@ -40,7 +40,7 @@ definitions:
|
||||
id:
|
||||
type: integer
|
||||
tool:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
tool_id:
|
||||
type: integer
|
||||
updated_at:
|
||||
@ -89,7 +89,7 @@ definitions:
|
||||
created_at:
|
||||
type: string
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutput"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutput'
|
||||
description:
|
||||
type: string
|
||||
discovery_url:
|
||||
@ -189,7 +189,7 @@ definitions:
|
||||
type: string
|
||||
function:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions'
|
||||
type: array
|
||||
homepage_url:
|
||||
type: string
|
||||
@ -212,7 +212,7 @@ definitions:
|
||||
properties:
|
||||
function:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction'
|
||||
type: array
|
||||
type:
|
||||
type: string
|
||||
@ -233,17 +233,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取 Assistant 列表
|
||||
@ -258,7 +258,7 @@ paths:
|
||||
name: assistant
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.AssistantCreateRequest"
|
||||
$ref: '#/definitions/rag-new_internal_schema.AssistantCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -266,15 +266,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建 Assistant
|
||||
@ -298,11 +298,11 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除 Assistant
|
||||
@ -324,15 +324,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取指定的 Assistant
|
||||
@ -355,17 +355,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantToolType"
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantToolType'
|
||||
type: array
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取 Assistant 所绑定的 Tool
|
||||
@ -393,15 +393,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 解绑 Tool
|
||||
@ -428,15 +428,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 绑定 Tool
|
||||
@ -459,17 +459,19 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取所有 Chat
|
||||
tags:
|
||||
- chat
|
||||
@ -483,7 +485,7 @@ paths:
|
||||
name: chat
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatCreateRequest"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -491,19 +493,21 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Create Chat
|
||||
tags:
|
||||
- chat
|
||||
@ -524,19 +528,19 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Delete Chat
|
||||
@ -560,25 +564,25 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_entity.ChatMessage"
|
||||
$ref: '#/definitions/rag-new_internal_entity.ChatMessage'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 查看聊天记录
|
||||
@ -599,7 +603,7 @@ paths:
|
||||
name: message
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageAddRequest"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageAddRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -607,32 +611,32 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 添加聊天记录
|
||||
@ -650,15 +654,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.CurrentUserResponse"
|
||||
$ref: '#/definitions/rag-new_internal_schema.CurrentUserResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Greet
|
||||
@ -687,32 +691,32 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- none: []
|
||||
summary: 流式传输聊天内容
|
||||
@ -730,17 +734,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List Tool
|
||||
@ -756,7 +760,7 @@ paths:
|
||||
name: tool
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolCreateRequest"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -764,15 +768,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Create Tool
|
||||
@ -797,11 +801,11 @@ paths:
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: DeleteTool
|
||||
@ -824,19 +828,19 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get Tool
|
||||
|
1726
src/api/api.ts
1726
src/api/api.ts
File diff suppressed because it is too large
Load Diff
@ -12,11 +12,12 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import type { Configuration } from "./configuration";
|
||||
|
||||
import type { Configuration } from './configuration';
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios";
|
||||
import globalAxios from "axios";
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||
import globalAxios from 'axios';
|
||||
|
||||
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
||||
|
||||
@ -49,17 +50,13 @@ export interface RequestArgs {
|
||||
export class BaseAPI {
|
||||
protected configuration: Configuration | undefined;
|
||||
|
||||
constructor(
|
||||
configuration?: Configuration,
|
||||
protected basePath: string = BASE_PATH,
|
||||
protected axios: AxiosInstance = globalAxios,
|
||||
) {
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath ?? basePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
@ -68,19 +65,16 @@ export class BaseAPI {
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
constructor(
|
||||
public field: string,
|
||||
msg?: string,
|
||||
) {
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
this.name = "RequiredError";
|
||||
this.name = "RequiredError"
|
||||
}
|
||||
}
|
||||
|
||||
interface ServerMap {
|
||||
[key: string]: {
|
||||
url: string;
|
||||
description: string;
|
||||
url: string,
|
||||
description: string,
|
||||
}[];
|
||||
}
|
||||
|
||||
@ -88,4 +82,5 @@ interface ServerMap {
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const operationServerMap: ServerMap = {};
|
||||
export const operationServerMap: ServerMap = {
|
||||
}
|
||||
|
@ -12,129 +12,95 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from "./configuration";
|
||||
import type { RequestArgs } from "./base";
|
||||
import type { AxiosInstance, AxiosResponse } from "axios";
|
||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import { RequiredError } from "./base";
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const DUMMY_BASE_URL = "https://example.com";
|
||||
export const DUMMY_BASE_URL = 'https://example.com'
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export const assertParamExists = function (
|
||||
functionName: string,
|
||||
paramName: string,
|
||||
paramValue: unknown,
|
||||
) {
|
||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new RequiredError(
|
||||
paramName,
|
||||
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
|
||||
);
|
||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setApiKeyToObject = async function (
|
||||
object: any,
|
||||
keyParamName: string,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue =
|
||||
typeof configuration.apiKey === "function"
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey(keyParamName)
|
||||
: await configuration.apiKey;
|
||||
object[keyParamName] = localVarApiKeyValue;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBasicAuthToObject = function (
|
||||
object: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = {
|
||||
username: configuration.username,
|
||||
password: configuration.password,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (
|
||||
object: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken =
|
||||
typeof configuration.accessToken === "function"
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken()
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setOAuthToObject = async function (
|
||||
object: any,
|
||||
name: string,
|
||||
scopes: string[],
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue =
|
||||
typeof configuration.accessToken === "function"
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken(name, scopes)
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function setFlattenedQueryParams(
|
||||
urlSearchParams: URLSearchParams,
|
||||
parameter: any,
|
||||
key: string = "",
|
||||
): void {
|
||||
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
||||
if (parameter == null) return;
|
||||
if (typeof parameter === "object") {
|
||||
if (Array.isArray(parameter)) {
|
||||
(parameter as any[]).forEach((item) =>
|
||||
setFlattenedQueryParams(urlSearchParams, item, key),
|
||||
);
|
||||
} else {
|
||||
Object.keys(parameter).forEach((currentKey) =>
|
||||
setFlattenedQueryParams(
|
||||
urlSearchParams,
|
||||
parameter[currentKey],
|
||||
`${key}${key !== "" ? "." : ""}${currentKey}`,
|
||||
),
|
||||
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
||||
}
|
||||
else {
|
||||
Object.keys(parameter).forEach(currentKey =>
|
||||
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (urlSearchParams.has(key)) {
|
||||
urlSearchParams.append(key, parameter);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
urlSearchParams.set(key, parameter);
|
||||
}
|
||||
}
|
||||
@ -148,55 +114,37 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||
const searchParams = new URLSearchParams(url.search);
|
||||
setFlattenedQueryParams(searchParams, objects);
|
||||
url.search = searchParams.toString();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const serializeDataIfNeeded = function (
|
||||
value: any,
|
||||
requestOptions: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
const nonString = typeof value !== "string";
|
||||
const needsSerialization =
|
||||
nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers["Content-Type"])
|
||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||
const nonString = typeof value !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: value || "";
|
||||
};
|
||||
: (value || "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const toPathString = function (url: URL) {
|
||||
return url.pathname + url.search + url.hash;
|
||||
};
|
||||
return url.pathname + url.search + url.hash
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (
|
||||
axiosArgs: RequestArgs,
|
||||
globalAxios: AxiosInstance,
|
||||
BASE_PATH: string,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(
|
||||
axios: AxiosInstance = globalAxios,
|
||||
basePath: string = BASE_PATH,
|
||||
) => {
|
||||
const axiosRequestArgs = {
|
||||
...axiosArgs.options,
|
||||
url:
|
||||
(axios.defaults.baseURL ? "" : (configuration?.basePath ?? basePath)) +
|
||||
axiosArgs.url,
|
||||
};
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -12,19 +12,12 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name: string) => string)
|
||||
| ((name: string) => Promise<string>);
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name?: string, scopes?: string[]) => string)
|
||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
basePath?: string;
|
||||
serverIndex?: number;
|
||||
baseOptions?: any;
|
||||
@ -37,11 +30,7 @@ export class Configuration {
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name: string) => string)
|
||||
| ((name: string) => Promise<string>);
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
@ -62,11 +51,7 @@ export class Configuration {
|
||||
* @param scopes oauth2 scope
|
||||
* @memberof Configuration
|
||||
*/
|
||||
accessToken?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name?: string, scopes?: string[]) => string)
|
||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
@ -119,14 +104,7 @@ export class Configuration {
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp(
|
||||
"^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$",
|
||||
"i",
|
||||
);
|
||||
return (
|
||||
mime !== null &&
|
||||
(jsonMime.test(mime) ||
|
||||
mime.toLowerCase() === "application/json-patch+json")
|
||||
);
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export * from "./configuration";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user