Deletes dormant legacy API surface (zero live callers, verified against
the full backend route table):
- VoiceDesignerApi, VoiceConversionApi, AnalyticsApi
(/v1/analytics/log_session was never registered) - both @storyteller/api
and the Tauri app's ApiManager copies, plus their tests
- PromptsApi/EngineApi: /v1/image_studio/prompt,
/v1/image_studio/session_jobs, /v1/jobs/session/{token} methods (routes
do not exist)
- UserBookmarksApi: broken-path list methods (/list/{user} and
/list/{et}/{etok}; backend shapes are /list/user/{u} and
/list/entity/{et}/{etok}) and the FakeYou-era scoped enums that only
they consumed
- Dashboard UsersApi: RequestPasswordReset/ResetPassword pointing at
removed /v1/request_password_reset + /v1/reset_password (live pages use
PasswordResetApi -> /v1/password_reset/* correctly)
Fixes WeightsApi cover-image path to the registered route:
/v1/weights/weight/{token}/cover_image (both copies).
90 lines
2.4 KiB
TypeScript
90 lines
2.4 KiB
TypeScript
import { ApiManager, ApiResponse } from "./ApiManager.js";
|
|
import { UserBookmarkBatch } from "./models/UserBookmark.js";
|
|
|
|
export class UserBookmarksApi extends ApiManager {
|
|
public CreateUserBookmark({
|
|
entityToken,
|
|
entityType,
|
|
}: {
|
|
entityToken: string;
|
|
entityType: string;
|
|
}): Promise<
|
|
ApiResponse<{
|
|
new_bookmark_count_for_entity?: number;
|
|
user_bookmark_token?: string;
|
|
}>
|
|
> {
|
|
const endpoint = `${this.getApiSchemeAndHost()}/v1/user_bookmarks/create`;
|
|
const body = {
|
|
entity_token: entityToken,
|
|
entity_type: entityType,
|
|
};
|
|
|
|
return this.post<
|
|
{
|
|
entity_token: string;
|
|
entity_type: string;
|
|
},
|
|
{
|
|
success?: boolean;
|
|
new_bookmark_count_for_entity?: number;
|
|
user_bookmark_token: string;
|
|
BadInput?: string;
|
|
}
|
|
>({ endpoint, body })
|
|
.then((response) => ({
|
|
success: response.success ?? false,
|
|
data: {
|
|
new_bookmark_count_for_entity: response.new_bookmark_count_for_entity,
|
|
user_bookmark_token: response.user_bookmark_token,
|
|
},
|
|
errorMessage: response.BadInput,
|
|
}))
|
|
.catch((err) => {
|
|
return { success: false, errorMessage: err.message };
|
|
});
|
|
}
|
|
|
|
public DeleteUserBookmark({
|
|
entityToken,
|
|
}: {
|
|
entityToken: string;
|
|
}): Promise<ApiResponse<undefined>> {
|
|
const endpoint = `${this.getApiSchemeAndHost()}/v1/user_bookmarks/delete/${entityToken}`;
|
|
|
|
return this.delete<
|
|
{ as_mod: boolean },
|
|
{
|
|
success?: boolean;
|
|
BadInput?: string;
|
|
}
|
|
>({ endpoint, body: { as_mod: true } })
|
|
.then((response) => ({
|
|
success: response.success ?? false,
|
|
errorMessage: response.BadInput,
|
|
}))
|
|
.catch((err) => {
|
|
return { success: false, errorMessage: err.message };
|
|
});
|
|
}
|
|
|
|
public ListUserBookmarks(): Promise<ApiResponse<UserBookmarkBatch[]>> {
|
|
const endpoint = `${this.getApiSchemeAndHost()}/v1/user_bookmarks/batch`;
|
|
|
|
return this.get<{
|
|
success?: boolean;
|
|
bookmarks?: UserBookmarkBatch[];
|
|
BadInput?: string;
|
|
}>({ endpoint })
|
|
.then((response) => ({
|
|
success: response.success ?? false,
|
|
data: response.bookmarks,
|
|
errorMessage: response.BadInput,
|
|
}))
|
|
.catch((err) => {
|
|
return { success: false, errorMessage: err.message };
|
|
});
|
|
}
|
|
|
|
}
|