Exemplo n.º 1
0
        /// <summary>
        /// Deletes the specified task from the task list.
        /// Documentation https://developers.google.com/tasks/v1/reference/tasks/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated tasks service.</param>
        /// <param name="tasklist">Task list identifier.</param>
        /// <param name="task">Task identifier.</param>
        public static void Delete(tasksService service, string tasklist, string task)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tasklist == null)
                {
                    throw new ArgumentNullException(tasklist);
                }
                if (task == null)
                {
                    throw new ArgumentNullException(task);
                }

                // Make the request.
                return(service.Tasks.Delete(tasklist, task).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Delete failed.", ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the authenticated user's specified task list.
        /// Documentation https://developers.google.com/tasks/v1/reference/tasklists/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated tasks service.</param>
        /// <param name="tasklist">Task list identifier.</param>
        /// <param name="body">A valid tasks v1 body.</param>
        /// <returns>TaskListResponse</returns>
        public static TaskList Update(tasksService service, string tasklist, TaskList body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (tasklist == null)
                {
                    throw new ArgumentNullException(tasklist);
                }

                // Make the request.
                return(service.Tasklists.Update(body, tasklist).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasklists.Update failed.", ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.
        /// Documentation https://developers.google.com/tasks/v1/reference/tasks/move
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated tasks service.</param>
        /// <param name="tasklist">Task list identifier.</param>
        /// <param name="task">Task identifier.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>TaskResponse</returns>
        public static Task Move(tasksService service, string tasklist, string task, TasksMoveOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tasklist == null)
                {
                    throw new ArgumentNullException(tasklist);
                }
                if (task == null)
                {
                    throw new ArgumentNullException(task);
                }

                // Building the initial request.
                var request = service.Tasks.Move(tasklist, task);

                // Applying optional parameters to the request.
                request = (TasksResource.MoveRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Move failed.", ex);
            }
        }