Ejemplo n.º 1
0
        /// <summary>
        /// Update an already existing item.
        /// <para>Podio API Reference: https://developers.podio.com/doc/items/update-item-22363 </para>
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="revision">The revision of the item that is being updated. This is optional</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>The id of the new revision / null if no change</returns>
        public async Task <int?> UpdateItem(Item item, int?revision = null, 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,
                Revision        = revision,
                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/{0}", item.ItemId);

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

            if (response != null)
            {
                return((int)response["revision"]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the configuration of the integration. The configuration depends on the type of integration.
        /// <para>Podio API Reference: https://developers.podio.com/doc/integrations/update-integration-86843 </para>
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="silent"></param>
        /// <param name="config"></param>
        public Task UpdateIntegration(int appId, bool?silent, dynamic config)
        {
            string  url         = string.Format("/integration/{0}", appId);
            dynamic requestData = new
            {
                silent = silent,
                config = config
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates a widget with a new title and configuration.
        /// <para>Podio API Reference: https://developers.podio.com/doc/widgets/update-widget-22490 </para>
        /// </summary>
        /// <param name="widgetId">The widget identifier.</param>
        /// <param name="title">The title.</param>
        /// <param name="config">The configuration.</param>
        /// <returns>Task.</returns>
        public async Task UpdateWidget(int widgetId, string title, dynamic config)
        {
            string  url         = string.Format("/widget/{0}", widgetId);
            dynamic requestData = new
            {
                title  = title,
                config = config
            };

            await _podio.PutAsync <dynamic>(url, requestData);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Updates an organization with new name and logo. Note that the URL of the organization will not change even though the name changes.
 /// </summary>
 /// <param name="organizationId">The organization identifier.</param>
 /// <param name="name">The name of the new organization</param>
 /// <param name="urlLabel">The new subdomain of the URL of the organization, defaults to the existing URL</param>
 /// <param name="logo">The file id of the logo of the organization</param>
 /// <returns>Task.</returns>
 public async Task UpdateOrganization(int organizationId, string name = null, string urlLabel = null, int?logo = null)
 {
     string  url         = string.Format("/org/{0}", organizationId);
     dynamic requestData = new
     {
         name      = name,
         url_label = urlLabel,
         logo      = logo
     };
     await _podio.PutAsync <dynamic>(url, requestData);
 }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Used to update the description of the file.
        /// <para>Podio API Reference: https://developers.podio.com/doc/files/update-file-22454 </para>
        /// </summary>
        /// <param name="fileId">The file identifier.</param>
        /// <param name="description">The new description of the file</param>
        /// <returns>Task.</returns>
        public Task UpdateFile(int fileId, string description)
        {
            string  url         = string.Format("/file/{0}", fileId);
            dynamic requestData = new
            {
                description = description
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates or updates the reminder on a object. Possible ref_types are: task.
        /// <para>Podio API Reference: https://developers.podio.com/doc/reminders/create-or-update-reminder-3315055 </para>
        /// </summary>
        /// <param name="refType">Type of the reference.</param>
        /// <param name="refId">The reference identifier.</param>
        /// <param name="remindDelta">minutes to remind before the due date of the object</param>
        /// <returns>Task.</returns>
        public Task Update(string refType, int refId, int remindDelta)
        {
            string  url         = string.Format("/reminder/{0}/{1}", refType, refId);
            dynamic requestData = new
            {
                remind_delta = remindDelta
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Updates the space memberships with another role.
        /// <para>Podio API Reference: https://developers.podio.com/doc/space-members/update-space-memberships-22398 </para>
        /// </summary>
        /// <param name="spaceId">The space identifier.</param>
        /// <param name="userIds">The user ids.</param>
        /// <param name="role">The role.</param>
        /// <returns>Task.</returns>
        public Task UpdateSpaceMemberships(int spaceId, int[] userIds, string role)
        {
            string  userIdsCSV  = Utilities.ArrayToCSV(userIds);
            string  url         = string.Format("/space/{0}/member/{1}", spaceId, userIdsCSV);
            dynamic requestData = new
            {
                role = role
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Updates the flow. The type cannot be changed.
        /// <para>Podio API Reference: https://developers.podio.com/doc/flows/update-flow-26310901 </para>
        /// </summary>
        /// <param name="flowId">The flow identifier.</param>
        /// <param name="name">The new name of the flow</param>
        /// <param name="effects">The list of effects to add</param>
        /// <param name="config">The configuration for the cause of the flow</param>
        /// <returns>Task.</returns>
        public Task UpdateFlow(int flowId, string name, List <Models.Effect> effects = null, dynamic config = null)
        {
            string  url         = string.Format("/flow/{0}", flowId);
            dynamic requestData = new
            {
                name    = name,
                config  = config,
                effects = effects
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Updates the form with new settings, domains, fields, etc.
        /// <para>Podio API Reference: https://developers.podio.com/doc/forms/update-form-53808 </para>
        /// </summary>
        /// <param name="formId">The form identifier.</param>
        /// <param name="fromSettings">The settings of the form.</param>
        /// <param name="domains">The list of domains where the form can be used.</param>
        /// <param name="fields">The id and settings for each field.</param>
        /// <param name="attachments">True if attachments are allowed, false otherwise.</param>
        /// <returns>Task.</returns>
        public Task UpdateForm(int formId, FormSettings fromSettings, string[] domains, List <FormField> fields, bool attachments)
        {
            string url         = string.Format("/form/{0}", formId);
            var    requestData = new
            {
                settings    = fromSettings,
                domains     = domains,
                fields      = fields,
                attachments = attachments
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Updates the calendar event.
        /// </summary>
        /// <param name="uid">The uid.</param>
        /// <param name="startDateTime">The start date time.</param>
        /// <param name="endDateTime">The end date time.</param>
        /// <returns>Task.</returns>
        public Task UpdateCalendarEvent(int uid, DateTime startDateTime, DateTime endDateTime)
        {
            string  url         = string.Format("/calendar/event/{0}", uid);
            dynamic requestData = new
            {
                start_date = startDateTime.Date,
                start_time = startDateTime.TimeOfDay,
                end_date   = endDateTime.Date,
                end_time   = endDateTime.TimeOfDay
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// This will update an existing status message.
        /// <para>Podio API Reference: https://developers.podio.com/doc/status/update-a-status-message-22338 </para>
        /// </summary>
        /// <param name="statusId">The status identifier.</param>
        /// <param name="text">The actual status message</param>
        /// <param name="fileIds">Temporary files that have been uploaded and should be attached to this item</param>
        /// <param name="embedId">The id of an embedded link that has been created with the Add an mebed operation in the Embed area</param>
        /// <param name="embedUrl">The url to be attached</param>
        /// <returns>Task.</returns>
        public Task UpdateStatusMessage(int statusId, string text, List <int> fileIds = null, int?embedId = null, string embedUrl = null)
        {
            string  url         = string.Format("/status/{0}", statusId);
            dynamic requestData = new
            {
                value     = text,
                file_ids  = fileIds,
                embed_id  = embedId,
                embed_url = embedUrl
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Updates the space with the given id.
 /// <para>Podio API Reference: https://developers.podio.com/doc/spaces/update-space-22391 </para>
 /// </summary>
 /// <param name="spaceId">The space identifier.</param>
 /// <param name="name">The name of the space</param>
 /// <param name="urlLabel">The new URL label, if any changes</param>
 /// <param name="privacy">The privacy level of the space, either "open" or "closed", defaults to "closed"</param>
 /// <param name="autoJoin">True if new employees should be joined automatically, false otherwise, defaults to false</param>
 /// <param name="postOnNewApp">True if new apps should be announced with a status update, false otherwise</param>
 /// <param name="postOnNewMember">True if new members should be announced with a status update, false otherwise</param>
 /// <returns>Task.</returns>
 public async Task UpdateSpace(int spaceId, string name = null, string urlLabel = null, Space.PrivacyTypes privacy = Space.PrivacyTypes.Closed, bool?autoJoin = null, bool?postOnNewApp = null, bool?postOnNewMember = null)
 {
     string  url         = string.Format("/space/{0}", spaceId);
     dynamic requestData = new
     {
         name               = name,
         url_label          = urlLabel,
         privacy            = privacy,
         auto_join          = autoJoin,
         post_on_new_app    = postOnNewApp,
         post_on_new_member = postOnNewMember
     };
     await _podio.PutAsync <dynamic>(url, requestData);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Updates the setting for the given client type and notification type.
 /// <para>Podio API Reference: https://developers.podio.com/doc/users/update-notification-setting-3649918 </para>
 /// </summary>
 /// <param name="clientType">Client type: "email" and "mobile".</param>
 /// <param name="notificationType">Notification type: "digest", "bulletin", "reference", "message", "space", "subscription", "user", "reminder", "push_notification", "push_notification_sound" or "push_notification_browser".</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 /// <returns>Task.</returns>
 public async Task UpdateNotificationSetting(string clientType, string notificationType, bool value)
 {
     string  url         = string.Format("/user/setting/{0}/{1}", clientType, notificationType);
     dynamic requestData = new
     {
         value = value
     };
     await _podio.PutAsync <dynamic>(url, requestData);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Updates the share with changes to abstract, description, etc.
        /// </summary>
        /// <param name="shareId">The share identifier.</param>
        /// <param name="name">The name of the share, only valid if the share is a space</param>
        /// <param name="abstracts">The abstract of the share</param>
        /// <param name="description">The description of the share</param>
        /// <param name="language">The language the share is written in</param>
        /// <param name="categoryId">The ids of the categories the share should be placed in</param>
        /// <param name="fileId">The file ids to use as screenshots for the share</param>
        /// <param name="videoId">The youtube id of a introduction video, if any</param>
        /// <returns>Task.</returns>
        /// <para>Podio API Reference: https://developers.podio.com/doc/app-market/update-share-38639 </para>
        public Task UpdateShare(int shareId, string name, string abstracts, string description, string language, int[] categoryId, int[] fileId, int?videoId = null)
        {
            string  url         = string.Format("/app_store/{0}", shareId);
            dynamic requestData = new
            {
                name         = name,
                abstracts    = abstracts,
                description  = description,
                language     = language,
                category_ids = categoryId,
                file_ids     = fileId,
                video        = videoId
            };

            return(_podio.PutAsync <dynamic>(url, requestData));
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Updates the contact with the given profile id.
 /// <para>Podio API Reference: https://developers.podio.com/doc/contacts/update-contact-60556 </para>
 /// </summary>
 /// <param name="profileId">The profile identifier.</param>
 /// <param name="contact">The contact.</param>
 /// <returns>Task.</returns>
 public async Task UpdateContact(int profileId, Contact contact)
 {
     string url = string.Format("/contact/{0}", profileId);
     await _podio.PutAsync <dynamic>(url, contact);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Updates an already created comment. This should only be used to correct spelling and grammatical mistakes in the comment.
        /// </summary>
        /// <param name="commentId">The comment identifier.</param>
        /// <param name="comment">The comment.</param>
        /// <returns>Task.</returns>
        public Task UpdateComment(int commentId, CommentCreateUpdateRequest comment)
        {
            string url = string.Format("/comment/{0}", commentId);

            return(_podio.PutAsync <dynamic>(url, comment));
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Updates the order of the apps on the space. It should post all the apps from the space in the order required.
 /// <para>Podio API Reference: https://developers.podio.com/doc/applications/update-app-order-22463  </para>
 /// </summary>
 /// <param name="spaceId">The space identifier.</param>
 /// <param name="appIds">The application ids.</param>
 /// <returns>Task.</returns>
 public async Task UpdateAppOrder(int spaceId, List <int> appIds)
 {
     appIds = new List <int>();
     string url = string.Format("/app/space/{0}/order", spaceId);
     await _podio.PutAsync <dynamic>(url, appIds);
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Creates or updates recurrence on the object.
        /// <para>Podio API Reference: https://developers.podio.com/doc/recurrence/create-or-update-recurrence-3349957 </para>
        /// </summary>
        /// <param name="refType">Type of the reference.</param>
        /// <param name="refId">The reference identifier.</param>
        /// <param name="recurrence">The recurrence.</param>
        /// <returns>Task.</returns>
        public Task UpdateRecurrence(string refType, int refId, Recurrence recurrence)
        {
            string url = string.Format("/recurrence/{0}/{1}", refType, refId);

            return(_podio.PutAsync <dynamic>(url, recurrence));
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Updates the tags on the given object. Existing tags on the object will be overwritten. Use Create Tags operation to preserve existing tags.
 /// <para>Podio API Reference: https://developers.podio.com/doc/tags/update-tags-39859 </para>
 /// </summary>
 /// <param name="refType">Type of the reference.</param>
 /// <param name="refId">The reference identifier.</param>
 /// <param name="tags">The tags.</param>
 /// <returns>Task.</returns>
 public async Task UpdateTags(string refType, int refId, List <string> tags)
 {
     string url = string.Format("/tag/{0}/{1}/", refType, refId);
     await _podio.PutAsync <dynamic>(url, tags);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Updates the last view for the active user.
 /// <para>Podio API Reference: https://developers.podio.com/doc/views/update-last-view-5988251 </para>
 /// </summary>
 /// <param name="appId">The application identifier.</param>
 /// <param name="request">The request.</param>
 /// <returns>Task.</returns>
 public async Task UpdateLastView(int appId, ViewCreateUpdateRequest request)
 {
     string url = string.Format("/view/app/{0}/last", appId);
     await _podio.PutAsync <dynamic>(url, request);
 }