예제 #1
0
        internal Attachment(IJsonAttachment json, string ownerId, TrelloAuthorization auth)
        {
            Id       = json.Id;
            _context = new AttachmentContext(Id, ownerId, auth);
            _context.Synchronized.Add(this);

            _bytes     = new Field <int?>(_context, nameof(Bytes));
            _date      = new Field <DateTime?>(_context, nameof(Date));
            _member    = new Field <Member>(_context, nameof(Member));
            _edgeColor = new Field <WebColor>(_context, nameof(EdgeColor));
            _isUpload  = new Field <bool?>(_context, nameof(IsUpload));
            _mimeType  = new Field <string>(_context, nameof(MimeType));
            _name      = new Field <string>(_context, nameof(Name));
            _name.AddRule(NotNullOrWhiteSpaceRule.Instance);
            _position = new Field <Position>(_context, nameof(Position));
            _position.AddRule(PositionRule.Instance);
            _url = new Field <string>(_context, nameof(Url));

            if (auth != TrelloAuthorization.Null)
            {
                TrelloConfiguration.Cache.Add(this);
            }

            _context.Merge(json);
        }
예제 #2
0
        internal Attachment(IJsonAttachment json, string ownerId, TrelloAuthorization auth)
        {
            Id       = json.Id;
            _context = new AttachmentContext(Id, ownerId, auth);
            _context.Synchronized += Synchronized;

            _bytes    = new Field <int?>(_context, nameof(Bytes));
            _date     = new Field <DateTime?>(_context, nameof(Date));
            _member   = new Field <Member>(_context, nameof(Member));
            _isUpload = new Field <bool?>(_context, nameof(IsUpload));
            _mimeType = new Field <string>(_context, nameof(MimeType));
            _name     = new Field <string>(_context, nameof(Name));
            Previews  = new ReadOnlyAttachmentPreviewCollection(_context, auth);
            _url      = new Field <string>(_context, nameof(Url));

            TrelloConfiguration.Cache.Add(this);

            _context.Merge(json);
        }
예제 #3
0
 void IMergeJson <IJsonAttachment> .Merge(IJsonAttachment json, bool overwrite)
 {
     _context.Merge(json, overwrite);
 }
예제 #4
0
 void IMergeJson <IJsonAttachment> .Merge(IJsonAttachment json)
 {
     _context.Merge(json);
 }