mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
support camel or pascal case in API responses
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { SelectionReadOnlyResponse } from './selectionReadOnlyResponse';
|
||||
|
||||
export class CollectionResponse {
|
||||
export class CollectionResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
name: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.organizationId = response.OrganizationId;
|
||||
this.name = response.Name;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +19,7 @@ export class CollectionDetailsResponse extends CollectionResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.readOnly = response.ReadOnly || false;
|
||||
this.readOnly = this.getResponseProperty('ReadOnly') || false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +28,9 @@ export class CollectionGroupDetailsResponse extends CollectionResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
if (response.Groups != null) {
|
||||
this.groups = response.Groups.map((g: any) => new SelectionReadOnlyResponse(g));
|
||||
const groups = this.getResponseProperty('Groups');
|
||||
if (groups != null) {
|
||||
this.groups = groups.map((g: any) => new SelectionReadOnlyResponse(g));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user