Exemple #1
0
 public async Task DeleteAsync(int id, int revision, CancellationToken cancellationToken)
 {
     var parameters = new Dictionary <string, object> {
         { "revision", revision }
     };
     await client.SendAsync(ServiceClient.BuildCommand("webhooks", id), parameters, null, HttpMethod.Delete, cancellationToken).ConfigureAwait(false);
 }
 private async Task UploadFinishedAsync(uint uploadId, CancellationToken cancellationToken)
 {
     var requestContent = new Dictionary <string, object> {
         { "state", "finished" }
     };
     await client.PatchAsync <ResourcePart>(ServiceClient.BuildCommand("uploads", uploadId), null, requestContent, cancellationToken).ConfigureAwait(false);
 }
Exemple #3
0
            public Task DeleteAsync(uint id, int revision, CancellationToken cancellationToken)
            {
                var parameters = new Dictionary <string, object> {
                    { "revision", revision }
                };

                return(client.SendAsync(ServiceClient.BuildCommand("tasks", id), parameters, null, HttpMethod.Delete, cancellationToken));
            }
Exemple #4
0
            public async Task <Reminder> UpdateAsync(int id, int revision, DateTime date, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "date", date }
                };

                return(await client.PatchAsync <Reminder>(ServiceClient.BuildCommand("reminders", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #5
0
            public async Task <Membership> UpdateAsync(int id, int revision, MembershipState state, bool muted, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "state", state }, { "muted", muted }
                };

                return(await client.PatchAsync <Membership>(ServiceClient.BuildCommand("memberships", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #6
0
            public Task <Note> UpdateAsync(uint id, int revision, string content, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "content", content }
                };

                return(client.PatchAsync <Note>(ServiceClient.BuildCommand("notes", id), null, requestContent, cancellationToken));
            }
Exemple #7
0
            public async Task <Comment> UpdateAsync(int id, int revision, string comment, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "text", comment }
                };

                return(await client.PatchAsync <Comment>(ServiceClient.BuildCommand("task_comments", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #8
0
            public async Task <SubTask> UpdateAsync(int id, int revision, string name, bool?completed, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "title", name }, { "completed", completed }
                };

                return(await client.PatchAsync <SubTask>(ServiceClient.BuildCommand("subtasks", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #9
0
            public async Task <Positions> UpdatePositionAsync(int id, int revision, IEnumerable <int> positions, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "values", positions }
                };

                return(await client.PatchAsync <Positions>(ServiceClient.BuildCommand("subtask_positions", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #10
0
            public Task <List> UpdateAsync(uint id, int revision, string name, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "title", name }
                };

                return(client.PatchAsync <List>(ServiceClient.BuildCommand("lists", id), null, requestContent, cancellationToken));
            }
Exemple #11
0
            public async Task <bool> ChangeStateAsync(int id, int revision, bool makePublic, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "public", makePublic }
                };
                var response = await client.PatchAsync(ServiceClient.BuildCommand("lists", id), null, requestContent, cancellationToken).ConfigureAwait(false);

                return((await DeserializeDynamic(response)).Value <bool>("public"));
            }
Exemple #12
0
            public Task <bool> ChangeStateAsync(uint id, int revision, bool makePublic, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "public", makePublic }
                };

                return(client.PatchDynamicAsync(ServiceClient.BuildCommand("lists", id), null, requestContent, cancellationToken)
                       .ContinueWith(t => (bool)t.Result.Value <bool>("public"), TaskContinuationOptions.OnlyOnRanToCompletion));
            }
Exemple #13
0
            private async Task <JObject> UploadFinishedAsync(int uploadId, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "state", "finished" }
                };
                var response = await client.PatchAsync(ServiceClient.BuildCommand("uploads", uploadId), null, requestContent, cancellationToken).ConfigureAwait(false);

                return(await DeserializeDynamic(response));
            }
Exemple #14
0
 public Task <IEnumerable <List> > GetAsync(uint?id, CancellationToken cancellationToken)
 {
     if (id.HasValue)
     {
         return(client.GetAsync <List>(ServiceClient.BuildCommand("lists", id), null, cancellationToken)
                .ContinueWith <IEnumerable <List> >(t => new List <List> {
             t.Result
         }, TaskContinuationOptions.OnlyOnRanToCompletion));
     }
     return(client.GetAsync <IEnumerable <List> >("lists", null, cancellationToken));
 }
Exemple #15
0
            public Task <MainTask> UpdateAsync(uint id, int revision, uint?listId, string name, uint?assigneeId, bool?completed, RecurrenceType?recurrenceType, int?recurrenceCount, DateTime?dueDate, bool?starred, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "list_id", listId }, { "title", name }, { "assignee_id", assigneeId }, { "recurrence_type", recurrenceType }, { "recurrence_count", recurrenceCount }, { "due_date", dueDate }, { "starred", starred }
                };

                requestContent.Add("remove", requestContent.Where(s => s.Value == null).Select(s => s.Key).ToArray());
                requestContent.Add("completed", completed);                 // completed attribute cannot be removed

                if (recurrenceType.HasValue && !recurrenceCount.HasValue)
                {
                    throw new ArgumentNullException("recurrenceCount");
                }

                return(client.PatchAsync <MainTask>(ServiceClient.BuildCommand("tasks", id), null, requestContent, cancellationToken));
            }
