feat: TitleStatusControls

This commit is contained in:
nihonium 2025-11-27 16:26:03 +03:00
parent 3f0456ba01
commit 8a3e14a5e5
Signed by: nihonium
GPG key ID: 0251623741027CFC
5 changed files with 179 additions and 69 deletions

View file

@ -199,7 +199,7 @@ export class DefaultService {
* @returns any List of user titles
* @throws ApiError
*/
public static getUsersTitles(
public static getUserTitles(
userId: string,
cursor?: string,
sort?: TitleSort,
@ -278,27 +278,54 @@ export class DefaultService {
},
});
}
/**
* 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 ID of the user to assign the title to
* @param userId
* @param titleId
* @param requestBody
* @returns UserTitleMini Title successfully updated
* @throws ApiError
*/
public static updateUserTitle(
userId: number,
titleId: number,
requestBody: {
title_id: number;
status?: UserTitleStatus;
rate?: number;
},
): CancelablePromise<UserTitleMini> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/users/{user_id}/titles',
url: '/users/{user_id}/titles/{title_id}',
path: {
'user_id': userId,
'title_id': titleId,
},
body: requestBody,
mediaType: 'application/json',
@ -311,4 +338,31 @@ export class DefaultService {
},
});
}
/**
* 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`,
},
});
}
}