Example #1
0
        /// <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">The task identifier.</param>
        /// <param name="task">The 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>System.Threading.Tasks.Task&lt;Task&gt;.</returns>
        public Task <PodioTask> UpdatePodioTask(int taskId, PodioTaskCreateUpdateRequest task, bool hook = true, bool silent = false)
        {
            string url = string.Format("/task/{0}", taskId);

            url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            return(_podio.PutAsync <PodioTask>(url, task));
        }
Example #2
0
        /// <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 <PodioTask> > CreatePodioTask(PodioTaskCreateUpdateRequest 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 = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            var createdTasks = new List <PodioTask>();

            if ((task.Responsible is IEnumerable <int> || task.Responsible is IEnumerable <Ref>) && task.Responsible.Count > 1)
            {
                List <PodioTask> response = await _podio.PostAsync <List <PodioTask> >(url, task);

                createdTasks = response;
            }
            else
            {
                PodioTask response = await _podio.PostAsync <PodioTask>(url, task);

                createdTasks.Add(response);
            }
            return(createdTasks);
        }
Example #3
0
        /// <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 Task <List <PodioTask> > CreatePodioTask(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 PodioTaskCreateUpdateRequest
            {
                Text        = text,
                Description = description,
                DueDate     = dueDate,
                Responsible = responsible,
                Private     = isPrivate
            };

            return(CreatePodioTask(task, refType, refId, hook, silent));
        }
Example #4
0
		/// <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">The task identifier.</param>
		/// <param name="task">The 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>System.Threading.Tasks.Task&lt;Task&gt;.</returns>
		public Task<PodioTask> UpdatePodioTask(int taskId, PodioTaskCreateUpdateRequest task, bool hook = true, bool silent = false)
		{
			string url = string.Format("/task/{0}", taskId);
			url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
			return _podio.PutAsync<PodioTask>(url, task);
		}
Example #5
0
		/// <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 Task<List<PodioTask>> CreatePodioTask(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 PodioTaskCreateUpdateRequest
			{
				Text = text,
				Description = description,
				DueDate = dueDate,
				Responsible = responsible,
				Private = isPrivate
			};
			return CreatePodioTask(task, refType, refId, hook, silent);
		}
Example #6
0
		/// <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<PodioTask>> CreatePodioTask(PodioTaskCreateUpdateRequest 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 = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
			var createdTasks = new List<PodioTask>();
			if ((task.Responsible is IEnumerable<int> || task.Responsible is IEnumerable<Ref>) && task.Responsible.Count > 1)
			{
				List<PodioTask> response = await _podio.PostAsync<List<PodioTask>>(url, task);
				createdTasks = response;
			}
			else
			{
				PodioTask response = await _podio.PostAsync<PodioTask>(url, task);
				createdTasks.Add(response);
			}
			return createdTasks;
		}