nyanimedb/modules/frontend/src/api/services/DefaultService.ts
nihonium bd868bb724
All checks were successful
Build and Deploy Go App / build (push) Successful in 5m32s
Build and Deploy Go App / deploy (push) Successful in 35s
fix: reworked csrf
2025-12-04 10:12:05 +03:00

371 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CursorObj } from '../models/CursorObj';
import type { ReleaseSeason } from '../models/ReleaseSeason';
import type { Title } from '../models/Title';
import type { TitleSort } from '../models/TitleSort';
import type { TitleStatus } from '../models/TitleStatus';
import type { User } from '../models/User';
import type { UserTitle } from '../models/UserTitle';
import type { UserTitleMini } from '../models/UserTitleMini';
import type { UserTitleStatus } from '../models/UserTitleStatus';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class DefaultService {
/**
* Get titles
* @param cursor
* @param sort
* @param sortForward
* @param extSearch
* @param word
* @param status List of title statuses to filter
* @param rating
* @param releaseYear
* @param releaseSeason
* @param limit
* @param offset
* @param fields
* @returns any List of titles with cursor
* @throws ApiError
*/
public static getTitles(
cursor?: string,
sort?: TitleSort,
sortForward: boolean = true,
extSearch: boolean = false,
word?: string,
status?: Array<TitleStatus>,
rating?: number,
releaseYear?: number,
releaseSeason?: ReleaseSeason,
limit: number = 10,
offset?: number,
fields: string = 'all',
): CancelablePromise<{
/**
* List of titles
*/
data: Array<Title>;
cursor: CursorObj;
}> {
return __request(OpenAPI, {
method: 'GET',
url: '/titles',
query: {
'cursor': cursor,
'sort': sort,
'sort_forward': sortForward,
'ext_search': extSearch,
'word': word,
'status': status,
'rating': rating,
'release_year': releaseYear,
'release_season': releaseSeason,
'limit': limit,
'offset': offset,
'fields': fields,
},
errors: {
400: `Request params are not correct`,
500: `Unknown server error`,
},
});
}
/**
* Get title description
* @param titleId
* @param fields
* @returns Title Title description
* @throws ApiError
*/
public static getTitle(
titleId: number,
fields: string = 'all',
): CancelablePromise<Title> {
return __request(OpenAPI, {
method: 'GET',
url: '/titles/{title_id}',
path: {
'title_id': titleId,
},
query: {
'fields': fields,
},
errors: {
400: `Request params are not correct`,
404: `Title not found`,
500: `Unknown server error`,
},
});
}
/**
* Get user info
* @param userId
* @param fields
* @returns User User info
* @throws ApiError
*/
public static getUsersId(
userId: string,
fields: string = 'all',
): CancelablePromise<User> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{user_id}',
path: {
'user_id': userId,
},
query: {
'fields': fields,
},
errors: {
400: `Request params are not correct`,
404: `User not found`,
500: `Unknown server error`,
},
});
}
/**
* Partially update a user account
* Update selected user profile fields (excluding password).
* Password updates must be done via the dedicated auth-service (`/auth/`).
* Fields not provided in the request body remain unchanged.
*
* @param userId User ID (primary key)
* @param requestBody
* @returns User User updated successfully. Returns updated user representation (excluding sensitive fields).
* @throws ApiError
*/
public static updateUser(
userId: number,
requestBody: {
/**
* ID of the user avatar (references `images.id`); set to `null` to remove avatar
*/
avatar_id?: number | null;
/**
* User email (must be unique and valid)
*/
mail?: string;
/**
* Username (alphanumeric + `_` or `-`, 316 chars)
*/
nickname?: string;
/**
* Display name
*/
disp_name?: string;
/**
* User description / bio
*/
user_desc?: string;
},
): CancelablePromise<User> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/users/{user_id}',
path: {
'user_id': userId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Invalid input (e.g., validation failed, nickname/email conflict, malformed JSON)`,
401: `Unauthorized — missing or invalid authentication token`,
403: `Forbidden — user is not allowed to modify this resource (e.g., not own profile & no admin rights)`,
404: `User not found`,
409: `Conflict — e.g., requested \`nickname\` or \`mail\` already taken by another user`,
422: `Unprocessable Entity — semantic errors not caught by schema (e.g., invalid \`avatar_id\`)`,
500: `Unknown server error`,
},
});
}
/**
* Get user titles
* @param userId
* @param cursor
* @param sort
* @param sortForward
* @param word
* @param status List of title statuses to filter
* @param watchStatus
* @param rating
* @param myRate
* @param releaseYear
* @param releaseSeason
* @param limit
* @param fields
* @returns any List of user titles
* @throws ApiError
*/
public static getUserTitles(
userId: string,
cursor?: string,
sort?: TitleSort,
sortForward: boolean = true,
word?: string,
status?: Array<TitleStatus>,
watchStatus?: Array<UserTitleStatus>,
rating?: number,
myRate?: number,
releaseYear?: number,
releaseSeason?: ReleaseSeason,
limit: number = 10,
fields: string = 'all',
): CancelablePromise<{
data: Array<UserTitle>;
cursor: CursorObj;
}> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{user_id}/titles',
path: {
'user_id': userId,
},
query: {
'cursor': cursor,
'sort': sort,
'sort_forward': sortForward,
'word': word,
'status': status,
'watch_status': watchStatus,
'rating': rating,
'my_rate': myRate,
'release_year': releaseYear,
'release_season': releaseSeason,
'limit': limit,
'fields': fields,
},
errors: {
400: `Request params are not correct`,
404: `User not found`,
500: `Unknown server error`,
},
});
}
/**
* Add a title to a user
* User adding title to list af watched, status required
* @param userId ID of the user to assign the title to
* @param requestBody
* @returns UserTitleMini Title successfully added to user
* @throws ApiError
*/
public static addUserTitle(
userId: number,
requestBody: {
title_id: number;
status: UserTitleStatus;
rate?: number;
},
): CancelablePromise<UserTitleMini> {
return __request(OpenAPI, {
method: 'POST',
url: '/users/{user_id}/titles',
path: {
'user_id': userId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Invalid request body (missing fields, invalid types, etc.)`,
401: `Unauthorized — missing or invalid auth token`,
403: `Forbidden — user not allowed to assign titles to this user`,
404: `User or Title not found`,
409: `Conflict — title already assigned to user (if applicable)`,
500: `Internal server error`,
},
});
}
/**
* Get user title
* @param userId
* @param titleId
* @returns UserTitleMini User titles
* @throws ApiError
*/
public static getUserTitle(
userId: number,
titleId: number,
): CancelablePromise<UserTitleMini> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{user_id}/titles/{title_id}',
path: {
'user_id': userId,
'title_id': titleId,
},
errors: {
400: `Request params are not correct`,
404: `User or title not found`,
500: `Unknown server error`,
},
});
}
/**
* Update a usertitle
* User updating title list of watched
* @param userId
* @param titleId
* @param requestBody
* @returns UserTitleMini Title successfully updated
* @throws ApiError
*/
public static updateUserTitle(
userId: number,
titleId: number,
requestBody: {
status?: UserTitleStatus;
rate?: number;
},
): CancelablePromise<UserTitleMini> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/users/{user_id}/titles/{title_id}',
path: {
'user_id': userId,
'title_id': titleId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Invalid request body (missing fields, invalid types, etc.)`,
401: `Unauthorized — missing or invalid auth token`,
403: `Forbidden — user not allowed to update title`,
404: `User or Title not found`,
500: `Internal server error`,
},
});
}
/**
* Delete a usertitle
* User deleting title from list of watched
* @param userId
* @param titleId
* @returns any Title successfully deleted
* @throws ApiError
*/
public static deleteUserTitle(
userId: number,
titleId: number,
): CancelablePromise<any> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/users/{user_id}/titles/{title_id}',
path: {
'user_id': userId,
'title_id': titleId,
},
errors: {
401: `Unauthorized — missing or invalid auth token`,
403: `Forbidden — user not allowed to delete title`,
404: `User or Title not found`,
500: `Internal server error`,
},
});
}
}