Beispiel #1
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);
        }
Beispiel #2
0
        /// <summary>
        /// Implement to provide data to the collection.
        /// </summary>
        protected sealed override void Update()
        {
            _context.Synchronize();
            if (_context.Data.Labels == null)
            {
                return;
            }

            Items.Clear();
            Items.AddRange(_context.Data.Labels.Select(jl =>
            {
                var label  = jl.GetFromCache <Label>(Auth);
                label.Json = jl;
                return(label);
            }));
        }
Beispiel #3
0
 /// <summary>
 /// Refreshes the card data.
 /// </summary>
 /// <param name="force">Indicates that the refresh should ignore the value in <see cref="TrelloConfiguration.RefreshThrottle"/> and make the call to the API.</param>
 /// <param name="ct">(Optional) A cancellation token for async processing.</param>
 public Task Refresh(bool force = false, CancellationToken ct = default)
 {
     return(_context.Synchronize(force, ct));
 }
Beispiel #4
0
 /// <summary>
 /// Refreshes the card data.
 /// </summary>
 /// <param name="ct">(Optional) A cancellation token for async processing.</param>
 public async Task Refresh(CancellationToken ct = default(CancellationToken))
 {
     await _context.Synchronize(ct);
 }