bitwarden-android/src/App/Models/Site.cs

53 lines
1.8 KiB
C#
Raw Normal View History

2016-05-02 09:52:09 +03:00
using Bit.App.Models.Api;
using Bit.App.Models.Data;
namespace Bit.App.Models
{
public class Site : Cipher
{
public Site()
{ }
public Site(SiteData data)
{
Id = data.Id;
FolderId = data.FolderId;
Name = data.Name != null ? new CipherString(data.Name) : null;
Uri = data.Uri != null ? new CipherString(data.Uri) : null;
Username = data.Username != null ? new CipherString(data.Username) : null;
Password = data.Password != null ? new CipherString(data.Password) : null;
Notes = data.Notes != null ? new CipherString(data.Notes) : null;
2016-06-15 05:36:37 +03:00
Favorite = data.Favorite;
2016-05-02 09:52:09 +03:00
}
public Site(SiteResponse response)
{
2016-05-03 09:08:50 +03:00
Id = response.Id;
FolderId = response.FolderId;
2016-05-02 09:52:09 +03:00
Name = response.Name != null ? new CipherString(response.Name) : null;
Uri = response.Uri != null ? new CipherString(response.Uri) : null;
Username = response.Username != null ? new CipherString(response.Username) : null;
Password = response.Password != null ? new CipherString(response.Password) : null;
Notes = response.Notes != null ? new CipherString(response.Notes) : null;
2016-06-15 05:36:37 +03:00
Favorite = response.Favorite;
2016-05-02 09:52:09 +03:00
}
2016-05-03 09:08:50 +03:00
public string FolderId { get; set; }
2016-05-02 09:52:09 +03:00
public CipherString Uri { get; set; }
public CipherString Username { get; set; }
public CipherString Password { get; set; }
public CipherString Notes { get; set; }
2016-06-15 05:36:37 +03:00
public bool Favorite { get; set; }
2016-05-02 09:52:09 +03:00
2016-05-03 09:08:50 +03:00
public SiteRequest ToSiteRequest()
{
return new SiteRequest(this);
}
2016-05-03 00:50:16 +03:00
public SiteData ToSiteData(string userId)
2016-05-02 09:52:09 +03:00
{
2016-05-03 00:50:16 +03:00
return new SiteData(this, userId);
2016-05-02 09:52:09 +03:00
}
}
}