feat: /titles page implementation with cursor pagination

This commit is contained in:
nihonium 2025-11-19 10:54:52 +03:00
parent a515769823
commit 397d2bcf70
Signed by: nihonium
GPG key ID: 0251623741027CFC
37 changed files with 797 additions and 1247 deletions

View file

@ -8,16 +8,19 @@ export { OpenAPI } from './core/OpenAPI';
export type { OpenAPIConfig } from './core/OpenAPI';
export type { cursor } from './models/cursor';
export type { CursorObj } from './models/CursorObj';
export type { Image } from './models/Image';
export { ReleaseSeason } from './models/ReleaseSeason';
export type { ReleaseSeason } from './models/ReleaseSeason';
export type { Review } from './models/Review';
export type { Studio } from './models/Studio';
export type { Tag } from './models/Tag';
export type { Tags } from './models/Tags';
export type { Title } from './models/Title';
export { TitleStatus } from './models/TitleStatus';
export type { title_sort } from './models/title_sort';
export type { TitleSort } from './models/TitleSort';
export type { TitleStatus } from './models/TitleStatus';
export type { User } from './models/User';
export type { UserTitle } from './models/UserTitle';
export { UserTitleStatus } from './models/UserTitleStatus';
export type { UserTitleStatus } from './models/UserTitleStatus';
export { DefaultService } from './services/DefaultService';

View file

@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type CursorObj = {
id: number;
param?: string;
};

View file

@ -5,9 +5,4 @@
/**
* Title release season
*/
export enum ReleaseSeason {
WINTER = 'winter',
SPRING = 'spring',
SUMMER = 'summer',
FALL = 'fall',
}
export type ReleaseSeason = 'winter' | 'spring' | 'summer' | 'fall';

View file

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Title sort order
*/
export type TitleSort = 'id' | 'year' | 'rating' | 'views';

View file

@ -5,8 +5,4 @@
/**
* Title status
*/
export enum TitleStatus {
FINISHED = 'finished',
ONGOING = 'ongoing',
PLANNED = 'planned',
}
export type TitleStatus = 'finished' | 'ongoing' | 'planned';

View file

@ -6,11 +6,11 @@ export type User = {
/**
* Unique user ID (primary key)
*/
id: number;
id?: number;
/**
* ID of the user avatar (references images table)
*/
avatar_id?: number | null;
avatar_id?: number;
/**
* User email
*/

View file

@ -5,9 +5,4 @@
/**
* User's title status
*/
export enum UserTitleStatus {
FINISHED = 'finished',
PLANNED = 'planned',
DROPPED = 'dropped',
IN_PROGRESS = 'in-progress',
}
export type UserTitleStatus = 'finished' | 'planned' | 'dropped' | 'in-progress';

View file

@ -0,0 +1,6 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { TitleSort } from './TitleSort';
export type title_sort = TitleSort;

View file

@ -2,17 +2,23 @@
/* 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
* @param rating
@ -21,10 +27,13 @@ export class DefaultService {
* @param limit
* @param offset
* @param fields
* @returns Title List of titles
* @returns any List of titles with cursor
* @throws ApiError
*/
public static getTitles(
cursor?: string,
sort?: TitleSort,
sortForward: boolean = true,
word?: string,
status?: TitleStatus,
rating?: number,
@ -33,11 +42,20 @@ export class DefaultService {
limit: number = 10,
offset?: number,
fields: string = 'all',
): CancelablePromise<Array<Title>> {
): 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,
@ -111,9 +129,13 @@ export class DefaultService {
* Get user titles
* @param userId
* @param cursor
* @param query
* @param word
* @param status
* @param watchStatus
* @param rating
* @param releaseYear
* @param releaseSeason
* @param limit
* @param offset
* @param fields
* @returns UserTitle List of user titles
* @throws ApiError
@ -121,22 +143,30 @@ export class DefaultService {
public static getUsersTitles(
userId: string,
cursor?: string,
query?: string,
word?: string,
status?: TitleStatus,
watchStatus?: UserTitleStatus,
rating?: number,
releaseYear?: number,
releaseSeason?: ReleaseSeason,
limit: number = 10,
offset?: number,
fields: string = 'all',
): CancelablePromise<Array<UserTitle>> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{user_id}/titles',
url: '/users/{user_id}/titles/',
path: {
'user_id': userId,
},
query: {
'cursor': cursor,
'query': query,
'word': word,
'status': status,
'watch_status': watchStatus,
'rating': rating,
'release_year': releaseYear,
'release_season': releaseSeason,
'limit': limit,
'offset': offset,
'fields': fields,
},
errors: {