1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

cli response objects

This commit is contained in:
Kyle Spearrin
2018-05-14 14:54:19 -04:00
parent 3dd38cbe12
commit 4f3f84539d
13 changed files with 203 additions and 58 deletions

View File

@@ -0,0 +1,9 @@
export abstract class BaseResponse {
object: string;
constructor(object?: string) {
if (object != null) {
this.object = object;
}
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View File

@@ -0,0 +1,10 @@
import { BaseResponse } from './baseResponse';
export class ListResponse extends BaseResponse {
data: BaseResponse[];
constructor(data: BaseResponse[]) {
super('list');
this.data = data;
}
}

View 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;
}
}