コード例 #1
0
        /// <summary>
        /// Creates a new organization.
        /// </summary>
        /// <param name="displayName">The display name of the organization to add.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <returns>The <see cref="IOrganization"/> generated by Trello.</returns>
        /// <remarks>The organization's name will be derived from the display name and can be changed later.</remarks>
        public async Task <IOrganization> Add(string displayName, CancellationToken ct = default(CancellationToken))
        {
            var error = NotNullOrWhiteSpaceRule.Instance.Validate(null, displayName);

            if (error != null)
            {
                throw new ValidationException <string>(displayName, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonOrganization>();

            json.DisplayName = displayName;

            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Write_CreateOrganization);
            var newData  = await JsonRepository.Execute(Auth, endpoint, json, ct);

            return(new Organization(newData, Auth));
        }
コード例 #2
0
ファイル: LabelCollection.cs プロジェクト: itworks24/sisyphus
        /// <summary>
        /// Removes a label from the collection.
        /// </summary>
        /// <param name="label">The label to add.</param>
        public void Remove(Label label)
        {
            var error = NotNullRule <Label> .Instance.Validate(null, label);

            if (error != null)
            {
                throw new ValidationException <Label>(label, new[] { error });
            }

            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_RemoveLabel, new Dictionary <string, object> {
                { "_id", OwnerId }, { "_labelId", label.Id }
            });

            JsonRepository.Execute(Auth, endpoint);

            Items.Remove(label);
            _context.Expire();
        }
コード例 #3
0
        /// <summary>
        /// Manually updates the collection's data.
        /// </summary>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        public sealed override async Task Refresh(CancellationToken ct = default(CancellationToken))
        {
            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Read_PowerUps, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonPowerUp> >(Auth, endpoint, ct);

            Items.Clear();
            Items.AddRange(newData.Select(jn =>
            {
                var powerUp = jn.GetFromCache <IPowerUp>(Auth);
                if (powerUp is PowerUpBase contexted)
                {
                    contexted.Json = jn;
                }
                return(powerUp);
            }));
        }
コード例 #4
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            var allParameters = AdditionalParameters.Concat(AttachmentContext.CurrentParameters)
                                .Where(kvp => ((string)kvp.Value).Contains("attachments"))
                                .ToDictionary(kvp => $"attachments_{kvp.Key}", kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Read_Attachments, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonAttachment> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(ja =>
            {
                var attachment  = TrelloConfiguration.Cache.Find <Attachment>(ja.Id) ?? new Attachment(ja, OwnerId, Auth);
                attachment.Json = ja;
                return(attachment);
            }));
        }
コード例 #5
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            IncorporateLimit();

            var allParameters = AdditionalParameters.Concat(NotificationContext.CurrentParameters)
                                .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Read_Notifications, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonNotification> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            Items.AddRange(newData.Select(jn =>
            {
                var notification  = jn.GetFromCache <Notification, IJsonNotification>(Auth);
                notification.Json = jn;
                return(notification);
            }));
        }
