This commit is contained in:
Bastian Wagner
2026-06-26 10:13:31 +02:00
parent 9078da9f66
commit 671fd62ad8
7 changed files with 852 additions and 0 deletions

View File

@@ -4,8 +4,10 @@ import { Observable } from 'rxjs';
import { of, tap, throwError } from 'rxjs';
import {
AddListItemRequest,
ApplyListCleanupResponse,
CreateListRequest,
CreateListWithItemSuggestionsResponse,
ListCleanupSuggestionsResponse,
ListItemSuggestionsResponse,
UpdateListItemRequest,
UpdateListRequest,
@@ -173,6 +175,34 @@ export class ListsService {
);
}
suggestCleanup(listId: string): Observable<ListCleanupSuggestionsResponse> {
if (!this.onlineStatus.online()) {
return throwError(
() => new Error('AI Cleanup ist nur online verfuegbar.'),
);
}
return this.http.post<ListCleanupSuggestionsResponse>(
`${this.apiUrl}/${listId}/cleanup-suggestions`,
{},
);
}
applyCleanup(listId: string): Observable<ApplyListCleanupResponse> {
if (!this.onlineStatus.online()) {
return throwError(
() => new Error('AI Cleanup ist nur online verfuegbar.'),
);
}
return this.http
.post<ApplyListCleanupResponse>(
`${this.apiUrl}/${listId}/apply-cleanup`,
{},
)
.pipe(tap((response) => this.upsertCachedList(response.list)));
}
createTemplateFromList(listId: string): Observable<ListTemplate> {
if (!this.onlineStatus.online()) {
return throwError(