mirror of
https://github.com/bitwarden/browser
synced 2026-02-25 17:13:24 +00:00
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { Jsonify } from "type-fest";
|
|
|
|
import { CipherPermissions as SdkCipherPermissions } from "@bitwarden/sdk-internal";
|
|
|
|
import { BaseResponse } from "../../../models/response/base.response";
|
|
|
|
export class CipherPermissionsApi extends BaseResponse {
|
|
delete: boolean = false;
|
|
restore: boolean = false;
|
|
|
|
constructor(data: any = null) {
|
|
super(data);
|
|
if (data == null) {
|
|
return;
|
|
}
|
|
this.delete = this.getResponseProperty("Delete");
|
|
this.restore = this.getResponseProperty("Restore");
|
|
}
|
|
|
|
static fromJSON(obj: Jsonify<CipherPermissionsApi>) {
|
|
return Object.assign(new CipherPermissionsApi(), obj);
|
|
}
|
|
|
|
/**
|
|
* Converts the SDK CipherPermissionsApi to a CipherPermissionsApi.
|
|
*/
|
|
static fromSdkCipherPermissions(obj: SdkCipherPermissions): CipherPermissionsApi | undefined {
|
|
if (!obj) {
|
|
return undefined;
|
|
}
|
|
|
|
const permissions = new CipherPermissionsApi();
|
|
permissions.delete = obj.delete;
|
|
permissions.restore = obj.restore;
|
|
|
|
return permissions;
|
|
}
|
|
}
|