more models

This commit is contained in:
Kyle Spearrin 2019-04-12 11:42:45 -04:00
parent c89805d123
commit 87798612a6
17 changed files with 330 additions and 0 deletions

View File

@ -0,0 +1,12 @@
namespace Bit.Core.Models.Api
{
public class CardApi
{
public string CardholderName { get; set; }
public string Brand { get; set; }
public string Number { get; set; }
public string ExpMonth { get; set; }
public string ExpYear { get; set; }
public string Code { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using Bit.Core.Enums;
namespace Bit.Core.Models.Api
{
public class FieldApi
{
public FieldType Type { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
}

View File

@ -0,0 +1,24 @@
namespace Bit.Core.Models.Api
{
public class IdentityApi
{
public string Title { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public string Company { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string SSN { get; set; }
public string Username { get; set; }
public string PassportNumber { get; set; }
public string LicenseNumber { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using Bit.Core.Enums;
namespace Bit.Core.Models.Api
{
public class SecureNoteApi
{
public SecureNoteType Type { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using Bit.Core.Models.Response;
namespace Bit.Core.Models.Data
{
public class AttachmentData : Data
{
public AttachmentData() { }
public AttachmentData(AttachmentResponse response)
{
Id = response.Id;
Url = response.Url;
FileName = response.FileName;
Key = response.Key;
Size = response.Size;
SizeName = response.SizeName;
}
public string Id { get; set; }
public string Url { get; set; }
public string FileName { get; set; }
public string Key { get; set; }
public string Size { get; set; }
public string SizeName { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using Bit.Core.Models.Api;
namespace Bit.Core.Models.Data
{
public class CardData : Data
{
public CardData() { }
public CardData(CardApi data)
{
CardholderName = data.CardholderName;
Brand = data.Brand;
Number = data.Number;
ExpMonth = data.ExpMonth;
ExpYear = data.ExpYear;
Code = data.Code;
}
public string CardholderName { get; set; }
public string Brand { get; set; }
public string Number { get; set; }
public string ExpMonth { get; set; }
public string ExpYear { get; set; }
public string Code { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using Bit.Core.Models.Response;
namespace Bit.Core.Models.Data
{
public class CollectionData : Data
{
public CollectionData(CollectionResponse response)
{
Id = response.Id;
OrganizationId = response.OrganizationId;
Name = response.Name;
ExternalId = response.ExternalId;
ReadOnly = response.ReadOnly;
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public string Name { get; set; }
public string ExternalId { get; set; }
public bool ReadOnly { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using Bit.Core.Enums;
using Bit.Core.Models.Api;
namespace Bit.Core.Models.Data
{
public class FieldData : Data
{
public FieldData() { }
public FieldData(FieldApi data)
{
Type = data.Type;
Name = data.Name;
Value = data.Value;
}
public FieldType Type { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using Bit.Core.Models.Response;
using System;
namespace Bit.Core.Models.Data
{
public class FolderData : Data
{
public FolderData(FolderResponse response, string userId)
{
UserId = userId;
Id = response.Id;
Name = response.Name;
RevisionDate = response.RevisionDate;
}
public string Id { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public DateTime RevisionDate { get; set; }
}
}

View File

@ -0,0 +1,50 @@
using Bit.Core.Models.Api;
namespace Bit.Core.Models.Data
{
public class IdentityData : Data
{
public IdentityData() { }
public IdentityData(IdentityApi data)
{
Title = data.Title;
FirstName = data.FirstName;
MiddleName = data.MiddleName;
LastName = data.LastName;
Address1 = data.Address1;
Address2 = data.Address2;
Address3 = data.Address3;
City = data.City;
State = data.State;
PostalCode = data.PostalCode;
Country = data.Country;
Company = data.Company;
Email = data.Email;
Phone = data.Phone;
SSN = data.SSN;
Username = data.Username;
PassportNumber = data.PassportNumber;
LicenseNumber = data.LicenseNumber;
}
public string Title { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public string Company { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string SSN { get; set; }
public string Username { get; set; }
public string PassportNumber { get; set; }
public string LicenseNumber { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using Bit.Core.Models.Response;
using System;
namespace Bit.Core.Models.Data
{
public class PasswordHistoryData : Data
{
public PasswordHistoryData() { }
public PasswordHistoryData(PasswordHistoryResponse data)
{
Password = data.Password;
LastUsedDate = data.LastUsedDate;
}
public string Password { get; set; }
public DateTime? LastUsedDate { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using Bit.Core.Enums;
using Bit.Core.Models.Api;
namespace Bit.Core.Models.Data
{
public class SecureNoteData : Data
{
public SecureNoteData() { }
public SecureNoteData(SecureNoteApi data)
{
Type = data.Type;
}
public SecureNoteType Type { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace Bit.Core.Models.Response
{
public class AttachmentResponse
{
public string Id { get; set; }
public string Url { get; set; }
public string FileName { get; set; }
public string Key { get; set; }
public string Size { get; set; }
public string SizeName { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using Bit.Core.Models.Api;
using System;
using System.Collections.Generic;
namespace Bit.Core.Models.Response
{
public class CipherResponse
{
public string Id { get; set; }
public string OrganizationId { get; set; }
public string FolderId { get; set; }
public Enums.CipherType Type { get; set; }
public string Name { get; set; }
public string Notes { get; set; }
public List<FieldApi> Fields { get; set; }
public LoginApi Login { get; set; }
public CardApi Card { get; set; }
public IdentityApi Identity { get; set; }
public SecureNoteApi SecureNote { get; set; }
public bool Favorite { get; set; }
public bool Edit { get; set; }
public bool OrganizationUseTotp { get; set; }
public DateTime RevisionDate { get; set; }
public List<AttachmentResponse> Attachments { get; set; }
public List<PasswordHistoryResponse> PasswordHistory { get; set; }
public List<string> CollectionIds { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace Bit.Core.Models.Response
{
public class CollectionResponse
{
public string Id { get; set; }
public string OrganizationId { get; set; }
public string Name { get; set; }
public string ExternalId { get; set; }
public bool ReadOnly { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using System;
namespace Bit.Core.Models.Response
{
public class FolderResponse
{
public string Id { get; set; }
public string Name { get; set; }
public DateTime RevisionDate { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace Bit.Core.Models.Response
{
public class PasswordHistoryResponse
{
public string Password { get; set; }
public DateTime? LastUsedDate { get; set; }
}
}