// This file is auto-generated by @hey-api/openapi-ts import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; import type { GetAllUsersApiV1AuthUsersGetData, GetAllUsersApiV1AuthUsersGetResponses, GetCurrentUserApiV1AuthMeGetData, GetCurrentUserApiV1AuthMeGetResponses, HealthCheckHealthGetData, HealthCheckHealthGetResponses, LoginApiV1AuthLoginPostData, LoginApiV1AuthLoginPostErrors, LoginApiV1AuthLoginPostResponses, LogoutApiV1AuthLogoutPostData, LogoutApiV1AuthLogoutPostResponses, RegisterApiV1AuthRegisterPostData, RegisterApiV1AuthRegisterPostErrors, RegisterApiV1AuthRegisterPostResponses, RootGetData, RootGetResponses } from './types.gen'; export type Options = Options2 & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a * custom client. */ client?: Client; /** * You can pass arbitrary values through the `meta` object. This can be * used to access values that aren't defined as part of the SDK function. */ meta?: Record; }; /** * 用户登录 * * 用户登录接口 * * - **username**: 用户名 * - **password**: 密码 * * 返回JWT访问令牌 */ export const loginApiV1AuthLoginPost = (options: Options) => { return (options.client ?? client).post({ url: '/api/v1/auth/login', ...options, headers: { 'Content-Type': 'application/json', ...options.headers } }); }; /** * 用户注册 * * 用户注册接口 * * - **username**: 用户名 (必须唯一) * - **password**: 密码 * * 注意:这是一个演示版本,实际生产环境需要更严格的验证 */ export const registerApiV1AuthRegisterPost = (options: Options) => { return (options.client ?? client).post({ url: '/api/v1/auth/register', ...options, headers: { 'Content-Type': 'application/json', ...options.headers } }); }; /** * 获取当前用户信息 * * 获取当前登录用户的信息 */ export const getCurrentUserApiV1AuthMeGet = (options?: Options) => { return (options?.client ?? client).get({ security: [ { scheme: 'bearer', type: 'http' } ], url: '/api/v1/auth/me', ...options }); }; /** * 用户登出 * * 用户登出接口 * * 注意:由于JWT是无状态的,实际登出需要客户端删除token * 这里只是验证token并返回成功消息 */ export const logoutApiV1AuthLogoutPost = (options?: Options) => { return (options?.client ?? client).post({ security: [ { scheme: 'bearer', type: 'http' } ], url: '/api/v1/auth/logout', ...options }); }; /** * 获取所有用户列表 * * 获取系统中所有用户的列表 (仅用于演示) */ export const getAllUsersApiV1AuthUsersGet = (options?: Options) => { return (options?.client ?? client).get({ url: '/api/v1/auth/users', ...options }); }; /** * Root */ export const rootGet = (options?: Options) => { return (options?.client ?? client).get({ url: '/', ...options }); }; /** * Health Check */ export const healthCheckHealthGet = (options?: Options) => { return (options?.client ?? client).get({ url: '/health', ...options }); };