wallee
Version:
TypeScript/JavaScript client for wallee
40 lines (39 loc) • 1.56 kB
JavaScript
import { AccountFromJSON, AccountToJSON, } from './Account';
import { PermissionFromJSON, } from './Permission';
import { RoleStateFromJSON, RoleStateToJSON, } from './RoleState';
/**
* Check if a given object implements the Role interface.
*/
export function instanceOfRole(value) {
return true;
}
export function RoleFromJSON(json) {
return RoleFromJSONTyped(json, false);
}
export function RoleFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'permissions': json['permissions'] == null ? undefined : (new Set(json['permissions'].map(PermissionFromJSON))),
'name': json['name'] == null ? undefined : json['name'],
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : RoleStateFromJSON(json['state']),
'version': json['version'] == null ? undefined : json['version'],
'account': json['account'] == null ? undefined : AccountFromJSON(json['account']),
'twoFactorRequired': json['twoFactorRequired'] == null ? undefined : json['twoFactorRequired'],
};
}
export function RoleToJSON(json) {
return RoleToJSONTyped(json, false);
}
export function RoleToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'state': RoleStateToJSON(value['state']),
'account': AccountToJSON(value['account']),
};
}