/// <summary> /// Answers the question for the given object. The object type can be either "status" or "comment". /// <para>Podio API Reference: https://developers.podio.com/doc/questions/answer-question-887232 </para> /// </summary> /// <param name="questionId">The question identifier.</param> /// <param name="questionOptionId">The question option identifier.</param> /// <returns>Task.</returns> public Task AnswerQuestion(int questionId, int questionOptionId) { string url = string.Format("/question/{0}/", questionId); dynamic requestData = new { question_option_id = questionOptionId }; return _podio.PostAsync<dynamic>(url, requestData); }
/// <summary> /// The list of people to grant access to. This is a list of contact identifiers. /// <para>Podio API Reference: https://developers.podio.com/doc/conversations/add-participants-v2-37282400 </para> /// </summary> /// <param name="conversationId"></param> /// <param name="participants">The list of people to grant access to. This is a list of contact identifiers</param> public Task AddParticipants(int conversationId, List<Ref> participants) { string url = string.Format("/conversation/{0}/participant/v2/", conversationId); dynamic requestData = new { participants = participants }; return _podio.PostAsync<dynamic>(url, requestData); }
/// <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); }
/// <summary> /// Grabs metadata and returns metadata for the given url such as title, description and thumbnails. /// <para>Podio API Reference : https://developers.podio.com/doc/embeds/add-an-embed-726483 </para> /// </summary> /// <param name="embedUrl">The absolute url of the link to fetch metadata for including protocol</param> /// <param name="mode">"immediate" if the lookup should be performed immediately, before returning from the call, or "delayed" if the lookup can be performed delayed (optional, default is "immediate")</param> /// <returns></returns> public Embed AddAnEmbed(string embedUrl, string mode = "immediate") { string url = "/embed/"; dynamic requestData = new { url = embedUrl, mode = mode }; return _podio.PostAsync<Embed>(url, requestData); }
/// <summary> /// Add a new rating of the user to the object. The rating can be one of many different types. For more details see the area. /// <para>Podio API Reference: https://developers.podio.com/doc/ratings/add-rating-22377 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="ratingType">Type of the rating.</param> /// <param name="value">The value of the rating, see the area for information on the value to use.</param> /// <returns>The id of the rating created.</returns> public async Task<int> AddRating(string refType, int refId, string ratingType, int value) { string url = string.Format("/rating/{0}/{1}/{2}", refType, refId, ratingType); dynamic requestData = new { value = value }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["rating_id"]; }
/// <summary> /// Searches in all items, statuses and non-private tasks in the organization. /// <para>Podio API Reference: https://developers.podio.com/doc/search/search-in-organization-22487 </para> /// </summary> /// <param name="orgId"></param> /// <param name="query"></param> /// <param name="limit"></param> /// <param name="offset"></param> /// <returns></returns> public List<SearchResult> SearchInOrganization(int orgId, string query, int? limit = null, int offset = 0) { string url = string.Format("/search/org/{0}/", orgId); dynamic requestData = new { query = query, limit = limit, offset = offset }; return _podio.PostAsync<List<SearchResult>>(url, requestData); }
/// <summary> /// Searches in all items, statuses, profiles, files, meetings and non-private tasks. The objects will be returned sorted descending by the time the object was created. /// <para>Podio API Reference: https://developers.podio.com/doc/search/search-globally-22488 </para> /// </summary> /// <param name="query">The text to search for.</param> /// <param name="limit"> The number of results to return; up to 20 results are returned in one call.</param> /// <param name="offset">The rank of the first search result to return (default=0).</param> /// <returns></returns> public List<SearchResult> SearchGlobally(string query, int? limit = null, int offset = 0) { string url = "/search/"; dynamic requestData = new { query = query, limit = limit, offset = offset }; return _podio.PostAsync<List<SearchResult>>(url, requestData); }
/// <summary> /// Create a new hook on the given object. See the area for details. /// <para>Podio API Reference: https://developers.podio.com/doc/hooks/create-hook-215056 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="externalURL">The url of endpoint.</param> /// <param name="type">The type of events to listen to, see the area for options.</param> /// <returns>Task<System.Int32>.</returns> public async Task<int> CreateHook(string refType, int refId, string externalURL, string type) { string url = string.Format("/hook/{0}/{1}/", refType, refId); dynamic requestData = new { url = externalURL, type = type }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["hook_id"]; }
/// <summary> /// Creates a new question on the given object. Supported object types are "status" and "comment". /// <para>Podio API Reference: https://developers.podio.com/doc/questions/create-question-887166 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="questionText">The text of the question.</param> /// <param name="options">The list of text for the option</param> /// <returns>Task<System.Int32>.</returns> public async Task<int> CreateQuestion(string refType, int refId, string questionText, List<string> options) { string url = string.Format("/question/{0}/{1}/", refType, refId); dynamic requestData = new { text = questionText, options = options }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["question_id"]; }
/// <summary> /// Uploads a new file /// <para>Podio API Reference: https://developers.podio.com/doc/files/upload-file-1004361 </para> /// </summary> /// <param name="filePath">Full physical path to the file</param> /// <param name="fileName">File Name with extension</param> /// <returns>Task<FileAttachment>.</returns> public Task<FileAttachment> UploadFile(string filePath, string fileName) { string url = "/file/v2/"; dynamic requestData = new { filePath = filePath, fileName = fileName }; Dictionary<string, object> options = new Dictionary<string, object>() { { "upload", true } }; return _podio.PostAsync<FileAttachment>(url, requestData, options); }
/// <summary> /// Creates a new integration on the app. /// <para>Podio API Reference: https://developers.podio.com/doc/integrations/create-integration-86839 </para> /// </summary> /// <param name="appId"></param> /// <param name="type">The type of integration, see the area for available types</param> /// <param name="silent">True if updates should be silent, false otherwise</param> /// <param name="config">The configuration of the integration, which depends on the above type,</param> /// <returns></returns> public int CreateIntegration(int appId, string type, bool silent, dynamic config) { string url = string.Format("/integration/{0}", appId); dynamic requestData = new { type = type, silent = silent, config = config }; dynamic response = _podio.PostAsync<dynamic>(url, requestData); return (int)response["integration_id"]; }
/// <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); }
/// <summary> /// Add a new space to an organization. /// <para>Podio API Reference: https://developers.podio.com/doc/spaces/create-space-22390 </para> /// </summary> /// <param name="orgId">The org identifier.</param> /// <param name="name">The name of the space</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<System.Int32>.</returns> public async Task<int> CreateSpace(int orgId, string name, Space.PrivacyTypes privacy = Space.PrivacyTypes.Closed, bool? autoJoin = null, bool? postOnNewApp = null, bool? postOnNewMember = null) { string url = "/space/"; dynamic requestData = new { org_id = orgId, name = name, privacy = privacy, auto_join = autoJoin, post_on_new_app = postOnNewApp, post_on_new_member = postOnNewMember }; dynamic respone = await _podio.PostAsync<dynamic>(url, requestData); return (int)respone["space_id"]; }
/// <summary> /// Creates a new form on the app. /// <para>Podio API Reference: https://developers.podio.com/doc/forms/create-form-53803 </para> /// </summary> /// <param name="appId">The application 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<System.Int32>.</returns> public async Task<int> CreateForm(int appId, FormSettings fromSettings, string[] domains, List<FormField> fields, bool attachments) { string url = string.Format("/form/app/{0}/", appId); var requestData = new { settings = fromSettings, domains = domains, fields = fields, attachments = attachments }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["form_id"]; }
/// <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); }
/// <summary> /// Assigns the task to another user. This makes the user responsible for the task and its completion. /// <para>API Reference: https://developers.podio.com/doc/tasks/assign-task-22412 </para> /// </summary> /// <param name="taskId">The task identifier.</param> /// <param name="responsible">The contact responsible (user_id), or null if no one should be responsible.</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.</returns> public Task AssignPodioTask(int taskId, int? responsible = null, bool silent = false) { string url = string.Format("/task/{0}/assign", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent)); dynamic requestData = new { responsible = responsible }; return _podio.PostAsync<dynamic>(url, requestData); }
/// <summary> /// Update the private flag on the given task. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-private-22434 </para> /// </summary> /// <param name="taskId">The task identifier.</param> /// <param name="isPrivate">True if the task should be private, false otherwise</param> /// <param name="hook">if set to <c>true</c> [hook].</param> /// <param name="silent">if set to <c>true</c> [silent].</param> /// <returns>Task.</returns> public Task UpdatePodioTaskPrivate(int taskId, bool isPrivate, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}/private", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); dynamic requestData = new { @private = isPrivate }; return _podio.PutAsync<dynamic>(url, requestData); }
/// <summary> /// Create a grant on the given object to the given users. /// <para>Podio API Reference: https://developers.podio.com/doc/grants/create-grant-16168841 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="people">The list of people to grant access to. This is a list of contact identifiers</param> /// <param name="action">The action required of the people, either "view", "comment" or "rate", or left out</param> /// <param name="message">Any special message to the users</param> /// <returns>Task<CreatedGrant>.</returns> public Task<CreatedGrant> CreateGrant(string refType, int refId, List<Ref> people, string action, string message = null) { string url = string.Format("/grant/{0}/{1}", refType, refId); dynamic requestData = new { people = people, action = action, message = message }; return _podio.PostAsync<CreatedGrant>(url, requestData); }
/// <summary> /// Updates the text of the task. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-text-22428 </para> /// </summary> /// <param name="taskId">The task identifier.</param> /// <param name="text">The new text of the task</param> /// <param name="hook">if set to <c>true</c> [hook].</param> /// <param name="silent">if set to <c>true</c> [silent].</param> /// <returns>Task.</returns> public Task UpdatePodioTaskText(int taskId, string text, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}/text", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); dynamic requestData = new { text = text }; return _podio.PutAsync<dynamic>(url, requestData); }
/// <summary> /// Creates a new personal label for the user. /// <para>API Reference: https://developers.podio.com/doc/tasks/create-label-151265 </para> /// </summary> /// <param name="text">The name of the new label.</param> /// <param name="color">The color of the label in hex format (xxxxxx).</param> /// <returns>Task<System.Int32>.</returns> public async Task<int> CreateLabel(string text, string color) { string url = "/task/label/"; dynamic requestData = new { text = text, color = color }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["label_id"]; }
/// <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); }
/// <summary> /// Creates a reply to the conversation. Returns the conversation event this generates. /// <para>Podio API Reference: https://developers.podio.com/doc/conversations/reply-to-conversation-v2-37260916 </para> /// </summary> /// <param name="converstionId">The converstion identifier.</param> /// <param name="text">The text of the reply.</param> /// <param name="fileIds">The list of file ids to be attached to the message.</param> /// <param name="embedId">[OPTIONAL] 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<ConversationEvent>.</returns> public Task<ConversationEvent> ReplyToConversation(int converstionId, string text, List<int> fileIds = null, int? embedId = null, string embedUrl = null) { string url = string.Format("/conversation/{0}/reply/v2", converstionId); dynamic requestData = new { text = text, file_ids = fileIds, embed_id = embedId, embed_url = embedUrl }; return _podio.PostAsync<ConversationEvent>(url, requestData); }
/// <summary> /// Updates the due on property on the task. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-due-on-3442633 </para> /// </summary> /// <param name="taskId"></param> /// <param name="dueOn">The date and time the task is due (in UTC)</param> /// <param name="dueDateTime">The date and time the task is due (in local date and time)</param> /// <param name="hook"></param> /// <param name="silent"></param> public Task UpdatePodioTaskDueOn(int taskId, DateTime dueOn, DateTime dueDateTime, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}/due", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); dynamic requestData = new { due_on = dueOn, due_date = dueDateTime.Date, due_time = dueDateTime.TimeOfDay }; return _podio.PutAsync<dynamic>(url, requestData); }
/// <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); }
/// <summary> /// Updates the given field on the given contact. Updates are currently only allowed from contacts of type "space". /// <para>API Reference: https://developers.podio.com/doc/contacts/update-contact-field-60558 </para> /// </summary> /// <param name="profileId"></param> /// <param name="key"></param> /// <param name="value">The new value for the profile field.</param> public async Task UpdateContactField(int profileId, string key, string value) { string url = string.Format("/contact/{0}/{1}", profileId, key); dynamic requestData = new { value = value }; await _podio.PutAsync<dynamic>(url, requestData); }
/// <summary> /// Get's the possible attributes to use as variables for a given effect attribute. /// <para>Podio API Reference: https://developers.podio.com/doc/flows/get-possible-attributes-33060379 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="cause">Details about the cause</param> /// <param name="effect">Details about the effect</param> /// <returns>Task<List<FlowAttribute>>.</returns> public Task<List<FlowAttribute>> GetPossibleAttributes(string refType, int refId, Cause cause, dynamic effect) { string url = string.Format("/flow/{0}/{1}/attributes/", refType, refId); dynamic requestData = new { cause = cause, effect = effect }; return _podio.PostAsync<List<FlowAttribute>>(url, requestData); }
/// <summary> /// Creates a new flow on the given reference. Only valid reference is "app". /// <para>Podio API Reference: https://developers.podio.com/doc/flows/add-new-flow-26309928 </para> /// </summary> /// <param name="refType">Type of the reference.</param> /// <param name="refId">The reference identifier.</param> /// <param name="name">The name of the flow</param> /// <param name="type">The type of the flow, currently only supports "item.create" and "item.update"</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<System.Int32>.</returns> public async Task<int> AddNewFlow(string refType, int refId, string name, string type, List<Models.Effect> effects, dynamic config = null) { string url = string.Format("/flow/{0}/{1}/",refType,refId); dynamic requestData = new { name = name, type = type, config = config, effects = effects }; dynamic response = await _podio.PostAsync<dynamic>(url, requestData); return (int)response["flow_id"]; }
/// <summary> /// Attached this task to an object. If the task is already attached to an object, it will be detached from that object and reattached on the new object. /// <para>API Reference: https://developers.podio.com/doc/tasks/update-task-reference-170733 </para> /// </summary> /// <param name="taskId"></param> /// <param name="refType"></param> /// <param name="refId"></param> /// <param name="hook"></param> /// <param name="silent"></param> public Task UpdatePodioTaskReference(int taskId, string refType, int refId, bool hook = true, bool silent = false) { string url = string.Format("/task/{0}/ref", taskId); url = _podio.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); dynamic requestData = new { ref_type = refType, ref_id = refId, }; return _podio.PutAsync<dynamic>(url, requestData); }
/// <summary> /// Validates the hook using the code received from the verify call. On successful validation the hook will become active. /// <para>Podio API Reference: https://developers.podio.com/doc/hooks/validate-hook-verification-215241 </para> /// </summary> /// <param name="hookId">The hook identifier.</param> /// <param name="code">The code.</param> /// <returns>Task.</returns> public Task ValidateHookVerification(int hookId, string code) { string url = string.Format("/hook/{0}/verify/validate", hookId); dynamic requestData = new { code = code }; return _podio.PostAsync<dynamic>(url, requestData); }
/// <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); }