This commit is contained in:
曙光 2024-06-16 21:34:10 +08:00
commit 4db1a5cb7e
186 changed files with 22709 additions and 0 deletions

4
.browserslistrc Normal file
View File

@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11

19
.eslintrc.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# shuguangpanti
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

3
babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
};

BIN
dist.rar Normal file

Binary file not shown.

View File

@ -0,0 +1,25 @@
/* generated using openapi-typescript-codegen -- do no 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;
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;
}
}

View File

@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no 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>;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do no 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;
};

View File

@ -0,0 +1,131 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export class CancelError extends Error {
constructor(message: string) {
super(message);
this.name = 'CancelError';
}
public get isCancelled(): boolean {
return true;
}
}
export interface OnCancel {
readonly isResolved: boolean;
readonly isRejected: boolean;
readonly isCancelled: boolean;
(cancelHandler: () => void): void;
}
export class CancelablePromise<T> implements Promise<T> {
#isResolved: boolean;
#isRejected: boolean;
#isCancelled: boolean;
readonly #cancelHandlers: (() => void)[];
readonly #promise: Promise<T>;
#resolve?: (value: T | PromiseLike<T>) => void;
#reject?: (reason?: any) => void;
constructor(
executor: (
resolve: (value: T | PromiseLike<T>) => void,
reject: (reason?: any) => void,
onCancel: OnCancel
) => void
) {
this.#isResolved = false;
this.#isRejected = false;
this.#isCancelled = false;
this.#cancelHandlers = [];
this.#promise = new Promise<T>((resolve, reject) => {
this.#resolve = resolve;
this.#reject = reject;
const onResolve = (value: T | PromiseLike<T>): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
};
const onReject = (reason?: any): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
};
const onCancel = (cancelHandler: () => void): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#cancelHandlers.push(cancelHandler);
};
Object.defineProperty(onCancel, 'isResolved', {
get: (): boolean => this.#isResolved,
});
Object.defineProperty(onCancel, 'isRejected', {
get: (): boolean => this.#isRejected,
});
Object.defineProperty(onCancel, 'isCancelled', {
get: (): boolean => this.#isCancelled,
});
return executor(onResolve, onReject, onCancel as OnCancel);
});
}
get [Symbol.toStringTag]() {
return "Cancellable Promise";
}
public then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
): Promise<TResult1 | TResult2> {
return this.#promise.then(onFulfilled, onRejected);
}
public catch<TResult = never>(
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
): Promise<T | TResult> {
return this.#promise.catch(onRejected);
}
public finally(onFinally?: (() => void) | null): Promise<T> {
return this.#promise.finally(onFinally);
}
public cancel(): void {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isCancelled = true;
if (this.#cancelHandlers.length) {
try {
for (const cancelHandler of this.#cancelHandlers) {
cancelHandler();
}
} catch (error) {
console.warn('Cancellation threw an error', error);
return;
}
}
this.#cancelHandlers.length = 0;
this.#reject?.(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {
return this.#isCancelled;
}
}

32
generated/core/OpenAPI.ts Normal file
View File

@ -0,0 +1,32 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;
export type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
ENCODE_PATH?: ((path: string) => string) | undefined;
};
export const OpenAPI: OpenAPIConfig = {
BASE: 'http://localhost:8101',
VERSION: '1.0',
WITH_CREDENTIALS: true,
CREDENTIALS: 'include',
TOKEN: undefined,
USERNAME: undefined,
PASSWORD: undefined,
HEADERS: undefined,
ENCODE_PATH: undefined,
};

319
generated/core/request.ts Normal file
View File

@ -0,0 +1,319 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import axios from 'axios';
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
import FormData from 'form-data';
import { ApiError } from './ApiError';
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
import { CancelablePromise } from './CancelablePromise';
import type { OnCancel } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
return value !== undefined && value !== null;
};
export const isString = (value: any): value is string => {
return typeof value === 'string';
};
export const isStringWithValue = (value: any): value is string => {
return isString(value) && value !== '';
};
export const isBlob = (value: any): value is Blob => {
return (
typeof value === 'object' &&
typeof value.type === 'string' &&
typeof value.stream === 'function' &&
typeof value.arrayBuffer === 'function' &&
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
export const isFormData = (value: any): value is FormData => {
return value instanceof FormData;
};
export const isSuccess = (status: number): boolean => {
return status >= 200 && status < 300;
};
export const base64 = (str: string): string => {
try {
return btoa(str);
} catch (err) {
// @ts-ignore
return Buffer.from(str).toString('base64');
}
};
export const getQueryString = (params: Record<string, any>): string => {
const qs: string[] = [];
const append = (key: string, value: any) => {
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
};
const process = (key: string, value: any) => {
if (isDefined(value)) {
if (Array.isArray(value)) {
value.forEach(v => {
process(key, v);
});
} else if (typeof value === 'object') {
Object.entries(value).forEach(([k, v]) => {
process(`${key}[${k}]`, v);
});
} else {
append(key, value);
}
}
};
Object.entries(params).forEach(([key, value]) => {
process(key, value);
});
if (qs.length > 0) {
return `?${qs.join('&')}`;
}
return '';
};
const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
const encoder = config.ENCODE_PATH || encodeURI;
const path = options.url
.replace('{api-version}', config.VERSION)
.replace(/{(.*?)}/g, (substring: string, group: string) => {
if (options.path?.hasOwnProperty(group)) {
return encoder(String(options.path[group]));
}
return substring;
});
const url = `${config.BASE}${path}`;
if (options.query) {
return `${url}${getQueryString(options.query)}`;
}
return url;
};
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
if (options.formData) {
const formData = new FormData();
const process = (key: string, value: any) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
formData.append(key, JSON.stringify(value));
}
};
Object.entries(options.formData)
.filter(([_, value]) => isDefined(value))
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
} else {
process(key, value);
}
});
return formData;
}
return undefined;
};
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
if (typeof resolver === 'function') {
return (resolver as Resolver<T>)(options);
}
return resolver;
};
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
const token = await resolve(options, config.TOKEN);
const username = await resolve(options, config.USERNAME);
const password = await resolve(options, config.PASSWORD);
const additionalHeaders = await resolve(options, config.HEADERS);
const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {}
const headers = Object.entries({
Accept: 'application/json',
...additionalHeaders,
...options.headers,
...formHeaders,
})
.filter(([_, value]) => isDefined(value))
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
}), {} as Record<string, string>);
if (isStringWithValue(token)) {
headers['Authorization'] = `Bearer ${token}`;
}
if (isStringWithValue(username) && isStringWithValue(password)) {
const credentials = base64(`${username}:${password}`);
headers['Authorization'] = `Basic ${credentials}`;
}
if (options.body) {
if (options.mediaType) {
headers['Content-Type'] = options.mediaType;
} else if (isBlob(options.body)) {
headers['Content-Type'] = options.body.type || 'application/octet-stream';
} else if (isString(options.body)) {
headers['Content-Type'] = 'text/plain';
} else if (!isFormData(options.body)) {
headers['Content-Type'] = 'application/json';
}
}
return headers;
};
export const getRequestBody = (options: ApiRequestOptions): any => {
if (options.body) {
return options.body;
}
return undefined;
};
export const sendRequest = async <T>(
config: OpenAPIConfig,
options: ApiRequestOptions,
url: string,
body: any,
formData: FormData | undefined,
headers: Record<string, string>,
onCancel: OnCancel,
axiosClient: AxiosInstance
): Promise<AxiosResponse<T>> => {
const source = axios.CancelToken.source();
const requestConfig: AxiosRequestConfig = {
url,
headers,
data: body ?? formData,
method: options.method,
withCredentials: config.WITH_CREDENTIALS,
cancelToken: source.token,
};
onCancel(() => source.cancel('The user aborted a request.'));
try {
return await axiosClient.request(requestConfig);
} catch (error) {
const axiosError = error as AxiosError<T>;
if (axiosError.response) {
return axiosError.response;
}
throw error;
}
};
export const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
if (responseHeader) {
const content = response.headers[responseHeader];
if (isString(content)) {
return content;
}
}
return undefined;
};
export const getResponseBody = (response: AxiosResponse<any>): any => {
if (response.status !== 204) {
return response.data;
}
return undefined;
};
export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
const errors: Record<number, string> = {
400: 'Bad Request',
401: 'Unauthorized',
403: 'Forbidden',
404: 'Not Found',
500: 'Internal Server Error',
502: 'Bad Gateway',
503: 'Service Unavailable',
...options.errors,
}
const error = errors[result.status];
if (error) {
throw new ApiError(options, result, error);
}
if (!result.ok) {
const errorStatus = result.status ?? 'unknown';
const errorStatusText = result.statusText ?? 'unknown';
const errorBody = (() => {
try {
return JSON.stringify(result.body, null, 2);
} catch (e) {
return undefined;
}
})();
throw new ApiError(options, result,
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
);
}
};
/**
* Request method
* @param config The OpenAPI configuration object
* @param options The request options from the service
* @param axiosClient The axios client instance to use
* @returns CancelablePromise<T>
* @throws ApiError
*/
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise<T> => {
return new CancelablePromise(async (resolve, reject, onCancel) => {
try {
const url = getUrl(config, options);
const formData = getFormData(options);
const body = getRequestBody(options);
const headers = await getHeaders(config, options, formData);
if (!onCancel.isCancelled) {
const response = await sendRequest<T>(config, options, url, body, formData, headers, onCancel, axiosClient);
const responseBody = getResponseBody(response);
const responseHeader = getResponseHeader(response, options.responseHeader);
const result: ApiResult = {
url,
ok: isSuccess(response.status),
status: response.status,
statusText: response.statusText,
body: responseHeader ?? responseBody,
};
catchErrorCodes(options, result);
resolve(result.body);
}
} catch (error) {
reject(error);
}
});
};

