Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new comment to the object of the given type and id, f.ex. item 1.
        /// <para>Podio API Reference: https://developers.podio.com/doc/comments/add-comment-to-object-22340 </para>
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="comment">The comment.</param>
        /// <param name="alertInvite">True if any mentioned user should be automatically invited to the workspace if the user does not have access to the object and access cannot be granted to the object. Default value: false</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>Task&lt;System.Int32&gt;.</returns>
        public async Task <int> AddCommentToObject(string type, int id, CommentCreateUpdateRequest comment, bool alertInvite = false, bool silent = false)
        {
            string url = string.Format("/comment/{0}/{1}/", type, id);

            url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(alertInvite, silent));
            dynamic response = await _podio.PostAsync <dynamic>(url, comment);

            return((int)response["comment_id"]);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a new item to the given app.
        /// <para>Podio API Reference: https://developers.podio.com/doc/items/add-new-item-22362 </para>
        /// </summary>
        /// <param name="appId">The application identifier.</param>
        /// <param name="item">The item.</param>
        /// <param name="silent">If set to true, the object will not be bumped up in the stream and notifications will not be generated</param>
        /// <param name="hook">If set to false, hooks will not be executed for the change</param>
        /// <returns>Id of the created item</returns>
        public async Task <int> AddNewItem(int appId, Item item, bool silent = false, bool hook = true)
        {
            JArray fieldValues = JArray.FromObject(item.Fields.Select(f => new { external_id = f.ExternalId, field_id = f.FieldId, values = f.Values }));
            var    requestData = new ItemCreateUpdateRequest()
            {
                ExternalId      = item.ExternalId,
                Fields          = fieldValues,
                FileIds         = item.FileIds,
                Tags            = item.Tags,
                Recurrence      = item.Recurrence,
                LinkedAccountId = item.LinkedAccountId,
                Reminder        = item.Reminder,
                Ref             = item.Ref
            };

            string url = string.Format("/item/app/{0}/", appId);

            url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            dynamic response = await _podio.PostAsync <Item>(url, requestData);

            return(response.ItemId);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Mark the completed task as no longer being completed.
        /// <para>API Reference: https://developers.podio.com/doc/tasks/incomplete-task-22433 </para>
        /// </summary>
        /// <param name="taskId"></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>
        public Task IncompletePodioTask(int taskId, bool hook = true, bool silent = false)
        {
            string url = string.Format("/task/{0}/incomplete", taskId);

            url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            return(_podio.PostAsync <dynamic>(url));
        }