feat: bots
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user