285 lines
8.8 KiB
TypeScript
285 lines
8.8 KiB
TypeScript
/* 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 { 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 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,
|
||
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,
|
||
'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 getTitles1(
|
||
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 getUsers(
|
||
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 `-`, 3–16 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 getUsersTitles(
|
||
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 any Title successfully added to user
|
||
* @throws ApiError
|
||
*/
|
||
public static addUserTitle(
|
||
userId: number,
|
||
requestBody: UserTitle,
|
||
): CancelablePromise<{
|
||
data?: {
|
||
user_id: number;
|
||
title_id: number;
|
||
status: UserTitleStatus;
|
||
rate?: number;
|
||
review_id?: number;
|
||
ctime?: string;
|
||
};
|
||
}> {
|
||
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`,
|
||
},
|
||
});
|
||
}
|
||
}
|