コード例 #6
0
        public async Task Delete(CancellationToken ct)
        {
            if (_deleted)
            {
                return;
            }
            CancelUpdate();

            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Write_DeleteBoardBackground,
                                                 new Dictionary <string, object>
            {
                { "_idMember", _ownerId },
                { "_id", Data.Id }
            });
            await JsonRepository.Execute(Auth, endpoint, ct);

            _deleted = true;
            RaiseDeleted();
        }
        /// <summary>
        /// Removes a member from an organization.
        /// </summary>
        /// <param name="member">The member to remove.</param>
        public void Remove(Member member)
        {
            var error = NotNullRule <Member> .Instance.Validate(null, member);

            if (error != null)
            {
                throw new ValidationException <Member>(member, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonParameter>();

            json.String = member.Id;

            var endpoint = EndpointFactory.Build(EntityRequestType.Organization_Write_RemoveMember, new Dictionary <string, object> {
                { "_id", OwnerId }, { "_memberId", member.Id }
            });

            JsonRepository.Execute(Auth, endpoint, json);
        }
コード例 #8
0
        /// <summary>
        /// Adds a <see cref="ISticker"/> to a <see cref="IMember"/>'s custom sticker set by uploading data.
        /// </summary>
        /// <param name="filePath">The path of the file to attach.</param>
        /// <param name="name">A name for the sticker.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <returns>The <see cref="ISticker"/> generated by Trello.</returns>
        public async Task <ISticker> Add(string filePath, string name, CancellationToken ct = default)
        {
            if (!File.Exists(filePath))
            {
                throw new Exception(filePath + " Invalid file path");
            }

            var parameters = new Dictionary <string, object> {
                { RestFile.ParameterKey, new RestFile {
                      FilePath = filePath, FileName = name
                  } }
            };
            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_AddAttachment, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <IJsonSticker>(Auth, endpoint, ct, parameters);

            return(new Sticker(newData, OwnerId, Auth));
        }
コード例 #9
0
        internal override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            IncorporateLimit();

            AdditionalParameters["filter"] = "custom";

            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Read_BoardBackgrounds, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonBoardBackground> >(Auth, endpoint, ct, AdditionalParameters);

            Items.Clear();
            Items.AddRange(newData.Select(jb =>
            {
                var background  = jb.GetFromCache <BoardBackground, IJsonBoardBackground>(Auth, true, OwnerId);
                background.Json = jb;
                return(background);
            }));
        }
コード例 #10
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            IncorporateLimit();

            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Read_StarredBoards, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonStarredBoard> >(Auth, endpoint, ct, AdditionalParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(jb =>
            {
                var board  = jb.GetFromCache <StarredBoard, IJsonStarredBoard>(Auth);
                board.Json = jb;
                return(board);
            }));
            EventAggregator.Subscribe(this);
        }
コード例 #11
0
        public void Delete()
        {
            if (_deleted)
            {
                return;
            }
            CancelUpdate();

            var endpoint = EndpointFactory.Build(EntityRequestType.Attachment_Write_Delete,
                                                 new Dictionary <string, object>
            {
                { "_cardId", _ownerId },
                { "_id", Data.Id }
            });

            JsonRepository.Execute(Auth, endpoint);

            _deleted = true;
        }
コード例 #12
0
        /// <summary>
        /// Implement to provide data to the collection.
        /// </summary>
        protected override void Update()
        {
            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Read_PowerUps, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = JsonRepository.Execute <List <IJsonPowerUp> >(Auth, endpoint);

            Items.Clear();
            Items.AddRange(newData.Select(jn =>
            {
                var powerUp   = jn.GetFromCache <IPowerUp>(Auth);
                var contexted = powerUp as PowerUpBase;
                if (contexted != null)
                {
                    contexted.Json = jn;
                }
                return(powerUp);
            }));
        }
コード例 #13
0
        /// <summary>
        /// Adds a custom board background.
        /// </summary>
        /// <param name="filePath">The path of the file to attach.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <returns>The newly created <see cref="IBoardBackground"/>.</returns>
        public async Task <IBoardBackground> Add(string filePath, CancellationToken ct = default)
        {
            if (!File.Exists(filePath))
            {
                throw new Exception(filePath + " Invalid file path");
            }

            var parameters = new Dictionary <string, object> {
                { RestFile.ParameterKey, new RestFile {
                      FilePath = filePath, FileName = "BoardBackground"
                  } }
            };
            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Write_AddBoardBackground, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <IJsonBoardBackground>(Auth, endpoint, ct, parameters);

            return(new BoardBackground(OwnerId, newData, Auth));
        }
コード例 #14
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            var allParameters = AdditionalParameters.Concat(MemberContext.CurrentParameters)
                                .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(_updateRequestType, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonMember> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(jm =>
            {
                var member  = jm.GetFromCache <Member, IJsonMember>(Auth);
                member.Json = jm;
                return(member);
            }));
            EventAggregator.Subscribe(this);
        }
コード例 #15
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            var allParameters = AdditionalParameters.Concat(CheckListContext.CurrentParameters)
                                .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Read_CheckLists, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonCheckList> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(jc =>
            {
                var checkList  = jc.GetFromCache <CheckList, IJsonCheckList>(Auth);
                checkList.Json = jc;
                return(checkList);
            }));
            EventAggregator.Subscribe(this);
        }
