matrix-dimension/web/app/shared/services/integrations/sticker-api.service.ts

28 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Injectable } from "@angular/core";
import { AuthedApi } from "../authed-api";
import { FE_StickerConfig, FE_UserStickerPack } from "../../models/integration";
2019-06-29 06:21:56 +00:00
import { HttpClient } from "@angular/common/http";
@Injectable()
export class StickerApiService extends AuthedApi {
2019-06-29 06:21:56 +00:00
constructor(http: HttpClient) {
super(http);
}
public getConfig(): Promise<FE_StickerConfig> {
2019-06-29 06:21:56 +00:00
return this.authedGet<FE_StickerConfig>("/api/v1/dimension/stickers/config").toPromise();
}
public getPacks(): Promise<FE_UserStickerPack[]> {
2019-06-29 06:21:56 +00:00
return this.authedGet<FE_UserStickerPack[]>("/api/v1/dimension/stickers/packs").toPromise();
}
public togglePackSelection(packId: number, isSelected: boolean): Promise<any> {
2019-06-29 06:21:56 +00:00
return this.authedPost("/api/v1/dimension/stickers/packs/" + packId + "/selected", {isSelected: isSelected}).toPromise();
}
2019-03-21 04:32:29 +00:00
public importStickerpack(packUrl: string): Promise<FE_UserStickerPack> {
2019-06-29 06:21:56 +00:00
return this.authedPost<FE_UserStickerPack>("/api/v1/dimension/stickers/packs/import", {packUrl}).toPromise();
2019-03-21 04:32:29 +00:00
}
}