70
generated/index.ts Normal file
View File

@ -0,0 +1,70 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export { ApiError } from "./core/ApiError";
export { CancelablePromise, CancelError } from "./core/CancelablePromise";
export { OpenAPI } from "./core/OpenAPI";
export type { OpenAPIConfig } from "./core/OpenAPI";
export type { BaseResponse_boolean_ } from "./models/BaseResponse_boolean_";
export type { BaseResponse_int_ } from "./models/BaseResponse_int_";
export type { BaseResponse_LoginUserVO_ } from "./models/BaseResponse_LoginUserVO_";
export type { BaseResponse_long_ } from "./models/BaseResponse_long_";
export type { BaseResponse_Page_PostVO_ } from "./models/BaseResponse_Page_PostVO_";
export type { BaseResponse_Page_Question_ } from "./models/BaseResponse_Page_Question_";
export type { BaseResponse_Page_QuestionSubmitVO_ } from "./models/BaseResponse_Page_QuestionSubmitVO_";
export type { BaseResponse_Page_QuestionVO_ } from "./models/BaseResponse_Page_QuestionVO_";
export type { BaseResponse_Page_User_ } from "./models/BaseResponse_Page_User_";
export type { BaseResponse_Page_UserVO_ } from "./models/BaseResponse_Page_UserVO_";
export type { BaseResponse_PostVO_ } from "./models/BaseResponse_PostVO_";
export type { BaseResponse_Question_ } from "./models/BaseResponse_Question_";
export type { BaseResponse_QuestionVO_ } from "./models/BaseResponse_QuestionVO_";
export type { BaseResponse_string_ } from "./models/BaseResponse_string_";
export type { BaseResponse_User_ } from "./models/BaseResponse_User_";
export type { BaseResponse_UserVO_ } from "./models/BaseResponse_UserVO_";
export type { DeleteRequest } from "./models/DeleteRequest";
export type { JudgeCase } from "./models/JudgeCase";
export type { JudgeConfig } from "./models/JudgeConfig";
export type { JudgeInfo } from "./models/JudgeInfo";
export type { LoginUserVO } from "./models/LoginUserVO";
export type { OrderItem } from "./models/OrderItem";
export type { Page_PostVO_ } from "./models/Page_PostVO_";
export type { Page_Question_ } from "./models/Page_Question_";
export type { Page_QuestionSubmitVO_ } from "./models/Page_QuestionSubmitVO_";
export type { Page_QuestionVO_ } from "./models/Page_QuestionVO_";
export type { Page_User_ } from "./models/Page_User_";
export type { Page_UserVO_ } from "./models/Page_UserVO_";
export type { PostAddRequest } from "./models/PostAddRequest";
export type { PostEditRequest } from "./models/PostEditRequest";
export type { PostFavourAddRequest } from "./models/PostFavourAddRequest";
export type { PostFavourQueryRequest } from "./models/PostFavourQueryRequest";
export type { PostQueryRequest } from "./models/PostQueryRequest";
export type { PostThumbAddRequest } from "./models/PostThumbAddRequest";
export type { PostUpdateRequest } from "./models/PostUpdateRequest";
export type { PostVO } from "./models/PostVO";
export type { Question } from "./models/Question";
export type { QuestionAddRequest } from "./models/QuestionAddRequest";
export type { QuestionEditRequest } from "./models/QuestionEditRequest";
export type { QuestionQueryRequest } from "./models/QuestionQueryRequest";
export type { QuestionSubmitAddRequest } from "./models/QuestionSubmitAddRequest";
export type { QuestionSubmitQueryRequest } from "./models/QuestionSubmitQueryRequest";
export type { QuestionSubmitVO } from "./models/QuestionSubmitVO";
export type { QuestionUpdateRequest } from "./models/QuestionUpdateRequest";
export type { QuestionVO } from "./models/QuestionVO";
export type { User } from "./models/User";
export type { UserAddRequest } from "./models/UserAddRequest";
export type { UserLoginRequest } from "./models/UserLoginRequest";
export type { UserQueryRequest } from "./models/UserQueryRequest";
export type { UserRegisterRequest } from "./models/UserRegisterRequest";
export type { UserUpdateMyRequest } from "./models/UserUpdateMyRequest";
export type { UserUpdateRequest } from "./models/UserUpdateRequest";
export type { UserVO } from "./models/UserVO";
export { FileControllerService } from "./services/FileControllerService";
export { PostControllerService } from "./services/PostControllerService";
export { PostFavourControllerService } from "./services/PostFavourControllerService";
export { PostThumbControllerService } from "./services/PostThumbControllerService";
export { QuestionControllerService } from "./services/QuestionControllerService";
export { UserControllerService } from "./services/UserControllerService";
export { WxMpControllerService } from "./services/WxMpControllerService";

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { LoginUserVO } from './LoginUserVO';
export type BaseResponse_LoginUserVO_ = {
code?: number;
data?: LoginUserVO;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_PostVO_ } from './Page_PostVO_';
export type BaseResponse_Page_PostVO_ = {
code?: number;
data?: Page_PostVO_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_QuestionSubmitVO_ } from './Page_QuestionSubmitVO_';
export type BaseResponse_Page_QuestionSubmitVO_ = {
code?: number;
data?: Page_QuestionSubmitVO_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_QuestionVO_ } from './Page_QuestionVO_';
export type BaseResponse_Page_QuestionVO_ = {
code?: number;
data?: Page_QuestionVO_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_Question_ } from './Page_Question_';
export type BaseResponse_Page_Question_ = {
code?: number;
data?: Page_Question_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_UserVO_ } from './Page_UserVO_';
export type BaseResponse_Page_UserVO_ = {
code?: number;
data?: Page_UserVO_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_User_ } from './Page_User_';
export type BaseResponse_Page_User_ = {
code?: number;
data?: Page_User_;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { PostVO } from './PostVO';
export type BaseResponse_PostVO_ = {
code?: number;
data?: PostVO;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { QuestionVO } from './QuestionVO';
export type BaseResponse_QuestionVO_ = {
code?: number;
data?: QuestionVO;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Question } from './Question';
export type BaseResponse_Question_ = {
code?: number;
data?: Question;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserVO } from './UserVO';
export type BaseResponse_UserVO_ = {
code?: number;
data?: UserVO;
message?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { User } from './User';
export type BaseResponse_User_ = {
code?: number;
data?: User;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_boolean_ = {
code?: number;
data?: boolean;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_int_ = {
code?: number;
data?: number;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_long_ = {
code?: number;
data?: number;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_string_ = {
code?: number;
data?: string;
message?: string;
};

View File

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type DeleteRequest = {
id?: number;
};

View File

@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeCase = {
input?: string;
output?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeConfig = {
memoryLimit?: number;
stackLimit?: number;
timeLimit?: number;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeInfo = {
memory?: number;
message?: string;
time?: number;
};

View File

@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type LoginUserVO = {
createTime?: string;
id?: number;
updateTime?: string;
userAvatar?: string;
userName?: string;
userProfile?: string;
userRole?: string;
};

View File

@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type OrderItem = {
asc?: boolean;
column?: string;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { PostVO } from './PostVO';
export type Page_PostVO_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<PostVO>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { QuestionSubmitVO } from './QuestionSubmitVO';
export type Page_QuestionSubmitVO_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<QuestionSubmitVO>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { QuestionVO } from './QuestionVO';
export type Page_QuestionVO_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<QuestionVO>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { Question } from './Question';
export type Page_Question_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<Question>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { UserVO } from './UserVO';
export type Page_UserVO_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<UserVO>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OrderItem } from './OrderItem';
import type { User } from './User';
export type Page_User_ = {
countId?: string;
current?: number;
maxLimit?: number;
optimizeCountSql?: boolean;
orders?: Array<OrderItem>;
pages?: number;
records?: Array<User>;
searchCount?: boolean;
size?: number;
total?: number;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostAddRequest = {
content?: string;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostEditRequest = {
content?: string;
id?: number;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostFavourAddRequest = {
postId?: number;
};

View File

@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { PostQueryRequest } from './PostQueryRequest';
export type PostFavourQueryRequest = {
current?: number;
pageSize?: number;
postQueryRequest?: PostQueryRequest;
sortField?: string;
sortOrder?: string;
userId?: number;
};

View File

@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostQueryRequest = {
content?: string;
current?: number;
favourUserId?: number;
id?: number;
notId?: number;
orTags?: Array<string>;
pageSize?: number;
searchText?: string;
sortField?: string;
sortOrder?: string;
tags?: Array<string>;
title?: string;
userId?: number;
};

View File

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostThumbAddRequest = {
postId?: number;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PostUpdateRequest = {
content?: string;
id?: number;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,21 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserVO } from './UserVO';
export type PostVO = {
content?: string;
createTime?: string;
favourNum?: number;
hasFavour?: boolean;
hasThumb?: boolean;
id?: number;
tagList?: Array<string>;
thumbNum?: number;
title?: string;
updateTime?: string;
user?: UserVO;
userId?: number;
};

View File

@ -0,0 +1,22 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Question = {
acceptedNum?: number;
answer?: string;
content?: string;
createTime?: string;
favourNum?: number;
id?: number;
isDelete?: number;
judgeCase?: string;
judgeConfig?: string;
submitNum?: number;
tags?: string;
thumbNum?: number;
title?: string;
updateTime?: string;
userId?: number;
};

View File

@ -0,0 +1,16 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { JudgeCase } from './JudgeCase';
import type { JudgeConfig } from './JudgeConfig';
export type QuestionAddRequest = {
answer?: string;
content?: string;
judgeCase?: Array<JudgeCase>;
judgeConfig?: JudgeConfig;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { JudgeCase } from './JudgeCase';
import type { JudgeConfig } from './JudgeConfig';
export type QuestionEditRequest = {
answer?: string;
content?: string;
id?: number;
judgeCase?: Array<JudgeCase>;
judgeConfig?: JudgeConfig;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type QuestionQueryRequest = {
answer?: string;
content?: string;
current?: number;
id?: number;
pageSize?: number;
sortField?: string;
sortOrder?: string;
tags?: Array<string>;
title?: string;
userId?: number;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type QuestionSubmitAddRequest = {
code?: string;
language?: string;
questionId?: number;
};

View File

@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type QuestionSubmitQueryRequest = {
current?: number;
language?: string;
pageSize?: number;
questionId?: number;
sortField?: string;
sortOrder?: string;
status?: number;
userId?: number;
};

View File

@ -0,0 +1,22 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { JudgeInfo } from './JudgeInfo';
import type { QuestionVO } from './QuestionVO';
import type { UserVO } from './UserVO';
export type QuestionSubmitVO = {
code?: string;
createTime?: string;
id?: number;
judgeInfo?: JudgeInfo;
language?: string;
questionId?: number;
questionVO?: QuestionVO;
status?: number;
updateTime?: string;
userId?: number;
userVO?: UserVO;
};

View File

@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { JudgeCase } from './JudgeCase';
import type { JudgeConfig } from './JudgeConfig';
export type QuestionUpdateRequest = {
answer?: string;
content?: string;
id?: number;
judgeCase?: Array<JudgeCase>;
judgeConfig?: JudgeConfig;
tags?: Array<string>;
title?: string;
};

View File

@ -0,0 +1,23 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { JudgeConfig } from './JudgeConfig';
import type { UserVO } from './UserVO';
export type QuestionVO = {
acceptedNum?: number;
content?: string;
createTime?: string;
favourNum?: number;
id?: number;
judgeConfig?: JudgeConfig;
submitNum?: number;
tags?: Array<string>;
thumbNum?: number;
title?: string;
updateTime?: string;
userId?: number;
userVO?: UserVO;
};

19
generated/models/User.ts Normal file
View File

@ -0,0 +1,19 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type User = {
createTime?: string;
id?: number;
isDelete?: number;
mpOpenId?: string;
unionId?: string;
updateTime?: string;
userAccount?: string;
userAvatar?: string;
userName?: string;
userPassword?: string;
userProfile?: string;
userRole?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserAddRequest = {
userAccount?: string;
userAvatar?: string;
userName?: string;
userRole?: string;
};

View File

@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserLoginRequest = {
userAccount?: string;
userPassword?: string;
};

View File

@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserQueryRequest = {
current?: number;
id?: number;
mpOpenId?: string;
pageSize?: number;
sortField?: string;
sortOrder?: string;
unionId?: string;
userName?: string;
userProfile?: string;
userRole?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserRegisterRequest = {
checkPassword?: string;
userAccount?: string;
userPassword?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserUpdateMyRequest = {
userAvatar?: string;
userName?: string;
userProfile?: string;
};

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserUpdateRequest = {
id?: number;
userAvatar?: string;
userName?: string;
userProfile?: string;
userRole?: string;
};

View File

@ -0,0 +1,13 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserVO = {
createTime?: string;
id?: number;
userAvatar?: string;
userName?: string;
userProfile?: string;
userRole?: string;
};

View File

@ -0,0 +1,42 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_string_ } from '../models/BaseResponse_string_';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class FileControllerService {
/**
* uploadFile
* @param biz
* @param file
* @returns BaseResponse_string_ OK
* @returns any Created
* @throws ApiError
*/
public static uploadFileUsingPost(
biz?: string,
file?: Blob,
): CancelablePromise<BaseResponse_string_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/file/upload',
query: {
'biz': biz,
},
formData: {
'file': file,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,198 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_boolean_ } from '../models/BaseResponse_boolean_';
import type { BaseResponse_long_ } from '../models/BaseResponse_long_';
import type { BaseResponse_Page_PostVO_ } from '../models/BaseResponse_Page_PostVO_';
import type { BaseResponse_PostVO_ } from '../models/BaseResponse_PostVO_';
import type { DeleteRequest } from '../models/DeleteRequest';
import type { PostAddRequest } from '../models/PostAddRequest';
import type { PostEditRequest } from '../models/PostEditRequest';
import type { PostQueryRequest } from '../models/PostQueryRequest';
import type { PostUpdateRequest } from '../models/PostUpdateRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class PostControllerService {
/**
* addPost
* @param postAddRequest postAddRequest
* @returns BaseResponse_long_ OK
* @returns any Created
* @throws ApiError
*/
public static addPostUsingPost(
postAddRequest: PostAddRequest,
): CancelablePromise<BaseResponse_long_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/add',
body: postAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* deletePost
* @param deleteRequest deleteRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static deletePostUsingPost(
deleteRequest: DeleteRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/delete',
body: deleteRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* editPost
* @param postEditRequest postEditRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static editPostUsingPost(
postEditRequest: PostEditRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/edit',
body: postEditRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getPostVOById
* @param id id
* @returns BaseResponse_PostVO_ OK
* @throws ApiError
*/
public static getPostVoByIdUsingGet(
id?: number,
): CancelablePromise<BaseResponse_PostVO_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/post/get/vo',
query: {
'id': id,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listPostVOByPage
* @param postQueryRequest postQueryRequest
* @returns BaseResponse_Page_PostVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listPostVoByPageUsingPost(
postQueryRequest: PostQueryRequest,
): CancelablePromise<BaseResponse_Page_PostVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/list/page/vo',
body: postQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listMyPostVOByPage
* @param postQueryRequest postQueryRequest
* @returns BaseResponse_Page_PostVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listMyPostVoByPageUsingPost(
postQueryRequest: PostQueryRequest,
): CancelablePromise<BaseResponse_Page_PostVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/my/list/page/vo',
body: postQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* searchPostVOByPage
* @param postQueryRequest postQueryRequest
* @returns BaseResponse_Page_PostVO_ OK
* @returns any Created
* @throws ApiError
*/
public static searchPostVoByPageUsingPost(
postQueryRequest: PostQueryRequest,
): CancelablePromise<BaseResponse_Page_PostVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/search/page/vo',
body: postQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* updatePost
* @param postUpdateRequest postUpdateRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static updatePostUsingPost(
postUpdateRequest: PostUpdateRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post/update',
body: postUpdateRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,83 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_int_ } from '../models/BaseResponse_int_';
import type { BaseResponse_Page_PostVO_ } from '../models/BaseResponse_Page_PostVO_';
import type { PostFavourAddRequest } from '../models/PostFavourAddRequest';
import type { PostFavourQueryRequest } from '../models/PostFavourQueryRequest';
import type { PostQueryRequest } from '../models/PostQueryRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class PostFavourControllerService {
/**
* doPostFavour
* @param postFavourAddRequest postFavourAddRequest
* @returns BaseResponse_int_ OK
* @returns any Created
* @throws ApiError
*/
public static doPostFavourUsingPost(
postFavourAddRequest: PostFavourAddRequest,
): CancelablePromise<BaseResponse_int_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post_favour/',
body: postFavourAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listFavourPostByPage
* @param postFavourQueryRequest postFavourQueryRequest
* @returns BaseResponse_Page_PostVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listFavourPostByPageUsingPost(
postFavourQueryRequest: PostFavourQueryRequest,
): CancelablePromise<BaseResponse_Page_PostVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post_favour/list/page',
body: postFavourQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listMyFavourPostByPage
* @param postQueryRequest postQueryRequest
* @returns BaseResponse_Page_PostVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listMyFavourPostByPageUsingPost(
postQueryRequest: PostQueryRequest,
): CancelablePromise<BaseResponse_Page_PostVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post_favour/my/list/page',
body: postQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,36 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_int_ } from '../models/BaseResponse_int_';
import type { PostThumbAddRequest } from '../models/PostThumbAddRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class PostThumbControllerService {
/**
* doThumb
* @param postThumbAddRequest postThumbAddRequest
* @returns BaseResponse_int_ OK
* @returns any Created
* @throws ApiError
*/
public static doThumbUsingPost(
postThumbAddRequest: PostThumbAddRequest,
): CancelablePromise<BaseResponse_int_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/post_thumb/',
body: postThumbAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,270 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_boolean_ } from '../models/BaseResponse_boolean_';
import type { BaseResponse_long_ } from '../models/BaseResponse_long_';
import type { BaseResponse_Page_Question_ } from '../models/BaseResponse_Page_Question_';
import type { BaseResponse_Page_QuestionSubmitVO_ } from '../models/BaseResponse_Page_QuestionSubmitVO_';
import type { BaseResponse_Page_QuestionVO_ } from '../models/BaseResponse_Page_QuestionVO_';
import type { BaseResponse_Question_ } from '../models/BaseResponse_Question_';
import type { BaseResponse_QuestionVO_ } from '../models/BaseResponse_QuestionVO_';
import type { DeleteRequest } from '../models/DeleteRequest';
import type { QuestionAddRequest } from '../models/QuestionAddRequest';
import type { QuestionEditRequest } from '../models/QuestionEditRequest';
import type { QuestionQueryRequest } from '../models/QuestionQueryRequest';
import type { QuestionSubmitAddRequest } from '../models/QuestionSubmitAddRequest';
import type { QuestionSubmitQueryRequest } from '../models/QuestionSubmitQueryRequest';
import type { QuestionUpdateRequest } from '../models/QuestionUpdateRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class QuestionControllerService {
/**
* addQuestion
* @param questionAddRequest questionAddRequest
* @returns BaseResponse_long_ OK
* @returns any Created
* @throws ApiError
*/
public static addQuestionUsingPost(
questionAddRequest: QuestionAddRequest,
): CancelablePromise<BaseResponse_long_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/add',
body: questionAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* deleteQuestion
* @param deleteRequest deleteRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static deleteQuestionUsingPost(
deleteRequest: DeleteRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/delete',
body: deleteRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* editQuestion
* @param questionEditRequest questionEditRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static editQuestionUsingPost(
questionEditRequest: QuestionEditRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/edit',
body: questionEditRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getQuestionById
* @param id id
* @returns BaseResponse_Question_ OK
* @throws ApiError
*/
public static getQuestionByIdUsingGet(
id?: number,
): CancelablePromise<BaseResponse_Question_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/question/get',
query: {
'id': id,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getQuestionVOById
* @param id id
* @returns BaseResponse_QuestionVO_ OK
* @throws ApiError
*/
public static getQuestionVoByIdUsingGet(
id?: number,
): CancelablePromise<BaseResponse_QuestionVO_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/question/get/vo',
query: {
'id': id,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listQuestionByPage
* @param questionQueryRequest questionQueryRequest
* @returns BaseResponse_Page_Question_ OK
* @returns any Created
* @throws ApiError
*/
public static listQuestionByPageUsingPost(
questionQueryRequest: QuestionQueryRequest,
): CancelablePromise<BaseResponse_Page_Question_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/list/page',
body: questionQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listQuestionVOByPage
* @param questionQueryRequest questionQueryRequest
* @returns BaseResponse_Page_QuestionVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listQuestionVoByPageUsingPost(
questionQueryRequest: QuestionQueryRequest,
): CancelablePromise<BaseResponse_Page_QuestionVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/list/page/vo',
body: questionQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listMyQuestionVOByPage
* @param questionQueryRequest questionQueryRequest
* @returns BaseResponse_Page_QuestionVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listMyQuestionVoByPageUsingPost(
questionQueryRequest: QuestionQueryRequest,
): CancelablePromise<BaseResponse_Page_QuestionVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/my/list/page/vo',
body: questionQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* doQuestionSubmit
* @param questionSubmitAddRequest questionSubmitAddRequest
* @returns BaseResponse_long_ OK
* @returns any Created
* @throws ApiError
*/
public static doQuestionSubmitUsingPost(
questionSubmitAddRequest: QuestionSubmitAddRequest,
): CancelablePromise<BaseResponse_long_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/question_submit/do',
body: questionSubmitAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listQuestionSubmitByPage
* @param questionSubmitQueryRequest questionSubmitQueryRequest
* @returns BaseResponse_Page_QuestionSubmitVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listQuestionSubmitByPageUsingPost(
questionSubmitQueryRequest: QuestionSubmitQueryRequest,
): CancelablePromise<BaseResponse_Page_QuestionSubmitVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/question_submit/list/page',
body: questionSubmitQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* updateQuestion
* @param questionUpdateRequest questionUpdateRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static updateQuestionUsingPost(
questionUpdateRequest: QuestionUpdateRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/question/update',
body: questionUpdateRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,306 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseResponse_boolean_ } from '../models/BaseResponse_boolean_';
import type { BaseResponse_LoginUserVO_ } from '../models/BaseResponse_LoginUserVO_';
import type { BaseResponse_long_ } from '../models/BaseResponse_long_';
import type { BaseResponse_Page_User_ } from '../models/BaseResponse_Page_User_';
import type { BaseResponse_Page_UserVO_ } from '../models/BaseResponse_Page_UserVO_';
import type { BaseResponse_User_ } from '../models/BaseResponse_User_';
import type { BaseResponse_UserVO_ } from '../models/BaseResponse_UserVO_';
import type { DeleteRequest } from '../models/DeleteRequest';
import type { UserAddRequest } from '../models/UserAddRequest';
import type { UserLoginRequest } from '../models/UserLoginRequest';
import type { UserQueryRequest } from '../models/UserQueryRequest';
import type { UserRegisterRequest } from '../models/UserRegisterRequest';
import type { UserUpdateMyRequest } from '../models/UserUpdateMyRequest';
import type { UserUpdateRequest } from '../models/UserUpdateRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class UserControllerService {
/**
* addUser
* @param userAddRequest userAddRequest
* @returns BaseResponse_long_ OK
* @returns any Created
* @throws ApiError
*/
public static addUserUsingPost(
userAddRequest: UserAddRequest,
): CancelablePromise<BaseResponse_long_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/add',
body: userAddRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* deleteUser
* @param deleteRequest deleteRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static deleteUserUsingPost(
deleteRequest: DeleteRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/delete',
body: deleteRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getUserById
* @param id id
* @returns BaseResponse_User_ OK
* @throws ApiError
*/
public static getUserByIdUsingGet(
id?: number,
): CancelablePromise<BaseResponse_User_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/user/get',
query: {
'id': id,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getLoginUser
* @returns BaseResponse_LoginUserVO_ OK
* @throws ApiError
*/
public static getLoginUserUsingGet(): CancelablePromise<BaseResponse_LoginUserVO_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/user/get/login',
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* getUserVOById
* @param id id
* @returns BaseResponse_UserVO_ OK
* @throws ApiError
*/
public static getUserVoByIdUsingGet(
id?: number,
): CancelablePromise<BaseResponse_UserVO_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/user/get/vo',
query: {
'id': id,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listUserByPage
* @param userQueryRequest userQueryRequest
* @returns BaseResponse_Page_User_ OK
* @returns any Created
* @throws ApiError
*/
public static listUserByPageUsingPost(
userQueryRequest: UserQueryRequest,
): CancelablePromise<BaseResponse_Page_User_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/list/page',
body: userQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* listUserVOByPage
* @param userQueryRequest userQueryRequest
* @returns BaseResponse_Page_UserVO_ OK
* @returns any Created
* @throws ApiError
*/
public static listUserVoByPageUsingPost(
userQueryRequest: UserQueryRequest,
): CancelablePromise<BaseResponse_Page_UserVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/list/page/vo',
body: userQueryRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* userLogin
* @param userLoginRequest userLoginRequest
* @returns BaseResponse_LoginUserVO_ OK
* @returns any Created
* @throws ApiError
*/
public static userLoginUsingPost(
userLoginRequest: UserLoginRequest,
): CancelablePromise<BaseResponse_LoginUserVO_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/login',
body: userLoginRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* userLoginByWxOpen
* @param code code
* @returns BaseResponse_LoginUserVO_ OK
* @throws ApiError
*/
public static userLoginByWxOpenUsingGet(
code: string,
): CancelablePromise<BaseResponse_LoginUserVO_> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/user/login/wx_open',
query: {
'code': code,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* userLogout
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static userLogoutUsingPost(): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/logout',
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* userRegister
* @param userRegisterRequest userRegisterRequest
* @returns BaseResponse_long_ OK
* @returns any Created
* @throws ApiError
*/
public static userRegisterUsingPost(
userRegisterRequest: UserRegisterRequest,
): CancelablePromise<BaseResponse_long_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/register',
body: userRegisterRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* updateUser
* @param userUpdateRequest userUpdateRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static updateUserUsingPost(
userUpdateRequest: UserUpdateRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/update',
body: userUpdateRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* updateMyUser
* @param userUpdateMyRequest userUpdateMyRequest
* @returns BaseResponse_boolean_ OK
* @returns any Created
* @throws ApiError
*/
public static updateMyUserUsingPost(
userUpdateMyRequest: UserUpdateMyRequest,
): CancelablePromise<BaseResponse_boolean_ | any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/user/update/my',
body: userUpdateMyRequest,
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,77 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class WxMpControllerService {
/**
* check
* @param echostr echostr
* @param nonce nonce
* @param signature signature
* @param timestamp timestamp
* @returns string OK
* @throws ApiError
*/
public static checkUsingGet(
echostr?: string,
nonce?: string,
signature?: string,
timestamp?: string,
): CancelablePromise<string> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/',
query: {
'echostr': echostr,
'nonce': nonce,
'signature': signature,
'timestamp': timestamp,
},
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* receiveMessage
* @returns any OK
* @throws ApiError
*/
public static receiveMessageUsingPost(): CancelablePromise<any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/',
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
/**
* setMenu
* @returns string OK
* @throws ApiError
*/
public static setMenuUsingGet(): CancelablePromise<string> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/setMenu',
errors: {
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
},
});
}
}

View File

@ -0,0 +1,25 @@
/* 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;
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;
}
}

View File

@ -0,0 +1,17 @@
/* 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>;
};

View File

@ -0,0 +1,11 @@
/* 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;
};

View File

@ -0,0 +1,131 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export class CancelError extends Error {
constructor(message: string) {
super(message);
this.name = 'CancelError';
}
public get isCancelled(): boolean {
return true;
}
}
export interface OnCancel {
readonly isResolved: boolean;
readonly isRejected: boolean;
readonly isCancelled: boolean;
(cancelHandler: () => void): void;
}
export class CancelablePromise<T> implements Promise<T> {
#isResolved: boolean;
#isRejected: boolean;
#isCancelled: boolean;
readonly #cancelHandlers: (() => void)[];
readonly #promise: Promise<T>;
#resolve?: (value: T | PromiseLike<T>) => void;
#reject?: (reason?: any) => void;
constructor(
executor: (
resolve: (value: T | PromiseLike<T>) => void,
reject: (reason?: any) => void,
onCancel: OnCancel
) => void
) {
this.#isResolved = false;
this.#isRejected = false;
this.#isCancelled = false;
this.#cancelHandlers = [];
this.#promise = new Promise<T>((resolve, reject) => {
this.#resolve = resolve;
this.#reject = reject;
const onResolve = (value: T | PromiseLike<T>): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isResolved = true;
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isRejected = true;
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#cancelHandlers.push(cancelHandler);
};
Object.defineProperty(onCancel, 'isResolved', {
get: (): boolean => this.#isResolved,
});
Object.defineProperty(onCancel, 'isRejected', {
get: (): boolean => this.#isRejected,
});
Object.defineProperty(onCancel, 'isCancelled', {
get: (): boolean => this.#isCancelled,
});
return executor(onResolve, onReject, onCancel as OnCancel);
});
}
get [Symbol.toStringTag]() {
return "Cancellable Promise";
}
public then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
): Promise<TResult1 | TResult2> {
return this.#promise.then(onFulfilled, onRejected);
}
public catch<TResult = never>(
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
): Promise<T | TResult> {
return this.#promise.catch(onRejected);
}
public finally(onFinally?: (() => void) | null): Promise<T> {
return this.#promise.finally(onFinally);
}
public cancel(): void {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this.#isCancelled = true;
if (this.#cancelHandlers.length) {
try {
for (const cancelHandler of this.#cancelHandlers) {
cancelHandler();
}
} catch (error) {
console.warn('Cancellation threw an error', error);
return;
}
}
this.#cancelHandlers.length = 0;
if (this.#reject) this.#reject(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {
return this.#isCancelled;
}
}

View File

@ -0,0 +1,32 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;
export type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
ENCODE_PATH?: ((path: string) => string) | undefined;
};
export const OpenAPI: OpenAPIConfig = {
BASE: 'http://127.0.0.1:8101',
VERSION: '1.0',
WITH_CREDENTIALS: true,
CREDENTIALS: 'include',
TOKEN: undefined,
USERNAME: undefined,
PASSWORD: undefined,
HEADERS: undefined,
ENCODE_PATH: undefined,
};

323
generatedss/core/request.ts Normal file
View File

@ -0,0 +1,323 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import axios from 'axios';
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
import FormData from 'form-data';
import { ApiError } from './ApiError';
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
import { CancelablePromise } from './CancelablePromise';
import type { OnCancel } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
return value !== undefined && value !== null;
};
export const isString = (value: any): value is string => {
return typeof value === 'string';
};
export const isStringWithValue = (value: any): value is string => {
return isString(value) && value !== '';
};
export const isBlob = (value: any): value is Blob => {
return (
typeof value === 'object' &&
typeof value.type === 'string' &&
typeof value.stream === 'function' &&
typeof value.arrayBuffer === 'function' &&
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
};
export const isFormData = (value: any): value is FormData => {
return value instanceof FormData;
};
export const isSuccess = (status: number): boolean => {
return status >= 200 && status < 300;
};
export const base64 = (str: string): string => {
try {
return btoa(str);
} catch (err) {
// @ts-ignore
return Buffer.from(str).toString('base64');
}
};
export const getQueryString = (params: Record<string, any>): string => {
const qs: string[] = [];
const append = (key: string, value: any) => {
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
};
const process = (key: string, value: any) => {
if (isDefined(value)) {
if (Array.isArray(value)) {
value.forEach(v => {
process(key, v);
});
} else if (typeof value === 'object') {
Object.entries(value).forEach(([k, v]) => {
process(`${key}[${k}]`, v);
});
} else {
append(key, value);
}
}
};
Object.entries(params).forEach(([key, value]) => {
process(key, value);
});
if (qs.length > 0) {
return `?${qs.join('&')}`;
}
return '';
};
const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
const encoder = config.ENCODE_PATH || encodeURI;
const path = options.url
.replace('{api-version}', config.VERSION)
.replace(/{(.*?)}/g, (substring: string, group: string) => {
if (options.path?.hasOwnProperty(group)) {
return encoder(String(options.path[group]));
}
return substring;
});
const url = `${config.BASE}${path}`;
if (options.query) {
return `${url}${getQueryString(options.query)}`;
}
return url;
};
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
if (options.formData) {
const formData = new FormData();
const process = (key: string, value: any) => {
if (isString(value) || isBlob(value)) {
formData.append(key, value);
} else {
formData.append(key, JSON.stringify(value));
}
};
Object.entries(options.formData)
.filter(([_, value]) => isDefined(value))
.forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(v => process(key, v));
} else {
process(key, value);
}
});
return formData;
}
return undefined;
};
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
if (typeof resolver === 'function') {
return (resolver as Resolver<T>)(options);
}
return resolver;
};
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
const [token, username, password, additionalHeaders] = await Promise.all([
resolve(options, config.TOKEN),
resolve(options, config.USERNAME),
resolve(options, config.PASSWORD),
resolve(options, config.HEADERS),
]);
const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {}
const headers = Object.entries({
Accept: 'application/json',
...additionalHeaders,
...options.headers,
...formHeaders,
})
.filter(([_, value]) => isDefined(value))
.reduce((headers, [key, value]) => ({
...headers,
[key]: String(value),
}), {} as Record<string, string>);
if (isStringWithValue(token)) {
headers['Authorization'] = `Bearer ${token}`;
}
if (isStringWithValue(username) && isStringWithValue(password)) {
const credentials = base64(`${username}:${password}`);
headers['Authorization'] = `Basic ${credentials}`;
}
if (options.body !== undefined) {
if (options.mediaType) {
headers['Content-Type'] = options.mediaType;
} else if (isBlob(options.body)) {
headers['Content-Type'] = options.body.type || 'application/octet-stream';
} else if (isString(options.body)) {
headers['Content-Type'] = 'text/plain';
} else if (!isFormData(options.body)) {
headers['Content-Type'] = 'application/json';
}
}
return headers;
};
export const getRequestBody = (options: ApiRequestOptions): any => {
if (options.body) {
return options.body;
}
return undefined;
};
export const sendRequest = async <T>(
config: OpenAPIConfig,
options: ApiRequestOptions,
url: string,
body: any,
formData: FormData | undefined,
headers: Record<string, string>,
onCancel: OnCancel,
axiosClient: AxiosInstance
): Promise<AxiosResponse<T>> => {
const source = axios.CancelToken.source();
const requestConfig: AxiosRequestConfig = {
url,
headers,
data: body ?? formData,
method: options.method,
withCredentials: config.WITH_CREDENTIALS,
withXSRFToken: config.CREDENTIALS === 'include' ? config.WITH_CREDENTIALS : false,
cancelToken: source.token,
};
onCancel(() => source.cancel('The user aborted a request.'));
try {
return await axiosClient.request(requestConfig);
} catch (error) {
const axiosError = error as AxiosError<T>;
if (axiosError.response) {
return axiosError.response;
}
throw error;
}
};
export const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
if (responseHeader) {
const content = response.headers[responseHeader];
if (isString(content)) {
return content;
}
}
return undefined;
};
export const getResponseBody = (response: AxiosResponse<any>): any => {
if (response.status !== 204) {
return response.data;
}
return undefined;
};
export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
const errors: Record<number, string> = {
400: 'Bad Request',
401: 'Unauthorized',
403: 'Forbidden',
404: 'Not Found',
500: 'Internal Server Error',
502: 'Bad Gateway',
503: 'Service Unavailable',
...options.errors,
}
const error = errors[result.status];
if (error) {
throw new ApiError(options, result, error);
}
if (!result.ok) {
const errorStatus = result.status ?? 'unknown';
const errorStatusText = result.statusText ?? 'unknown';
const errorBody = (() => {
try {
return JSON.stringify(result.body, null, 2);
} catch (e) {
return undefined;
}
})();
throw new ApiError(options, result,
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
);
}
};
/**
* Request method
* @param config The OpenAPI configuration object
* @param options The request options from the service
* @param axiosClient The axios client instance to use
* @returns CancelablePromise<T>
* @throws ApiError
*/
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise<T> => {
return new CancelablePromise(async (resolve, reject, onCancel) => {
try {
const url = getUrl(config, options);
const formData = getFormData(options);
const body = getRequestBody(options);
const headers = await getHeaders(config, options, formData);
if (!onCancel.isCancelled) {
const response = await sendRequest<T>(config, options, url, body, formData, headers, onCancel, axiosClient);
const responseBody = getResponseBody(response);
const responseHeader = getResponseHeader(response, options.responseHeader);
const result: ApiResult = {
url,
ok: isSuccess(response.status),
status: response.status,
statusText: response.statusText,
body: responseHeader ?? responseBody,
};
catchErrorCodes(options, result);
resolve(result.body);
}
} catch (error) {
reject(error);
}
});
};

70
generatedss/index.ts Normal file
View File

@ -0,0 +1,70 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export { ApiError } from './core/ApiError';
export { CancelablePromise, CancelError } from './core/CancelablePromise';
export { OpenAPI } from './core/OpenAPI';
export type { OpenAPIConfig } from './core/OpenAPI';
export type { BaseResponse_boolean_ } from './models/BaseResponse_boolean_';
export type { BaseResponse_int_ } from './models/BaseResponse_int_';
export type { BaseResponse_LoginUserVO_ } from './models/BaseResponse_LoginUserVO_';
export type { BaseResponse_long_ } from './models/BaseResponse_long_';
export type { BaseResponse_Page_PostVO_ } from './models/BaseResponse_Page_PostVO_';
export type { BaseResponse_Page_Question_ } from './models/BaseResponse_Page_Question_';
export type { BaseResponse_Page_QuestionSubmitVO_ } from './models/BaseResponse_Page_QuestionSubmitVO_';
export type { BaseResponse_Page_QuestionVO_ } from './models/BaseResponse_Page_QuestionVO_';
export type { BaseResponse_Page_User_ } from './models/BaseResponse_Page_User_';
export type { BaseResponse_Page_UserVO_ } from './models/BaseResponse_Page_UserVO_';
export type { BaseResponse_PostVO_ } from './models/BaseResponse_PostVO_';
export type { BaseResponse_Question_ } from './models/BaseResponse_Question_';
export type { BaseResponse_QuestionVO_ } from './models/BaseResponse_QuestionVO_';
export type { BaseResponse_string_ } from './models/BaseResponse_string_';
export type { BaseResponse_User_ } from './models/BaseResponse_User_';
export type { BaseResponse_UserVO_ } from './models/BaseResponse_UserVO_';
export type { DeleteRequest } from './models/DeleteRequest';
export type { JudgeCase } from './models/JudgeCase';
export type { JudgeConfig } from './models/JudgeConfig';
export type { JudgeInfo } from './models/JudgeInfo';
export type { LoginUserVO } from './models/LoginUserVO';
export type { OrderItem } from './models/OrderItem';
export type { Page_PostVO_ } from './models/Page_PostVO_';
export type { Page_Question_ } from './models/Page_Question_';
export type { Page_QuestionSubmitVO_ } from './models/Page_QuestionSubmitVO_';
export type { Page_QuestionVO_ } from './models/Page_QuestionVO_';
export type { Page_User_ } from './models/Page_User_';
export type { Page_UserVO_ } from './models/Page_UserVO_';
export type { PostAddRequest } from './models/PostAddRequest';
export type { PostEditRequest } from './models/PostEditRequest';
export type { PostFavourAddRequest } from './models/PostFavourAddRequest';
export type { PostFavourQueryRequest } from './models/PostFavourQueryRequest';
export type { PostQueryRequest } from './models/PostQueryRequest';
export type { PostThumbAddRequest } from './models/PostThumbAddRequest';
export type { PostUpdateRequest } from './models/PostUpdateRequest';
export type { PostVO } from './models/PostVO';
export type { Question } from './models/Question';
export type { QuestionAddRequest } from './models/QuestionAddRequest';
export type { QuestionEditRequest } from './models/QuestionEditRequest';
export type { QuestionQueryRequest } from './models/QuestionQueryRequest';
export type { QuestionSubmitAddRequest } from './models/QuestionSubmitAddRequest';
export type { QuestionSubmitQueryRequest } from './models/QuestionSubmitQueryRequest';
export type { QuestionSubmitVO } from './models/QuestionSubmitVO';
export type { QuestionUpdateRequest } from './models/QuestionUpdateRequest';
export type { QuestionVO } from './models/QuestionVO';
export type { User } from './models/User';
export type { UserAddRequest } from './models/UserAddRequest';
export type { UserLoginRequest } from './models/UserLoginRequest';
export type { UserQueryRequest } from './models/UserQueryRequest';
export type { UserRegisterRequest } from './models/UserRegisterRequest';
export type { UserUpdateMyRequest } from './models/UserUpdateMyRequest';
export type { UserUpdateRequest } from './models/UserUpdateRequest';
export type { UserVO } from './models/UserVO';
export { FileControllerService } from './services/FileControllerService';
export { PostControllerService } from './services/PostControllerService';
export { PostFavourControllerService } from './services/PostFavourControllerService';
export { PostThumbControllerService } from './services/PostThumbControllerService';
export { QuestionControllerService } from './services/QuestionControllerService';
export { UserControllerService } from './services/UserControllerService';
export { WxMpControllerService } from './services/WxMpControllerService';

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { LoginUserVO } from './LoginUserVO';
export type BaseResponse_LoginUserVO_ = {
code?: number;
data?: LoginUserVO;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_PostVO_ } from './Page_PostVO_';
export type BaseResponse_Page_PostVO_ = {
code?: number;
data?: Page_PostVO_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_QuestionSubmitVO_ } from './Page_QuestionSubmitVO_';
export type BaseResponse_Page_QuestionSubmitVO_ = {
code?: number;
data?: Page_QuestionSubmitVO_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_QuestionVO_ } from './Page_QuestionVO_';
export type BaseResponse_Page_QuestionVO_ = {
code?: number;
data?: Page_QuestionVO_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_Question_ } from './Page_Question_';
export type BaseResponse_Page_Question_ = {
code?: number;
data?: Page_Question_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_UserVO_ } from './Page_UserVO_';
export type BaseResponse_Page_UserVO_ = {
code?: number;
data?: Page_UserVO_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Page_User_ } from './Page_User_';
export type BaseResponse_Page_User_ = {
code?: number;
data?: Page_User_;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { PostVO } from './PostVO';
export type BaseResponse_PostVO_ = {
code?: number;
data?: PostVO;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { QuestionVO } from './QuestionVO';
export type BaseResponse_QuestionVO_ = {
code?: number;
data?: QuestionVO;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Question } from './Question';
export type BaseResponse_Question_ = {
code?: number;
data?: Question;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserVO } from './UserVO';
export type BaseResponse_UserVO_ = {
code?: number;
data?: UserVO;
message?: string;
};

View File

@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { User } from './User';
export type BaseResponse_User_ = {
code?: number;
data?: User;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_boolean_ = {
code?: number;
data?: boolean;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_int_ = {
code?: number;
data?: number;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_long_ = {
code?: number;
data?: number;
message?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type BaseResponse_string_ = {
code?: number;
data?: string;
message?: string;
};

View File

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type DeleteRequest = {
id?: number;
};

View File

@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeCase = {
input?: string;
output?: string;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeConfig = {
memoryLimit?: number;
stackLimit?: number;
timeLimit?: number;
};

View File

@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type JudgeInfo = {
memory?: number;
message?: string;
time?: number;
};

Some files were not shown because too many files have changed in this diff Show More