55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using System;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Models.Api;
|
|
using Bit.Core.Models.Domain;
|
|
|
|
namespace Bit.Core.Models.Request
|
|
{
|
|
public class SendRequest
|
|
{
|
|
public SendType Type { get; set; }
|
|
public string Name { get; set; }
|
|
public string Notes { get; set; }
|
|
public string Key { get; set; }
|
|
public int? MaxAccessCount { get; set; }
|
|
public DateTime? ExpirationDate { get; set; }
|
|
public DateTime DeletionDate { get; set; }
|
|
public SendTextApi Text { get; set; }
|
|
public SendFileApi File { get; set; }
|
|
public string Password { get; set; }
|
|
public bool Disabled { get; set; }
|
|
|
|
public SendRequest(Send send)
|
|
{
|
|
Type = send.Type;
|
|
Name = send.Name?.EncryptedString;
|
|
Notes = send.Notes?.EncryptedString;
|
|
MaxAccessCount = send.MaxAccessCount;
|
|
ExpirationDate = send.ExpirationDate;
|
|
DeletionDate = send.DeletionDate;
|
|
Key = send.Key?.EncryptedString;
|
|
Password = send.Password;
|
|
Disabled = send.Disabled;
|
|
|
|
switch (Type)
|
|
{
|
|
case SendType.Text:
|
|
Text = new SendTextApi
|
|
{
|
|
Text = send.Text?.Text?.EncryptedString,
|
|
Hidden = send.Text.Hidden
|
|
};
|
|
break;
|
|
case SendType.File:
|
|
File = new SendFileApi
|
|
{
|
|
FileName = send.File?.FileName?.EncryptedString
|
|
};
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|