2018-05-12 23:55:02 -04:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { AuthedApi } from "../authed-api";
|
|
|
|
import { FE_StickerPack } from "../../models/integration";
|
2019-06-29 02:21:56 -04:00
|
|
|
import { HttpClient } from "@angular/common/http";
|
2018-05-12 23:55:02 -04:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class AdminStickersApiService extends AuthedApi {
|
2019-06-29 02:21:56 -04:00
|
|
|
constructor(http: HttpClient) {
|
2018-05-12 23:55:02 -04:00
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getAllPacks(): Promise<FE_StickerPack[]> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_StickerPack[]>("/api/v1/dimension/admin/stickers/packs").toPromise();
|
2018-05-12 23:55:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public togglePack(packId: number, isEnabled: boolean): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/stickers/packs/" + packId + "/enabled", {isEnabled: isEnabled}).toPromise();
|
2018-05-12 23:55:02 -04:00
|
|
|
}
|
2018-12-22 19:37:31 -05:00
|
|
|
|
|
|
|
public importFromTelegram(packUrl: string): Promise<FE_StickerPack> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost<FE_StickerPack>("/api/v1/dimension/admin/stickers/packs/import/telegram", {packUrl: packUrl}).toPromise();
|
2018-12-22 19:37:31 -05:00
|
|
|
}
|
2020-08-01 09:50:14 -04:00
|
|
|
|
|
|
|
public removePack(packId: number): Promise<any> {
|
|
|
|
return this.authedDelete("/api/v1/dimension/admin/stickers/packs/" + packId).toPromise();
|
|
|
|
}
|
2018-05-12 23:55:02 -04:00
|
|
|
}
|