Beispiel #1
0
        public CipherResponseModel(Cipher cipher)
            : base("cipher")
        {
            if(cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }

            Id = cipher.Id.ToString();
            FolderId = cipher.FolderId?.ToString();
            Type = cipher.Type;
            Favorite = cipher.Favorite;
            RevisionDate = cipher.RevisionDate;

            switch(cipher.Type)
            {
                case Core.Enums.CipherType.Folder:
                    Data = new FolderDataModel(cipher);
                    break;
                case Core.Enums.CipherType.Site:
                    Data = new SiteDataModel(cipher);
                    break;
                default:
                    throw new ArgumentException("Unsupported " + nameof(Type) + ".");
            }
        }
        public CipherResponseModel(Cipher cipher)
            : base("cipher")
        {
            if (cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }

            Id           = cipher.Id.ToString();
            FolderId     = cipher.FolderId?.ToString();
            Type         = cipher.Type;
            Favorite     = cipher.Favorite;
            RevisionDate = cipher.RevisionDate;

            switch (cipher.Type)
            {
            case Core.Enums.CipherType.Folder:
                Data = new FolderDataModel(cipher);
                break;

            case Core.Enums.CipherType.Site:
                Data = new SiteDataModel(cipher);
                break;

            default:
                throw new ArgumentException("Unsupported " + nameof(Type) + ".");
            }
        }
Beispiel #3
0
        public FolderResponseModel(Cipher cipher)
            : base("folder")
        {
            if(cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }

            if(cipher.Type != Core.Enums.CipherType.Folder)
            {
                throw new ArgumentException(nameof(cipher.Type));
            }

            var data = new FolderDataModel(cipher);

            Id = cipher.Id.ToString();
            Name = data.Name;
            RevisionDate = cipher.RevisionDate;
        }
Beispiel #4
0
        public FolderResponseModel(Cipher cipher)
            : base("folder")
        {
            if (cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }

            if (cipher.Type != Core.Enums.CipherType.Folder)
            {
                throw new ArgumentException(nameof(cipher.Type));
            }

            var data = new FolderDataModel(cipher);

            Id           = cipher.Id.ToString();
            Name         = data.Name;
            RevisionDate = cipher.RevisionDate;
        }