Add auto-generated API client and schema files
Some checks failed
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Failing after 42s

Integrated auto-generated TypeScript client and schemas using @hey-api/openapi-ts for API communication. Includes type definitions, API endpoint handlers, and React Query integration for enhanced type safety and developer experience.
This commit is contained in:
2025-03-05 10:09:48 +01:00
parent a7504f6876
commit ffa3f2ffd3
6 changed files with 903 additions and 0 deletions

View File

@@ -0,0 +1,145 @@
// This file is auto-generated by @hey-api/openapi-ts
import { type Options as ClientOptions, type TDataShape, type Client, urlSearchParamsBodySerializer } from '@hey-api/client-axios';
import type { RootGetData, RootGetResponse, RegisterData, RegisterResponse, RegisterError, LoginData, LoginResponse, LoginError, LoginOauthData, LoginOauthResponse, LoginOauthError, RefreshTokenData, RefreshTokenResponse, RefreshTokenError, ChangePasswordData, ChangePasswordError, GetCurrentUserInfoData, GetCurrentUserInfoResponse } from './types.gen';
import { client as _heyApiClient } from './client.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
/**
* 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<string, unknown>;
};
/**
* Root
*/
export const rootGet = <ThrowOnError extends boolean = false>(options?: Options<RootGetData, ThrowOnError>) => {
return (options?.client ?? _heyApiClient).get<RootGetResponse, unknown, ThrowOnError>({
responseType: 'text',
url: '/',
...options
});
};
/**
* Register User
* Register a new user.
*
* Returns:
* The created user information.
*/
export const register = <ThrowOnError extends boolean = false>(options: Options<RegisterData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<RegisterResponse, RegisterError, ThrowOnError>({
url: '/api/v1/auth/register',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};
/**
* Login
* Login with username and password.
*
* Returns:
* Access and refresh tokens.
*/
export const login = <ThrowOnError extends boolean = false>(options: Options<LoginData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<LoginResponse, LoginError, ThrowOnError>({
url: '/api/v1/auth/login',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};
/**
* Login Oauth
* OAuth2-compatible login endpoint, used by the OpenAPI UI.
*
* Returns:
* Access and refresh tokens.
*/
export const loginOauth = <ThrowOnError extends boolean = false>(options: Options<LoginOauthData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<LoginOauthResponse, LoginOauthError, ThrowOnError>({
...urlSearchParamsBodySerializer,
url: '/api/v1/auth/login/oauth',
...options,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
...options?.headers
}
});
};
/**
* Refresh Token
* Refresh access token using a refresh token.
*
* Returns:
* New access and refresh tokens.
*/
export const refreshToken = <ThrowOnError extends boolean = false>(options: Options<RefreshTokenData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<RefreshTokenResponse, RefreshTokenError, ThrowOnError>({
url: '/api/v1/auth/refresh',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};
/**
* Change Password
* Change current user's password.
*
* Requires authentication.
*/
export const changePassword = <ThrowOnError extends boolean = false>(options: Options<ChangePasswordData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<unknown, ChangePasswordError, ThrowOnError>({
security: [
{
scheme: 'bearer',
type: 'http'
}
],
url: '/api/v1/auth/change-password',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};
/**
* Get Current User Info
* Get current user information.
*
* Requires authentication.
*/
export const getCurrentUserInfo = <ThrowOnError extends boolean = false>(options?: Options<GetCurrentUserInfoData, ThrowOnError>) => {
return (options?.client ?? _heyApiClient).get<GetCurrentUserInfoResponse, unknown, ThrowOnError>({
security: [
{
scheme: 'bearer',
type: 'http'
}
],
url: '/api/v1/auth/me',
...options
});
};