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