mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
* Made domain classes ts-strict compliant and fixed spec files * Fixed domain base class and other test files * Added conditional utils and fixed small nits * removed comments * removd ts expect errors * Added removed counter * renamed test name * fixed tests
48 lines
1.2 KiB
TypeScript
48 lines
1.2 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 implements SdkCipherPermissions {
|
|
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 | undefined,
|
|
): CipherPermissionsApi | undefined {
|
|
if (!obj) {
|
|
return undefined;
|
|
}
|
|
|
|
const permissions = new CipherPermissionsApi();
|
|
permissions.delete = obj.delete;
|
|
permissions.restore = obj.restore;
|
|
|
|
return permissions;
|
|
}
|
|
|
|
/**
|
|
* Converts the CipherPermissionsApi to an SdkCipherPermissions
|
|
*/
|
|
toSdkCipherPermissions(): SdkCipherPermissions {
|
|
return this;
|
|
}
|
|
}
|