/// <summary> /// Updates the task with the given requestData. Any requestData not specified will remain unchanged. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-10583674 </para> /// </summary> /// <param name="taskId"></param> /// <param name="task"></param> /// <param name="hook">True if hooks should be executed for the change, false otherwise. Default value: true</param> /// <param name="silent"> /// If set to true, the object will not be bumped up in the stream and notifications will not be /// generated. Default value: false /// </param> /// <returns></returns> public async Task<Models.Task> UpdateTask(int taskId, TaskCreateUpdateRequest task, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}", taskId); url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); return await _podio.Put<Models.Task>(url, task); }
/// <summary> /// Creates a new task /// <para>API Reference: https://developers.podio.com/doc/tasks/create-task-22419 </para> /// </summary> /// <param name="task"></param> /// <param name="refType">The valid types of objects are "item", "status", "app", "space" and "conversation".</param> /// <param name="refId">Id of the reference</param> /// <param name="hook">True if hooks should be executed for the change, false otherwise. Default value: true</param> /// <param name="silent"> /// If set to true, the object will not be bumped up in the stream and notifications will not be /// generated. Default value: false /// </param> /// <returns></returns> public async Task<List<Models.Task>> CreateTask(TaskCreateUpdateRequest task, string refType = null, int? refId = null, bool hook = true, bool silent = false) { string url = "/task/"; if (!string.IsNullOrEmpty(refType) && refId != null) { url = string.Format("/task/{0}/{1}/", refType, refId); } url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); var createdTasks = new List<Models.Task>(); if ((task.Responsible is IEnumerable<int> || task.Responsible is IEnumerable<Ref>) && task.Responsible.Count > 1) { List<Models.Task> response = await _podio.Post<List<Models.Task>>(url, task); createdTasks = response; } else { Models.Task response = await _podio.Post<Models.Task>(url, task); createdTasks.Add(response); } return createdTasks; }
/// <summary> /// Creates a new task with no reference to other objects. /// <para>API Reference: https://developers.podio.com/doc/tasks/create-task-22419 </para> /// </summary> /// <param name="text">The text of the task</param> /// <param name="dueDate">The due date and time of the task, if any (in local time)</param> /// <param name="description">The description of the task</param> /// <param name="responsible">user_id of the re</param> /// <param name="isPrivate">True if the task should be private, default true</param> /// <param name="refType">The valid types of objects are "item", "status", "app", "space" and "conversation".</param> /// <param name="refId">Id of the reference</param> /// <param name="hook">True if hooks should be executed for the change, false otherwise. Default value: true</param> /// <param name="silent"> /// If set to true, the object will not be bumped up in the stream and notifications will not be /// generated. Default value: false /// </param> /// <returns></returns> public async Task<List<Models.Task>> CreateTask(string text, DateTime? dueDate = null, string description = null, int? responsible = null, bool isPrivate = true, string refType = null, int? refId = null, bool hook = true, bool silent = false) { var task = new TaskCreateUpdateRequest { Text = text, Description = description, DueDate = dueDate, Responsible = responsible, Private = isPrivate }; return await CreateTask(task, refType, refId, hook, silent); }
/// <summary> /// Updates the task with the given requestData. Any requestData not specified will remain unchanged. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-10583674 </para> /// </summary> /// <param name="taskId"></param> /// <param name="task"></param> /// <param name="hook">True if hooks should be executed for the change, false otherwise. Default value: true</param> /// <param name="silent">If set to true, the object will not be bumped up in the stream and notifications will not be generated. Default value: false</param> /// <returns></returns> public Task UpdateTask(int taskId, TaskCreateUpdateRequest task, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); return _podio.Put<Task>(url, task); }