Example #1
0
        public CardContext(string id, TrelloAuthorization auth)
            : base(auth)
        {
            Data.Id = id;

            Actions                 = new ReadOnlyActionCollection(typeof(Card), () => Data.Id, auth);
            Actions.Refreshed      += (s, e) => OnMerged(new[] { nameof(Actions) });
            Attachments             = new AttachmentCollection(() => Data.Id, auth);
            Attachments.Refreshed  += (s, e) => OnMerged(new[] { nameof(Attachments) });
            CheckLists              = new CheckListCollection(() => Data.Id, auth);
            CheckLists.Refreshed   += (s, e) => OnMerged(new[] { nameof(CheckLists) });
            Comments                = new CommentCollection(() => Data.Id, auth);
            Comments.Refreshed     += (s, e) => OnMerged(new[] { nameof(Comments) });
            CustomFields            = new ReadOnlyCustomFieldCollection(() => Data.Id, auth);
            CustomFields.Refreshed += (s, e) => OnMerged(new[] { nameof(CustomFields) });
            Labels                   = new CardLabelCollection(this, auth);
            Labels.Refreshed        += (s, e) => OnMerged(new[] { nameof(Labels) });
            Members                  = new MemberCollection(() => Data.Id, auth);
            Members.Refreshed       += (s, e) => OnMerged(new[] { nameof(Members) });
            PowerUpData              = new ReadOnlyPowerUpDataCollection(EntityRequestType.Card_Read_PowerUpData, () => Data.Id, auth);
            PowerUpData.Refreshed   += (s, e) => OnMerged(new[] { nameof(PowerUpData) });
            Stickers                 = new CardStickerCollection(() => Data.Id, auth);
            Stickers.Refreshed      += (s, e) => OnMerged(new[] { nameof(Stickers) });
            VotingMembers            = new ReadOnlyMemberCollection(EntityRequestType.Card_Read_MembersVoted, () => Data.Id, auth);
            VotingMembers.Refreshed += (s, e) => OnMerged(new[] { nameof(VotingMembers) });

            BadgesContext = new BadgesContext(Auth);

            Data.Badges = BadgesContext.Data;
        }
        public BoardContext(string id, TrelloAuthorization auth)
            : base(auth)
        {
            Data.Id = id;

            Actions                 = new ReadOnlyActionCollection(typeof(Board), () => Data.Id, auth);
            Actions.Refreshed      += (s, e) => OnMerged(new[] { nameof(Actions) });
            Cards                   = new ReadOnlyCardCollection(typeof(Board), () => Data.Id, auth);
            Cards.Refreshed        += (s, e) => OnMerged(new[] { nameof(Cards) });
            CustomFields            = new CustomFieldDefinitionCollection(() => Data.Id, auth);
            CustomFields.Refreshed += (s, e) => OnMerged(new[] { nameof(CustomFields) });
            Labels                  = new BoardLabelCollection(() => Data.Id, auth);
            Labels.Refreshed       += (s, e) => OnMerged(new[] { nameof(Labels) });
            Lists                   = new ListCollection(() => Data.Id, auth);
            Lists.Refreshed        += (s, e) => OnMerged(new[] { nameof(Lists) });
            Members                 = new ReadOnlyMemberCollection(EntityRequestType.Board_Read_Members, () => Data.Id, auth);
            Members.Refreshed      += (s, e) => OnMerged(new[] { nameof(Members) });
            Memberships             = new BoardMembershipCollection(() => Data.Id, auth);
            Memberships.Refreshed  += (s, e) => OnMerged(new[] { nameof(Memberships) });
            PowerUps                = new PowerUpCollection(() => Data.Id, auth);
            PowerUps.Refreshed     += (s, e) => OnMerged(new[] { nameof(PowerUps) });
            PowerUpData             = new ReadOnlyPowerUpDataCollection(EntityRequestType.Board_Read_PowerUpData, () => Data.Id, auth);
            PowerUpData.Refreshed  += (s, e) => OnMerged(new[] { nameof(PowerUpData) });

            BoardPreferencesContext = new BoardPreferencesContext(Auth);
            BoardPreferencesContext.SubmitRequested += ct => HandleSubmitRequested("Preferences", ct);
            Data.Prefs = BoardPreferencesContext.Data;
        }
        public OrganizationContext(string id, TrelloAuthorization auth)
            : base(auth)
        {
            Data.Id = id;

            Actions            = new ReadOnlyActionCollection(typeof(Organization), () => Data.Id, auth);
            Actions.Refreshed += (s, e) => OnMerged(new List <string> {
                nameof(Actions)
            });
            Boards            = new BoardCollection(typeof(Organization), () => Data.Id, auth);
            Boards.Refreshed += (s, e) => OnMerged(new List <string> {
                nameof(Boards)
            });
            Members            = new ReadOnlyMemberCollection(EntityRequestType.Organization_Read_Members, () => Data.Id, auth);
            Members.Refreshed += (s, e) => OnMerged(new List <string> {
                nameof(Members)
            });
            Memberships            = new OrganizationMembershipCollection(() => Data.Id, auth);
            Memberships.Refreshed += (s, e) => OnMerged(new List <string> {
                nameof(Memberships)
            });
            PowerUpData            = new ReadOnlyPowerUpDataCollection(EntityRequestType.Organization_Read_PowerUpData, () => Data.Id, auth);
            PowerUpData.Refreshed += (s, e) => OnMerged(new List <string> {
                nameof(PowerUpData)
            });

            OrganizationPreferencesContext = new OrganizationPreferencesContext(Auth);
            OrganizationPreferencesContext.SubmitRequested += ct => HandleSubmitRequested("Preferences", ct);
            Data.Prefs = OrganizationPreferencesContext.Data;
        }