Simplify send templates (#237)
* Simplify Send templates * Fix internal template reference * No trailing whitespace
This commit is contained in:
parent
2c11e5d6a9
commit
e77e1c94e8
|
@ -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.');
|
||||
|
|
|
@ -14,13 +14,13 @@ const dateProperties: string[] = [Utils.nameOf<SendResponse>('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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue