1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

support camel or pascal case in API responses

This commit is contained in:
Kyle Spearrin
2019-03-01 00:13:37 -05:00
parent 62e9c75357
commit 48164a31d9
43 changed files with 637 additions and 449 deletions

View File

@@ -1,7 +1,9 @@
import { BaseResponse } from './baseResponse';
import { DeviceType } from '../../enums/deviceType';
import { EventType } from '../../enums/eventType';
export class EventResponse {
export class EventResponse extends BaseResponse {
type: EventType;
userId: string;
organizationId: string;
@@ -15,16 +17,17 @@ export class EventResponse {
ipAddress: string;
constructor(response: any) {
this.type = response.Type;
this.userId = response.UserId;
this.organizationId = response.OrganizationId;
this.cipherId = response.CipherId;
this.collectionId = response.CollectionId;
this.groupId = response.GroupId;
this.organizationUserId = response.OrganizationUserId;
this.actingUserId = response.ActingUserId;
this.date = response.Date;
this.deviceType = response.DeviceType;
this.ipAddress = response.IpAddress;
super(response);
this.type = this.getResponseProperty('Type');
this.userId = this.getResponseProperty('UserId');
this.organizationId = this.getResponseProperty('OrganizationId');
this.cipherId = this.getResponseProperty('CipherId');
this.collectionId = this.getResponseProperty('CollectionId');
this.groupId = this.getResponseProperty('GroupId');
this.organizationUserId = this.getResponseProperty('OrganizationUserId');
this.actingUserId = this.getResponseProperty('ActingUserId');
this.date = this.getResponseProperty('Date');
this.deviceType = this.getResponseProperty('DeviceType');
this.ipAddress = this.getResponseProperty('IpAddress');
}
}