コード例 #16
0
        /// <summary>
        /// Adds a new custom field definition to a board.
        /// </summary>
        /// <param name="name">The field's name.</param>
        /// <param name="type">The field's data type.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <param name="options">(Optional) A collection of drop down options.</param>
        /// <returns>The <see cref="ICustomFieldDefinition"/> generated by Trello.</returns>
        public async Task <ICustomFieldDefinition> Add(string name, CustomFieldType type,
                                                       CancellationToken ct = default,
                                                       params IDropDownOption[] options)
        {
            var error = NotNullRule <string> .Instance.Validate(null, name);

            if (error != null)
            {
                throw new ValidationException <string>(name, new[] { error });
            }
            if (type == CustomFieldType.Unknown)
            {
                throw new ValidationException <CustomFieldType>(type, new string[] { });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonCustomFieldDefinition>();

            json.Name              = name;
            json.Board             = TrelloConfiguration.JsonFactory.Create <IJsonBoard>();
            json.Board.Id          = OwnerId;
            json.Type              = type;
            json.Display           = TrelloConfiguration.JsonFactory.Create <IJsonCustomFieldDisplayInfo>();
            json.Display.CardFront = true;
            if (type == CustomFieldType.DropDown)
            {
                json.Options = options.Select((o, i) =>
                {
                    var optionJson          = TrelloConfiguration.JsonFactory.Create <IJsonCustomDropDownOption>();
                    optionJson.Color        = o.Color;
                    optionJson.Pos          = TrelloConfiguration.JsonFactory.Create <IJsonPosition>();
                    optionJson.Pos.Explicit = i * 1024;
                    optionJson.Text         = o.Text;

                    return(optionJson);
                }).ToList();
            }

            var endpoint = EndpointFactory.Build(EntityRequestType.CustomFieldDefinition_Write_Create);
            var newData  = await JsonRepository.Execute(Auth, endpoint, json, ct);

            return(new CustomFieldDefinition(newData, Auth));
        }
コード例 #17
0
        /// <summary>
        /// Creates a new checklist item.
        /// </summary>
        /// <param name="name">The name of the checklist item to add.</param>
        /// <returns>The <see cref="CheckItem"/> generated by Trello.</returns>
        public CheckItem Add(string name)
        {
            var error = NotNullOrWhiteSpaceRule.Instance.Validate(null, name);

            if (error != null)
            {
                throw new ValidationException <string>(name, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonCheckItem>();

            json.Name = name;

            var endpoint = EndpointFactory.Build(EntityRequestType.CheckList_Write_AddCheckItem, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = JsonRepository.Execute(Auth, endpoint, json);

            return(new CheckItem(newData, OwnerId));
        }
コード例 #18
0
        /// <summary>
        /// Adds a member to the collection.
        /// </summary>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <param name="member">The member to add.</param>
        public async Task Add(IMember member, CancellationToken ct = default(CancellationToken))
        {
            var error = NotNullRule <IMember> .Instance.Validate(null, member);

            if (error != null)
            {
                throw new ValidationException <IMember>(member, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonParameter>();

            json.String = member.Id;

            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_AssignMember, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            await JsonRepository.Execute(Auth, endpoint, json, ct);

            Items.Add(member);
        }
コード例 #19
0
        /// <summary>
        /// Posts a new comment to a card.
        /// </summary>
        /// <param name="text">The content of the comment.</param>
        /// <returns>The <see cref="Action"/> associated with the comment.</returns>
        public Action Add(string text)
        {
            var error = NotNullOrWhiteSpaceRule.Instance.Validate(null, text);

            if (error != null)
            {
                throw new ValidationException <string>(text, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonComment>();

            json.Text = text;

            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_AddComment, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = JsonRepository.Execute(Auth, endpoint, json);

            return(new Action(newData, Auth));
        }
コード例 #20
0
        /// <summary>
        /// Creates a new list.
        /// </summary>
        /// <param name="name">The name of the list to add.</param>
        /// <returns>The <see cref="List"/> generated by Trello.</returns>
        public List Add(string name)
        {
            var error = NotNullOrWhiteSpaceRule.Instance.Validate(null, name);

            if (error != null)
            {
                throw new ValidationException <string>(name, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonList>();

            json.Name     = name;
            json.Board    = TrelloConfiguration.JsonFactory.Create <IJsonBoard>();
            json.Board.Id = OwnerId;

            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Write_AddList);
            var newData  = JsonRepository.Execute(Auth, endpoint, json);

            return(new List(newData, Auth));
        }
コード例 #21
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            IncorporateLimit();

            var allParameters = AdditionalParameters.Concat(OrganizationContext.CurrentParameters)
                                .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(EntityRequestType.Member_Read_Organizations, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonOrganization> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(jo =>
            {
                var org  = jo.GetFromCache <Organization, IJsonOrganization>(Auth);
                org.Json = jo;
                return(org);
            }));
            EventAggregator.Subscribe(this);
        }
コード例 #22
0
        internal sealed override async Task PerformRefresh(bool force, CancellationToken ct)
        {
            IncorporateLimit();

            var allParameters = AdditionalParameters.Concat(ListContext.CurrentParameters)
                                .ToDictionary(kvp => kvp.Key == "filter" ? kvp.Key : $"list_{kvp.Key}", kvp => kvp.Value);
            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Read_Lists, new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            var newData = await JsonRepository.Execute <List <IJsonList> >(Auth, endpoint, ct, allParameters);

            Items.Clear();
            EventAggregator.Unsubscribe(this);
            Items.AddRange(newData.Select(jl =>
            {
                var list  = jl.GetFromCache <List, IJsonList>(Auth);
                list.Json = jl;
                return(list);
            }));
            EventAggregator.Subscribe(this);
        }
コード例 #23
0
        /// <summary>
        /// Adds a member to a board with specified privileges.
        /// </summary>
        /// <param name="member">The member to add.</param>
        /// <param name="membership">The membership type.</param>
        public BoardMembership Add(Member member, BoardMembershipType membership)
        {
            var error = NotNullRule <Member> .Instance.Validate(null, member);

            if (error != null)
            {
                throw new ValidationException <Member>(member, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonBoardMembership>();

            json.Member     = member.Json;
            json.MemberType = membership;

            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Write_AddOrUpdateMember, new Dictionary <string, object> {
                { "_id", OwnerId }, { "_memberId", member.Id }
            });
            var newData = JsonRepository.Execute(Auth, endpoint, json);

            return(new BoardMembership(newData, OwnerId, Auth));
        }
コード例 #24
0
        /// <summary>
        /// Creates a new list.
        /// </summary>
        /// <param name="name">The name of the list to add.</param>
        /// <param name="position">(Optional) The position of the list.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <returns>The <see cref="IList"/> generated by Trello.</returns>
        public async Task <IList> Add(string name, Position position = null, CancellationToken ct = default(CancellationToken))
        {
            var error = NotNullOrWhiteSpaceRule.Instance.Validate(null, name);

            if (error != null)
            {
                throw new ValidationException <string>(name, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonList>();

            json.Name     = name;
            json.Board    = TrelloConfiguration.JsonFactory.Create <IJsonBoard>();
            json.Board.Id = OwnerId;
            json.Pos      = Position.GetJson(position);

            var endpoint = EndpointFactory.Build(EntityRequestType.Board_Write_AddList);
            var newData  = await JsonRepository.Execute(Auth, endpoint, json, ct);

            return(new List(newData, Auth));
        }
コード例 #25
0
        protected override IJsonOrganization GetData()
        {
            try
            {
                var endpoint = EndpointFactory.Build(EntityRequestType.Organization_Read_Refresh, new Dictionary <string, object> {
                    { "_id", Data.Id }
                });
                var newData = JsonRepository.Execute <IJsonOrganization>(Auth, endpoint);
                MarkInitialized();

                return(newData);
            }
            catch (TrelloInteractionException e)
            {
                if (!e.IsNotFoundError() || !IsInitialized)
                {
                    throw;
                }
                _deleted = true;
                return(Data);
            }
        }
コード例 #26
0
        /// <summary>
        /// Adds a label to the collection.
        /// </summary>
        /// <param name="label">The label to add.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        public async Task Add(ILabel label, CancellationToken ct = default(CancellationToken))
        {
            var error = NotNullRule <ILabel> .Instance.Validate(null, label);

            if (error != null)
            {
                throw new ValidationException <ILabel>(label, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonParameter>();

            json.String = label.Id;

            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_AddLabel,
                                                 new Dictionary <string, object> {
                { "_id", OwnerId }
            });
            await JsonRepository.Execute(Auth, endpoint, json, ct);

            Items.Add(label);
            await _context.Synchronize(true, ct);
        }
コード例 #27
0
        /// <summary>
        /// Adds a label to the collection.
        /// </summary>
        /// <param name="label">The label to add.</param>
        public void Add(Label label)
        {
            var error = NotNullRule <Label> .Instance.Validate(null, label);

            if (error != null)
            {
                throw new ValidationException <Label>(label, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonParameter>();

            json.String = label.Id;

            var endpoint = EndpointFactory.Build(EntityRequestType.Card_Write_AddLabel, new Dictionary <string, object> {
                { "_id", OwnerId }
            });

            JsonRepository.Execute(Auth, endpoint, json);

            Items.Add(label);
            _context.Expire();
        }
コード例 #28
0
        /// <summary>
        /// Adds a member to an organization with specified privileges.
        /// </summary>
        /// <param name="member">The member to add.</param>
        /// <param name="membership">The membership type.</param>
        /// <param name="ct">(Optional) A cancellation token for async processing.</param>
        /// <returns>The <see cref="IOrganizationMembership"/> generated by Trello.</returns>
        public async Task <IOrganizationMembership> Add(IMember member, OrganizationMembershipType membership,
                                                        CancellationToken ct = default(CancellationToken))
        {
            var error = NotNullRule <IMember> .Instance.Validate(null, member);

            if (error != null)
            {
                throw new ValidationException <IMember>(member, new[] { error });
            }

            var json = TrelloConfiguration.JsonFactory.Create <IJsonOrganizationMembership>();

            json.Member     = ((Member)member).Json;
            json.MemberType = membership;

            var endpoint = EndpointFactory.Build(EntityRequestType.Organization_Write_AddOrUpdateMember, new Dictionary <string, object> {
                { "_id", OwnerId }, { "_memberId", member.Id }
            });
            var newData = await JsonRepository.Execute(Auth, endpoint, json, ct);

            return(new OrganizationMembership(newData, OwnerId, Auth));
        }
コード例 #29
0
        protected override async Task <IJsonCustomFieldDefinition> GetData(CancellationToken ct)
        {
            try
            {
                var endpoint = EndpointFactory.Build(EntityRequestType.CustomFieldDefinition_Read_Refresh,
                                                     new Dictionary <string, object> {
                    { "_id", Data.Id }
                });
                var newData = await JsonRepository.Execute <IJsonCustomFieldDefinition>(Auth, endpoint, ct);

                return(newData);
            }
            catch (TrelloInteractionException e)
            {
                if (!e.IsNotFoundError() || !IsInitialized)
                {
                    throw;
                }
                _deleted = true;
                return(Data);
            }
        }
コード例 #30
0
        protected override async Task <IJsonSticker> GetData(CancellationToken ct)
        {
            try
            {
                var endpoint = EndpointFactory.Build(EntityRequestType.Sticker_Read_Refresh,
                                                     new Dictionary <string, object> {
                    { "_cardId", _ownerId }, { "_id", Data.Id }
                });
                var newData = await JsonRepository.Execute <IJsonSticker>(Auth, endpoint, ct, CurrentParameters);

                MarkInitialized();
                return(newData);
            }
            catch (TrelloInteractionException e)
            {
                if (!e.IsNotFoundError() || !IsInitialized)
                {
                    throw;
                }
                _deleted = true;
                return(Data);
            }
        }