| @@ -1,6 +1,5 @@ | |||
| // https://umijs.org/config/ | |||
| import { defineConfig } from '@umijs/max'; | |||
| import { join } from 'path'; | |||
| import defaultSettings from './defaultSettings'; | |||
| import proxy from './proxy'; | |||
| import routes from './routes'; | |||
| @@ -145,20 +144,7 @@ export default defineConfig({ | |||
| * @description 基于 openapi 的规范生成serve 和mock,能减少很多样板代码 | |||
| * @doc https://pro.ant.design/zh-cn/docs/openapi/ | |||
| */ | |||
| openAPI: [ | |||
| { | |||
| requestLibPath: "import { request } from '@umijs/max'", | |||
| // 或者使用在线的版本 | |||
| // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json" | |||
| schemaPath: join(__dirname, 'oneapi.json'), | |||
| mock: false, | |||
| }, | |||
| { | |||
| requestLibPath: "import { request } from '@umijs/max'", | |||
| schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json', | |||
| projectName: 'swagger', | |||
| }, | |||
| ], | |||
| // openAPI: [], | |||
| // mfsu: { | |||
| // strategy: 'normal', | |||
| // }, | |||
| @@ -1,593 +0,0 @@ | |||
| { | |||
| "openapi": "3.0.1", | |||
| "info": { | |||
| "title": "Ant Design Pro", | |||
| "version": "1.0.0" | |||
| }, | |||
| "servers": [ | |||
| { | |||
| "url": "http://localhost:8000/" | |||
| }, | |||
| { | |||
| "url": "https://localhost:8000/" | |||
| } | |||
| ], | |||
| "paths": { | |||
| "/api/currentUser": { | |||
| "get": { | |||
| "tags": ["api"], | |||
| "description": "获取当前的用户", | |||
| "operationId": "currentUser", | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/CurrentUser" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "x-swagger-router-controller": "api" | |||
| }, | |||
| "/api/login/captcha": { | |||
| "post": { | |||
| "description": "发送验证码", | |||
| "operationId": "getFakeCaptcha", | |||
| "tags": ["login"], | |||
| "parameters": [ | |||
| { | |||
| "name": "phone", | |||
| "in": "query", | |||
| "description": "手机号", | |||
| "schema": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| ], | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/FakeCaptcha" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "/api/login/outLogin": { | |||
| "post": { | |||
| "description": "登录接口", | |||
| "operationId": "outLogin", | |||
| "tags": ["login"], | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "type": "object" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "x-swagger-router-controller": "api" | |||
| }, | |||
| "/api/login/account": { | |||
| "post": { | |||
| "tags": ["login"], | |||
| "description": "登录接口", | |||
| "operationId": "login", | |||
| "requestBody": { | |||
| "description": "登录系统", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/LoginParams" | |||
| } | |||
| } | |||
| }, | |||
| "required": true | |||
| }, | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/LoginResult" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "x-codegen-request-body-name": "body" | |||
| }, | |||
| "x-swagger-router-controller": "api" | |||
| }, | |||
| "/api/notices": { | |||
| "summary": "getNotices", | |||
| "description": "NoticeIconItem", | |||
| "get": { | |||
| "tags": ["api"], | |||
| "operationId": "getNotices", | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/NoticeIconList" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "/api/rule": { | |||
| "get": { | |||
| "tags": ["rule"], | |||
| "description": "获取规则列表", | |||
| "operationId": "rule", | |||
| "parameters": [ | |||
| { | |||
| "name": "current", | |||
| "in": "query", | |||
| "description": "当前的页码", | |||
| "schema": { | |||
| "type": "number" | |||
| } | |||
| }, | |||
| { | |||
| "name": "pageSize", | |||
| "in": "query", | |||
| "description": "页面的容量", | |||
| "schema": { | |||
| "type": "number" | |||
| } | |||
| } | |||
| ], | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/RuleList" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "post": { | |||
| "tags": ["rule"], | |||
| "description": "新建规则", | |||
| "operationId": "addRule", | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/RuleListItem" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "put": { | |||
| "tags": ["rule"], | |||
| "description": "新建规则", | |||
| "operationId": "updateRule", | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/RuleListItem" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "delete": { | |||
| "tags": ["rule"], | |||
| "description": "删除规则", | |||
| "operationId": "removeRule", | |||
| "responses": { | |||
| "200": { | |||
| "description": "Success", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "type": "object" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "401": { | |||
| "description": "Error", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/ErrorResponse" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "x-swagger-router-controller": "api" | |||
| }, | |||
| "/swagger": { | |||
| "x-swagger-pipe": "swagger_raw" | |||
| } | |||
| }, | |||
| "components": { | |||
| "schemas": { | |||
| "CurrentUser": { | |||
| "type": "object", | |||
| "properties": { | |||
| "name": { | |||
| "type": "string" | |||
| }, | |||
| "avatar": { | |||
| "type": "string" | |||
| }, | |||
| "userid": { | |||
| "type": "string" | |||
| }, | |||
| "email": { | |||
| "type": "string" | |||
| }, | |||
| "signature": { | |||
| "type": "string" | |||
| }, | |||
| "title": { | |||
| "type": "string" | |||
| }, | |||
| "group": { | |||
| "type": "string" | |||
| }, | |||
| "tags": { | |||
| "type": "array", | |||
| "items": { | |||
| "type": "object", | |||
| "properties": { | |||
| "key": { | |||
| "type": "string" | |||
| }, | |||
| "label": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "notifyCount": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "unreadCount": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "country": { | |||
| "type": "string" | |||
| }, | |||
| "access": { | |||
| "type": "string" | |||
| }, | |||
| "geographic": { | |||
| "type": "object", | |||
| "properties": { | |||
| "province": { | |||
| "type": "object", | |||
| "properties": { | |||
| "label": { | |||
| "type": "string" | |||
| }, | |||
| "key": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "city": { | |||
| "type": "object", | |||
| "properties": { | |||
| "label": { | |||
| "type": "string" | |||
| }, | |||
| "key": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "address": { | |||
| "type": "string" | |||
| }, | |||
| "phone": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "LoginResult": { | |||
| "type": "object", | |||
| "properties": { | |||
| "status": { | |||
| "type": "string" | |||
| }, | |||
| "type": { | |||
| "type": "string" | |||
| }, | |||
| "currentAuthority": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "PageParams": { | |||
| "type": "object", | |||
| "properties": { | |||
| "current": { | |||
| "type": "number" | |||
| }, | |||
| "pageSize": { | |||
| "type": "number" | |||
| } | |||
| } | |||
| }, | |||
| "RuleListItem": { | |||
| "type": "object", | |||
| "properties": { | |||
| "key": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "disabled": { | |||
| "type": "boolean" | |||
| }, | |||
| "href": { | |||
| "type": "string" | |||
| }, | |||
| "avatar": { | |||
| "type": "string" | |||
| }, | |||
| "name": { | |||
| "type": "string" | |||
| }, | |||
| "owner": { | |||
| "type": "string" | |||
| }, | |||
| "desc": { | |||
| "type": "string" | |||
| }, | |||
| "callNo": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "status": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "updatedAt": { | |||
| "type": "string", | |||
| "format": "datetime" | |||
| }, | |||
| "createdAt": { | |||
| "type": "string", | |||
| "format": "datetime" | |||
| }, | |||
| "progress": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| } | |||
| } | |||
| }, | |||
| "RuleList": { | |||
| "type": "object", | |||
| "properties": { | |||
| "data": { | |||
| "type": "array", | |||
| "items": { | |||
| "$ref": "#/components/schemas/RuleListItem" | |||
| } | |||
| }, | |||
| "total": { | |||
| "type": "integer", | |||
| "description": "列表的内容总数", | |||
| "format": "int32" | |||
| }, | |||
| "success": { | |||
| "type": "boolean" | |||
| } | |||
| } | |||
| }, | |||
| "FakeCaptcha": { | |||
| "type": "object", | |||
| "properties": { | |||
| "code": { | |||
| "type": "integer", | |||
| "format": "int32" | |||
| }, | |||
| "status": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "LoginParams": { | |||
| "type": "object", | |||
| "properties": { | |||
| "username": { | |||
| "type": "string" | |||
| }, | |||
| "password": { | |||
| "type": "string" | |||
| }, | |||
| "autoLogin": { | |||
| "type": "boolean" | |||
| }, | |||
| "type": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "ErrorResponse": { | |||
| "required": ["errorCode"], | |||
| "type": "object", | |||
| "properties": { | |||
| "errorCode": { | |||
| "type": "string", | |||
| "description": "业务约定的错误码" | |||
| }, | |||
| "errorMessage": { | |||
| "type": "string", | |||
| "description": "业务上的错误信息" | |||
| }, | |||
| "success": { | |||
| "type": "boolean", | |||
| "description": "业务上的请求是否成功" | |||
| } | |||
| } | |||
| }, | |||
| "NoticeIconList": { | |||
| "type": "object", | |||
| "properties": { | |||
| "data": { | |||
| "type": "array", | |||
| "items": { | |||
| "$ref": "#/components/schemas/NoticeIconItem" | |||
| } | |||
| }, | |||
| "total": { | |||
| "type": "integer", | |||
| "description": "列表的内容总数", | |||
| "format": "int32" | |||
| }, | |||
| "success": { | |||
| "type": "boolean" | |||
| } | |||
| } | |||
| }, | |||
| "NoticeIconItemType": { | |||
| "title": "NoticeIconItemType", | |||
| "description": "已读未读列表的枚举", | |||
| "type": "string", | |||
| "properties": {}, | |||
| "enum": ["notification", "message", "event"] | |||
| }, | |||
| "NoticeIconItem": { | |||
| "type": "object", | |||
| "properties": { | |||
| "id": { | |||
| "type": "string" | |||
| }, | |||
| "extra": { | |||
| "type": "string", | |||
| "format": "any" | |||
| }, | |||
| "key": { "type": "string" }, | |||
| "read": { | |||
| "type": "boolean" | |||
| }, | |||
| "avatar": { | |||
| "type": "string" | |||
| }, | |||
| "title": { | |||
| "type": "string" | |||
| }, | |||
| "status": { | |||
| "type": "string" | |||
| }, | |||
| "datetime": { | |||
| "type": "string", | |||
| "format": "date" | |||
| }, | |||
| "description": { | |||
| "type": "string" | |||
| }, | |||
| "type": { | |||
| "extensions": { | |||
| "x-is-enum": true | |||
| }, | |||
| "$ref": "#/components/schemas/NoticeIconItemType" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1,11 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** 此处后端没有提供注释 GET /api/notices */ | |||
| export async function getNotices(options?: { [key: string]: any }) { | |||
| return request<API.NoticeIconList>('/api/notices', { | |||
| method: 'GET', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| @@ -1,12 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| // API 更新时间: | |||
| // API 唯一标识: | |||
| import * as api from './api'; | |||
| import * as login from './login'; | |||
| import * as rule from './rule'; | |||
| export default { | |||
| api, | |||
| login, | |||
| rule, | |||
| }; | |||
| @@ -1,38 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** 登录接口 POST /api/login/account */ | |||
| export async function login(body: API.LoginParams, options?: { [key: string]: any }) { | |||
| return request<API.LoginResult>('/api/login/account', { | |||
| method: 'POST', | |||
| headers: { | |||
| 'Content-Type': 'application/json', | |||
| }, | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** 发送验证码 POST /api/login/captcha */ | |||
| export async function getFakeCaptcha( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.getFakeCaptchaParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<API.FakeCaptcha>('/api/login/captcha', { | |||
| method: 'POST', | |||
| params: { | |||
| ...params, | |||
| }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** 登录接口 POST /api/login/outLogin */ | |||
| export async function outLogin(options?: { [key: string]: any }) { | |||
| return request<Record<string, any>>('/api/login/outLogin', { | |||
| method: 'POST', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| @@ -1,42 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** 获取规则列表 GET /api/rule */ | |||
| export async function rule( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.ruleParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<API.RuleList>('/api/rule', { | |||
| method: 'GET', | |||
| params: { | |||
| ...params, | |||
| }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** 新建规则 PUT /api/rule */ | |||
| export async function updateRule(options?: { [key: string]: any }) { | |||
| return request<API.RuleListItem>('/api/rule', { | |||
| method: 'PUT', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** 新建规则 POST /api/rule */ | |||
| export async function addRule(options?: { [key: string]: any }) { | |||
| return request<API.RuleListItem>('/api/rule', { | |||
| method: 'POST', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** 删除规则 DELETE /api/rule */ | |||
| export async function removeRule(options?: { [key: string]: any }) { | |||
| return request<Record<string, any>>('/api/rule', { | |||
| method: 'DELETE', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| @@ -1,114 +0,0 @@ | |||
| declare namespace API { | |||
| type CurrentUser = UserInfo & { | |||
| signature?: string; | |||
| title?: string; | |||
| group?: string; | |||
| tags?: { key?: string; label?: string }[]; | |||
| notifyCount?: number; | |||
| unreadCount?: number; | |||
| country?: string; | |||
| access?: string; | |||
| geographic?: { | |||
| province?: { label?: string; key?: string }; | |||
| city?: { label?: string; key?: string }; | |||
| }; | |||
| address?: string; | |||
| phone?: string; | |||
| roleNames?: { | |||
| roleName?: string; | |||
| }[]; | |||
| }; | |||
| type ErrorResponse = { | |||
| /** 业务约定的错误码 */ | |||
| errorCode: string; | |||
| /** 业务上的错误信息 */ | |||
| errorMessage?: string; | |||
| /** 业务上的请求是否成功 */ | |||
| success?: boolean; | |||
| }; | |||
| type FakeCaptcha = { | |||
| code?: number; | |||
| status?: string; | |||
| }; | |||
| type getFakeCaptchaParams = { | |||
| /** 手机号 */ | |||
| phone?: string; | |||
| }; | |||
| type LoginParams = { | |||
| username?: string; | |||
| password?: string; | |||
| uuid?: string; | |||
| autoLogin?: boolean; | |||
| type?: string; | |||
| }; | |||
| type LoginResult = { | |||
| code: number; | |||
| msg?: string; | |||
| type?: string; | |||
| data?: { | |||
| access_token?: string; | |||
| expires_in?: number; | |||
| }; | |||
| }; | |||
| type NoticeIconItem = { | |||
| id?: string; | |||
| extra?: string; | |||
| key?: string; | |||
| read?: boolean; | |||
| avatar?: string; | |||
| title?: string; | |||
| status?: string; | |||
| datetime?: string; | |||
| description?: string; | |||
| type?: NoticeIconItemType; | |||
| }; | |||
| type NoticeIconItemType = 'notification' | 'message' | 'event'; | |||
| type NoticeIconList = { | |||
| data?: NoticeIconItem[]; | |||
| /** 列表的内容总数 */ | |||
| total?: number; | |||
| success?: boolean; | |||
| }; | |||
| type PageParams = { | |||
| current?: number; | |||
| pageSize?: number; | |||
| }; | |||
| type RuleList = { | |||
| data?: RuleListItem[]; | |||
| /** 列表的内容总数 */ | |||
| total?: number; | |||
| success?: boolean; | |||
| }; | |||
| type RuleListItem = { | |||
| key?: number; | |||
| disabled?: boolean; | |||
| href?: string; | |||
| avatar?: string; | |||
| name?: string; | |||
| owner?: string; | |||
| desc?: string; | |||
| callNo?: number; | |||
| status?: number; | |||
| updatedAt?: string; | |||
| createdAt?: string; | |||
| progress?: number; | |||
| }; | |||
| type ruleParams = { | |||
| /** 当前的页码 */ | |||
| current?: number; | |||
| /** 页面的容量 */ | |||
| pageSize?: number; | |||
| }; | |||
| } | |||
| @@ -1,12 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| // API 更新时间: | |||
| // API 唯一标识: | |||
| import * as pet from './pet'; | |||
| import * as store from './store'; | |||
| import * as user from './user'; | |||
| export default { | |||
| pet, | |||
| store, | |||
| user, | |||
| }; | |||
| @@ -1,153 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** Update an existing pet PUT /pet */ | |||
| export async function updatePet(body: API.Pet, options?: { [key: string]: any }) { | |||
| return request<any>('/pet', { | |||
| method: 'PUT', | |||
| headers: { | |||
| 'Content-Type': 'application/json', | |||
| }, | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Add a new pet to the store POST /pet */ | |||
| export async function addPet(body: API.Pet, options?: { [key: string]: any }) { | |||
| return request<any>('/pet', { | |||
| method: 'POST', | |||
| headers: { | |||
| 'Content-Type': 'application/json', | |||
| }, | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Find pet by ID Returns a single pet GET /pet/${param0} */ | |||
| export async function getPetById( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.getPetByIdParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { petId: param0, ...queryParams } = params; | |||
| return request<API.Pet>(`/pet/${param0}`, { | |||
| method: 'GET', | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Updates a pet in the store with form data POST /pet/${param0} */ | |||
| export async function updatePetWithForm( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.updatePetWithFormParams, | |||
| body: { name?: string; status?: string }, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { petId: param0, ...queryParams } = params; | |||
| const formData = new FormData(); | |||
| Object.keys(body).forEach((ele) => { | |||
| const item = (body as any)[ele]; | |||
| if (item !== undefined && item !== null) { | |||
| formData.append( | |||
| ele, | |||
| typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item, | |||
| ); | |||
| } | |||
| }); | |||
| return request<any>(`/pet/${param0}`, { | |||
| method: 'POST', | |||
| params: { ...queryParams }, | |||
| data: formData, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Deletes a pet DELETE /pet/${param0} */ | |||
| export async function deletePet( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.deletePetParams & { | |||
| // header | |||
| api_key?: string; | |||
| }, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { petId: param0, ...queryParams } = params; | |||
| return request<any>(`/pet/${param0}`, { | |||
| method: 'DELETE', | |||
| headers: {}, | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** uploads an image POST /pet/${param0}/uploadImage */ | |||
| export async function uploadFile( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.uploadFileParams, | |||
| body: { additionalMetadata?: string; file?: string }, | |||
| file?: File, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { petId: param0, ...queryParams } = params; | |||
| const formData = new FormData(); | |||
| if (file) { | |||
| formData.append('file', file); | |||
| } | |||
| Object.keys(body).forEach((ele) => { | |||
| const item = (body as any)[ele]; | |||
| if (item !== undefined && item !== null) { | |||
| formData.append( | |||
| ele, | |||
| typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item, | |||
| ); | |||
| } | |||
| }); | |||
| return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, { | |||
| method: 'POST', | |||
| params: { ...queryParams }, | |||
| data: formData, | |||
| requestType: 'form', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */ | |||
| export async function findPetsByStatus( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.findPetsByStatusParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<API.Pet[]>('/pet/findByStatus', { | |||
| method: 'GET', | |||
| params: { | |||
| ...params, | |||
| }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */ | |||
| export async function findPetsByTags( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.findPetsByTagsParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<API.Pet[]>('/pet/findByTags', { | |||
| method: 'GET', | |||
| params: { | |||
| ...params, | |||
| }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| @@ -1,48 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */ | |||
| export async function getInventory(options?: { [key: string]: any }) { | |||
| return request<Record<string, any>>('/store/inventory', { | |||
| method: 'GET', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Place an order for a pet POST /store/order */ | |||
| export async function placeOrder(body: API.Order, options?: { [key: string]: any }) { | |||
| return request<API.Order>('/store/order', { | |||
| method: 'POST', | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */ | |||
| export async function getOrderById( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.getOrderByIdParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { orderId: param0, ...queryParams } = params; | |||
| return request<API.Order>(`/store/order/${param0}`, { | |||
| method: 'GET', | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */ | |||
| export async function deleteOrder( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.deleteOrderParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { orderId: param0, ...queryParams } = params; | |||
| return request<any>(`/store/order/${param0}`, { | |||
| method: 'DELETE', | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| @@ -1,112 +0,0 @@ | |||
| declare namespace API { | |||
| type ApiResponse = { | |||
| code?: number; | |||
| type?: string; | |||
| message?: string; | |||
| }; | |||
| type Category = { | |||
| id?: number; | |||
| name?: string; | |||
| }; | |||
| type deleteOrderParams = { | |||
| /** ID of the order that needs to be deleted */ | |||
| orderId: number; | |||
| }; | |||
| type deletePetParams = { | |||
| api_key?: string; | |||
| /** Pet id to delete */ | |||
| petId: number; | |||
| }; | |||
| type deleteUserParams = { | |||
| /** The name that needs to be deleted */ | |||
| username: string; | |||
| }; | |||
| type findPetsByStatusParams = { | |||
| /** Status values that need to be considered for filter */ | |||
| status: ('available' | 'pending' | 'sold')[]; | |||
| }; | |||
| type findPetsByTagsParams = { | |||
| /** Tags to filter by */ | |||
| tags: string[]; | |||
| }; | |||
| type getOrderByIdParams = { | |||
| /** ID of pet that needs to be fetched */ | |||
| orderId: number; | |||
| }; | |||
| type getPetByIdParams = { | |||
| /** ID of pet to return */ | |||
| petId: number; | |||
| }; | |||
| type getUserByNameParams = { | |||
| /** The name that needs to be fetched. Use user1 for testing. */ | |||
| username: string; | |||
| }; | |||
| type loginUserParams = { | |||
| /** The user name for login */ | |||
| username: string; | |||
| /** The password for login in clear text */ | |||
| password: string; | |||
| }; | |||
| type Order = { | |||
| id?: number; | |||
| petId?: number; | |||
| quantity?: number; | |||
| shipDate?: string; | |||
| /** Order Status */ | |||
| status?: 'placed' | 'approved' | 'delivered'; | |||
| complete?: boolean; | |||
| }; | |||
| type Pet = { | |||
| id?: number; | |||
| category?: Category; | |||
| name: string; | |||
| photoUrls: string[]; | |||
| tags?: Tag[]; | |||
| /** pet status in the store */ | |||
| status?: 'available' | 'pending' | 'sold'; | |||
| }; | |||
| type Tag = { | |||
| id?: number; | |||
| name?: string; | |||
| }; | |||
| type updatePetWithFormParams = { | |||
| /** ID of pet that needs to be updated */ | |||
| petId: number; | |||
| }; | |||
| type updateUserParams = { | |||
| /** name that need to be updated */ | |||
| username: string; | |||
| }; | |||
| type uploadFileParams = { | |||
| /** ID of pet to update */ | |||
| petId: number; | |||
| }; | |||
| type User = { | |||
| id?: number; | |||
| username?: string; | |||
| firstName?: string; | |||
| lastName?: string; | |||
| email?: string; | |||
| password?: string; | |||
| phone?: string; | |||
| /** User Status */ | |||
| userStatus?: number; | |||
| }; | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| // @ts-ignore | |||
| /* eslint-disable */ | |||
| import { request } from '@umijs/max'; | |||
| /** Create user This can only be done by the logged in user. POST /user */ | |||
| export async function createUser(body: API.User, options?: { [key: string]: any }) { | |||
| return request<any>('/user', { | |||
| method: 'POST', | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Get user by user name GET /user/${param0} */ | |||
| export async function getUserByName( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.getUserByNameParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { username: param0, ...queryParams } = params; | |||
| return request<API.User>(`/user/${param0}`, { | |||
| method: 'GET', | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Updated user This can only be done by the logged in user. PUT /user/${param0} */ | |||
| export async function updateUser( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.updateUserParams, | |||
| body: API.User, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { username: param0, ...queryParams } = params; | |||
| return request<any>(`/user/${param0}`, { | |||
| method: 'PUT', | |||
| params: { ...queryParams }, | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Delete user This can only be done by the logged in user. DELETE /user/${param0} */ | |||
| export async function deleteUser( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.deleteUserParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| const { username: param0, ...queryParams } = params; | |||
| return request<any>(`/user/${param0}`, { | |||
| method: 'DELETE', | |||
| params: { ...queryParams }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Creates list of users with given input array POST /user/createWithArray */ | |||
| export async function createUsersWithArrayInput( | |||
| body: API.User[], | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<any>('/user/createWithArray', { | |||
| method: 'POST', | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Creates list of users with given input array POST /user/createWithList */ | |||
| export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) { | |||
| return request<any>('/user/createWithList', { | |||
| method: 'POST', | |||
| data: body, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Logs user into the system GET /user/login */ | |||
| export async function loginUser( | |||
| // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) | |||
| params: API.loginUserParams, | |||
| options?: { [key: string]: any }, | |||
| ) { | |||
| return request<string>('/user/login', { | |||
| method: 'GET', | |||
| params: { | |||
| ...params, | |||
| }, | |||
| ...(options || {}), | |||
| }); | |||
| } | |||
| /** Logs out current logged in user session GET /user/logout */ | |||
| export async function logoutUser(options?: { [key: string]: any }) { | |||
| return request<any>('/user/logout', { | |||
| method: 'GET', | |||
| ...(options || {}), | |||
| }); | |||
| } | |||