mirror of
https://github.com/bitwarden/server.git
synced 2025-04-07 05:58:13 -05:00
36 lines
787 B
C#
36 lines
787 B
C#
using System;
|
|
using Bit.Core.Domains;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Bit.Api.Models
|
|
{
|
|
public class FolderDataModel
|
|
{
|
|
public FolderDataModel() { }
|
|
|
|
public FolderDataModel(FolderRequestModel folder)
|
|
{
|
|
Name = folder.Name;
|
|
}
|
|
|
|
public FolderDataModel(CipherRequestModel cipher)
|
|
{
|
|
Name = cipher.Name;
|
|
}
|
|
|
|
public FolderDataModel(Cipher cipher)
|
|
{
|
|
if(cipher.Type != Core.Enums.CipherType.Folder)
|
|
{
|
|
throw new ArgumentException("Cipher is not correct type.");
|
|
}
|
|
|
|
var data = JsonConvert.DeserializeObject<FolderDataModel>(cipher.Data);
|
|
|
|
Name = data.Name;
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
}
|
|
}
|