feat: bots

This commit is contained in:
Lala, Shahd
2026-06-10 09:31:27 +00:00
parent a2d2c00afe
commit fa27f2c23b
5 changed files with 149 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Bot, BotWithToken } from '../models/bot.models';
@Injectable({ providedIn: 'root' })
export class BotService {
private readonly http = inject(HttpClient);
private readonly base = '/api/account/official-bots';
list(): Observable<Bot[]> {
return this.http.get<Bot[]>(this.base);
}
create(name: string): Observable<BotWithToken> {
return this.http.post<BotWithToken>(this.base, { name });
}
delete(botId: string): Observable<void> {
return this.http.delete<void>(`${this.base}/${botId}`);
}
}