Exemple #16
0
            public async Task <MainTask> UpdateAsync(int id, int revision, string name, int?assigneeId, bool?completed, RecurrenceType?recurrenceType, int?recurrenceCount, DateTime?dueDate, bool?starred, CancellationToken cancellationToken)
            {
                var requestContent = new Dictionary <string, object> {
                    { "revision", revision }, { "title", name }, { "assignee_id", assigneeId }, { "completed", completed }, { "recurrence_type", recurrenceType }, { "due_date", dueDate }, { "starred", starred }
                };

                requestContent.Add("remove", requestContent.Where(s => s.Value == null).ToArray());

                if (recurrenceType.HasValue)
                {
                    if (!recurrenceCount.HasValue)
                    {
                        throw new ArgumentNullException("recurrenceCount");
                    }
                    requestContent.Add("recurrence_count", recurrenceCount);
                }
                return(await client.PatchAsync <MainTask>(ServiceClient.BuildCommand("tasks", id), null, requestContent, cancellationToken).ConfigureAwait(false));
            }
Exemple #17
0
 public Task <Positions> GetPositionAsync(uint id, CancellationToken cancellationToken)
 {
     return(client.GetAsync <Positions>(ServiceClient.BuildCommand("subtask_positions", id), null, cancellationToken));
 }
Exemple #18
0
 public Task <IEnumerable <Membership> > GetByListAsync(uint?listId, CancellationToken cancellationToken)
 {
     return(client.GetAsync <IEnumerable <Membership> >(ServiceClient.BuildCommand("memberships", listId), null, cancellationToken));
 }
Exemple #19
0
 public Task <Note> GetAsync(uint id, CancellationToken cancellationToken)
 {
     return(client.GetAsync <Note>(ServiceClient.BuildCommand("notes", id), null, cancellationToken));
 }
Exemple #20
0
 public async Task <Positions> GetPositionAsync(int id, CancellationToken cancellationToken)
 {
     return(await client.GetAsync <Positions>(ServiceClient.BuildCommand("subtask_positions", id), null, cancellationToken).ConfigureAwait(false));
 }
Exemple #21
0
 public async Task <MainTask> GetAsync(int id, CancellationToken cancellationToken)
 {
     return(await client.GetAsync <MainTask>(ServiceClient.BuildCommand("tasks", id), null, cancellationToken).ConfigureAwait(false));
 }
Exemple #22
0
 public Task <Reminder> GetAsync(uint id, CancellationToken cancellationToken)
 {
     return(client.GetAsync <Reminder>(ServiceClient.BuildCommand("reminders", id), null, cancellationToken));
 }
Exemple #23
0
 public Task <Comment> GetAsync(uint id, CancellationToken cancellationToken)
 {
     return(client.GetAsync <Comment>(ServiceClient.BuildCommand("task_comments", id), null, cancellationToken));
 }
Exemple #24
0
 public async Task <IEnumerable <Membership> > GetAsync(int?listId, CancellationToken cancellationToken)
 {
     return(await client.GetAsync <IEnumerable <Membership> >(ServiceClient.BuildCommand("memberships", listId), null, cancellationToken).ConfigureAwait(false));
 }
Exemple #25
0
 public Task <SubTask> GetAsync(uint id, CancellationToken cancellationToken)
 {
     return(client.GetAsync <SubTask>(ServiceClient.BuildCommand("subtasks", id), null, cancellationToken));
 }
 public async Task <Reminder> GetAsync(uint id, CancellationToken cancellationToken)
 {
     return(await client.GetAsync <Reminder>(ServiceClient.BuildCommand("reminders", id), null, cancellationToken).ConfigureAwait(false));
 }