diff --git a/src/commands/get.command.ts b/src/commands/get.command.ts index f22a7f848a1..5d0ed6e6aa3 100644 --- a/src/commands/get.command.ts +++ b/src/commands/get.command.ts @@ -36,6 +36,8 @@ import { Response } from 'jslib/cli/models/response'; import { MessageResponse } from 'jslib/cli/models/response/messageResponse'; import { StringResponse } from 'jslib/cli/models/response/stringResponse'; +import { SendType } from 'jslib/enums/sendType'; + import { CipherResponse } from '../models/response/cipherResponse'; import { CollectionResponse } from '../models/response/collectionResponse'; import { FolderResponse } from '../models/response/folderResponse'; @@ -430,14 +432,11 @@ export class GetCommand extends DownloadCommand { case 'org-collection': template = OrganizationCollectionRequest.template(); break; - case 'send': - template = SendResponse.template(); - break; case 'send.text': - template = SendTextResponse.template(); + template = SendResponse.template(SendType.Text); break; case 'send.file': - template = SendFileResponse.template(); + template = SendResponse.template(SendType.File); break; default: return Response.badRequest('Unknown template object.'); diff --git a/src/models/response/sendResponse.ts b/src/models/response/sendResponse.ts index bb2fe673aa3..7111e548a66 100644 --- a/src/models/response/sendResponse.ts +++ b/src/models/response/sendResponse.ts @@ -14,13 +14,13 @@ const dateProperties: string[] = [Utils.nameOf('deletionDate'), Ut export class SendResponse implements BaseResponse { - static template(deleteInDays = 7): SendResponse { + static template(sendType?: SendType, deleteInDays = 7): SendResponse { const req = new SendResponse(); req.name = 'Send name'; req.notes = 'Some notes about this send.'; req.type = SendType.Text; - req.text = null; - req.file = null; + req.text = sendType === SendType.Text ? SendTextResponse.template() : null; + req.file = sendType === SendType.File ? SendFileResponse.template() : null; req.maxAccessCount = null; req.deletionDate = this.getStandardDeletionDate(deleteInDays); req.expirationDate = null; diff --git a/src/send.program.ts b/src/send.program.ts index daf226bbecd..15ec34d33d0 100644 --- a/src/send.program.ts +++ b/src/send.program.ts @@ -251,7 +251,7 @@ export class SendProgram extends Program { sendText = SendTextResponse.template(data, options.hidden); } - const template = Utils.assign(SendResponse.template(options.deleteInDays), { + const template = Utils.assign(SendResponse.template(null, options.deleteInDays), { name: options.name ?? name, notes: options.notes, file: sendFile,