mirror of https://github.com/bitwarden/cli.git
10 changed files with 167 additions and 40 deletions
@ -1 +1 @@
@@ -1 +1 @@
|
||||
Subproject commit ba10d0704212f2bc8fabf0d3d6ebb552fd183401 |
||||
Subproject commit ed89dfaba70b60925817a0ce6f0c179b3f8bd2fb |
||||
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
import { AttachmentView } from 'jslib/models/view/attachmentView'; |
||||
|
||||
export class Attachment { |
||||
static template(): Attachment { |
||||
const req = new Attachment(); |
||||
req.fileName = 'photo.jpg'; |
||||
return req; |
||||
} |
||||
|
||||
static toView(req: Attachment, view = new AttachmentView()) { |
||||
view.fileName = req.fileName; |
||||
return view; |
||||
} |
||||
|
||||
fileName: string; |
||||
|
||||
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
|
||||
build(o: AttachmentView) { |
||||
this.fileName = o.fileName; |
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
import { AttachmentView } from 'jslib/models/view/attachmentView'; |
||||
|
||||
import { Attachment } from '../attachment'; |
||||
|
||||
export class AttachmentResponse extends Attachment { |
||||
id: string; |
||||
size: number; |
||||
sizeName: string; |
||||
url: string; |
||||
|
||||
constructor(o: AttachmentView) { |
||||
super(); |
||||
this.id = o.id; |
||||
this.build(o); |
||||
this.size = o.size; |
||||
this.sizeName = o.sizeName; |
||||
this.url = o.url; |
||||
} |
||||
} |
||||
@ -1,17 +1,21 @@
@@ -1,17 +1,21 @@
|
||||
import { CipherView } from 'jslib/models/view/cipherView'; |
||||
|
||||
import { BaseResponse } from './baseResponse'; |
||||
|
||||
import { Cipher } from '../cipher'; |
||||
import { AttachmentResponse } from './attachmentResponse'; |
||||
import { BaseResponse } from './baseResponse'; |
||||
|
||||
export class CipherResponse extends Cipher implements BaseResponse { |
||||
object: string; |
||||
id: string; |
||||
attachments: AttachmentResponse[]; |
||||
|
||||
constructor(o: CipherView) { |
||||
super(); |
||||
this.object = 'item'; |
||||
this.id = o.id; |
||||
this.build(o); |
||||
if (o.attachments != null) { |
||||
this.attachments = o.attachments.map((a) => new AttachmentResponse(a)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue