134 lines
2.7 KiB
TypeScript
134 lines
2.7 KiB
TypeScript
/**
|
|
* Generated by orval v8.4.2 🍺
|
|
* Do not edit manually.
|
|
* DreamChat API
|
|
* The DreamChat API documentation
|
|
* OpenAPI spec version: 1.0.0
|
|
*/
|
|
import type {
|
|
CharacterResponseDto,
|
|
CreateCharacterDto,
|
|
UpdateCharacterDto
|
|
} from '.././model';
|
|
|
|
import { customFetch } from '../../mutator/custom-fetch';
|
|
|
|
/**
|
|
* @summary Create a new character
|
|
*/
|
|
export const getCharacterControllerCreateUrl = () => {
|
|
|
|
|
|
|
|
|
|
return `http://localhost:3000/api/characters`
|
|
}
|
|
|
|
export const characterControllerCreate = async (createCharacterDto: CreateCharacterDto, options?: RequestInit): Promise<CharacterResponseDto> => {
|
|
|
|
return customFetch<CharacterResponseDto>(getCharacterControllerCreateUrl(),
|
|
{
|
|
...options,
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
body: JSON.stringify(
|
|
createCharacterDto,)
|
|
}
|
|
);}
|
|
|
|
|
|
/**
|
|
* @summary Get all characters for current user
|
|
*/
|
|
export const getCharacterControllerFindAllUrl = () => {
|
|
|
|
|
|
|
|
|
|
return `http://localhost:3000/api/characters`
|
|
}
|
|
|
|
export const characterControllerFindAll = async ( options?: RequestInit): Promise<CharacterResponseDto[]> => {
|
|
|
|
return customFetch<CharacterResponseDto[]>(getCharacterControllerFindAllUrl(),
|
|
{
|
|
...options,
|
|
method: 'GET'
|
|
|
|
|
|
}
|
|
);}
|
|
|
|
|
|
/**
|
|
* @summary Get character by ID
|
|
*/
|
|
export const getCharacterControllerFindOneUrl = (id: string,) => {
|
|
|
|
|
|
|
|
|
|
return `http://localhost:3000/api/characters/${id}`
|
|
}
|
|
|
|
export const characterControllerFindOne = async (id: string, options?: RequestInit): Promise<CharacterResponseDto> => {
|
|
|
|
return customFetch<CharacterResponseDto>(getCharacterControllerFindOneUrl(id),
|
|
{
|
|
...options,
|
|
method: 'GET'
|
|
|
|
|
|
}
|
|
);}
|
|
|
|
|
|
/**
|
|
* @summary Update character
|
|
*/
|
|
export const getCharacterControllerUpdateUrl = (id: string,) => {
|
|
|
|
|
|
|
|
|
|
return `http://localhost:3000/api/characters/${id}`
|
|
}
|
|
|
|
export const characterControllerUpdate = async (id: string,
|
|
updateCharacterDto: UpdateCharacterDto, options?: RequestInit): Promise<CharacterResponseDto> => {
|
|
|
|
return customFetch<CharacterResponseDto>(getCharacterControllerUpdateUrl(id),
|
|
{
|
|
...options,
|
|
method: 'PUT',
|
|
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
body: JSON.stringify(
|
|
updateCharacterDto,)
|
|
}
|
|
);}
|
|
|
|
|
|
/**
|
|
* @summary Delete character
|
|
*/
|
|
export const getCharacterControllerDeleteUrl = (id: string,) => {
|
|
|
|
|
|
|
|
|
|
return `http://localhost:3000/api/characters/${id}`
|
|
}
|
|
|
|
export const characterControllerDelete = async (id: string, options?: RequestInit): Promise<void> => {
|
|
|
|
return customFetch<void>(getCharacterControllerDeleteUrl(id),
|
|
{
|
|
...options,
|
|
method: 'DELETE'
|
|
|
|
|
|
}
|
|
);}
|
|
|
|
|