예제 #1
0
        private async Task <GTaskList> PatchTaskListTask(GTaskList taskListToPatch)
        {
            GTaskList listToReturn = null;
            var       requestUri   = new Uri($"https://www.googleapis.com/tasks/v1/users/@me/lists/{taskListToPatch.Id}");

            AddTokenInHeader(_client);
            var request      = new HttpRequestMessage(HttpMethod.Patch, requestUri);
            var taskListJson = JsonConvert.SerializeObject(taskListToPatch);

            request.Content = new HttpStringContent(taskListJson, UnicodeEncoding.Utf8, JsonMediaType);

            var responseMessage = await _client.SendRequestAsync(request);

            if (responseMessage.IsSuccessStatusCode)
            {
            }
            return(listToReturn);
        }
예제 #2
0
        internal async Task <GTaskList> GetTaskListTask(string taskListId)
        {
            GTaskList taskList   = null;
            var       requestUri = new Uri($"https://www.googleapis.com/tasks/v1/users/@me/lists/{taskListId}");

            AddTokenInHeader(_client);

            var responseMessage = await _client.GetAsync(requestUri);

            if (responseMessage.IsSuccessStatusCode)
            {
                var responseJson = await responseMessage.Content.ReadAsStringAsync();

                taskList = JsonConvert.DeserializeObject <GTaskList>(responseJson);
            }

            return(taskList);
        }
예제 #3
0
        private async Task <GTaskList> InsertTaskListTask(GTaskList listToInsert)
        {
            GTaskList listToReturn = null;
            var       requestUri   = new Uri("https://www.googleapis.com/tasks/v1/users/@me/lists");

            AddTokenInHeader(_client);

            var taskListJson = JsonConvert.SerializeObject(listToInsert);

            var content         = new HttpStringContent(taskListJson, UnicodeEncoding.Utf8, JsonMediaType);
            var responseMessage = await _client.PostAsync(requestUri, content);

            if (responseMessage.IsSuccessStatusCode)
            {
                var responseJson = await responseMessage.Content.ReadAsStringAsync();

                listToReturn = JsonConvert.DeserializeObject <GTaskList>(responseJson);
            }

            return(listToReturn);
        }
예제 #4
0
 public IAsyncOperation <GTaskList> UpdateTaskListAsync(GTaskList listToUpdate)
 {
     return(UpdateTaskListTask(listToUpdate).AsAsyncOperation());
 }
예제 #5
0
 public IAsyncOperation <GTaskList> PatchTaskListAsync(GTaskList taskListToPatch)
 {
     return(PatchTaskListTask(taskListToPatch).AsAsyncOperation());
 }
예제 #6
0
 public IAsyncOperation <GTaskList> InsertTaskListAsync(GTaskList listToInsert)
 {
     return(InsertTaskListTask(listToInsert).AsAsyncOperation());
 }