public CipherMiniResponseModel(Cipher cipher, GlobalSettings globalSettings, bool orgUseTotp, string obj = "cipherMini") : base(obj) { if (cipher == null) { throw new ArgumentNullException(nameof(cipher)); } Id = cipher.Id.ToString(); Type = cipher.Type; RevisionDate = cipher.RevisionDate; OrganizationId = cipher.OrganizationId?.ToString(); Attachments = AttachmentResponseModel.FromCipher(cipher, globalSettings); OrganizationUseTotp = orgUseTotp; switch (cipher.Type) { case Enums.CipherType.Login: Data = new LoginDataModel(cipher); break; case Enums.CipherType.SecureNote: Data = new SecureNoteDataModel(cipher); break; case Enums.CipherType.Card: Data = new CardDataModel(cipher); break; default: throw new ArgumentException("Unsupported " + nameof(Type) + "."); } }
public CipherResponseModel(CipherDetails cipher, string obj = "cipher") : base(obj) { if (cipher == null) { throw new ArgumentNullException(nameof(cipher)); } Id = cipher.Id.ToString(); Type = cipher.Type; RevisionDate = cipher.RevisionDate; OrganizationId = cipher.OrganizationId?.ToString(); FolderId = cipher.FolderId?.ToString(); Favorite = cipher.Favorite; switch (cipher.Type) { case Enums.CipherType.Login: Data = new LoginDataModel(cipher); break; default: throw new ArgumentException("Unsupported " + nameof(Type) + "."); } }
public LoginResponseModel(Cipher cipher, GlobalSettings globalSettings, bool orgUseTotp, string obj = "login") : base(obj) { if (cipher == null) { throw new ArgumentNullException(nameof(cipher)); } if (cipher.Type != Enums.CipherType.Login) { throw new ArgumentException(nameof(cipher.Type)); } var data = new LoginDataModel(cipher); Id = cipher.Id.ToString(); OrganizationId = cipher.OrganizationId?.ToString(); Name = data.Name; Uri = data.Uri; Username = data.Username; Password = data.Password; Notes = data.Notes; Totp = data.Totp; RevisionDate = cipher.RevisionDate; Edit = true; OrganizationUseTotp = orgUseTotp; Attachments = AttachmentResponseModel.FromCipher(cipher, globalSettings); }
public LoginResponseModel(CipherDetails cipher, string obj = "login") : base(obj) { if (cipher == null) { throw new ArgumentNullException(nameof(cipher)); } if (cipher.Type != Enums.CipherType.Login) { throw new ArgumentException(nameof(cipher.Type)); } var data = new LoginDataModel(cipher); Id = cipher.Id.ToString(); OrganizationId = cipher.OrganizationId?.ToString(); FolderId = cipher.FolderId?.ToString(); Favorite = cipher.Favorite; Name = data.Name; Uri = data.Uri; Username = data.Username; Password = data.Password; Notes = data.Notes; RevisionDate = cipher.RevisionDate; }