mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
cli response objects
This commit is contained in:
9
src/models/response/baseResponse.ts
Normal file
9
src/models/response/baseResponse.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export abstract class BaseResponse {
|
||||
object: string;
|
||||
|
||||
constructor(object?: string) {
|
||||
if (object != null) {
|
||||
this.object = object;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/models/response/cipherResponse.ts
Normal file
22
src/models/response/cipherResponse.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { CipherType } from 'jslib/enums';
|
||||
|
||||
export class CipherResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
type: CipherType;
|
||||
name: string;
|
||||
notes: string;
|
||||
|
||||
constructor(o: CipherView) {
|
||||
super('item');
|
||||
this.id = o.id;
|
||||
this.organizationId = o.organizationId;
|
||||
this.type = o.type;
|
||||
this.name = o.name;
|
||||
this.notes = o.notes;
|
||||
}
|
||||
}
|
||||
16
src/models/response/collectionResponse.ts
Normal file
16
src/models/response/collectionResponse.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { CollectionView } from 'jslib/models/view/collectionView';
|
||||
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class CollectionResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
name: string;
|
||||
|
||||
constructor(o: CollectionView) {
|
||||
super('collection');
|
||||
this.id = o.id;
|
||||
this.organizationId = o.organizationId;
|
||||
this.name = o.name;
|
||||
}
|
||||
}
|
||||
14
src/models/response/folderResponse.ts
Normal file
14
src/models/response/folderResponse.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { FolderView } from 'jslib/models/view/folderView';
|
||||
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class FolderResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
constructor(o: FolderView) {
|
||||
super('folder');
|
||||
this.id = o.id;
|
||||
this.name = o.name;
|
||||
}
|
||||
}
|
||||
10
src/models/response/listResponse.ts
Normal file
10
src/models/response/listResponse.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class ListResponse extends BaseResponse {
|
||||
data: BaseResponse[];
|
||||
|
||||
constructor(data: BaseResponse[]) {
|
||||
super('list');
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
14
src/models/response/stringResponse.ts
Normal file
14
src/models/response/stringResponse.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { CipherType } from 'jslib/enums';
|
||||
|
||||
export class StringResponse extends BaseResponse {
|
||||
data: string;
|
||||
|
||||
constructor(data: string) {
|
||||
super('string');
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user