Ejemplo n.º 1
0
        /// <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));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new organization.
        /// <para>Podio API Reference: https://developers.podio.com/doc/organizations/add-new-organization-22385 </para>
        /// </summary>
        /// <param name="name">The name of the new organization</param>
        /// <param name="logo">The file id of the logo of the organization</param>
        /// <returns>Task&lt;Organization&gt;.</returns>
        public async Task <Organization> AddNewOrganization(string name, int logo)
        {
            string  url         = "/org/";
            dynamic requestData = new
            {
                name = name,
                logo = logo
            };

            return(await _podio.PostAsync <Organization>(url, requestData));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Installs the share with the given id on the space.
        /// </summary>
        /// <para>Podio API Reference: https://developers.podio.com/doc/app-market/install-share-22499 </para>
        /// <param name="shareId"></param>
        /// <param name="spaceId">The id of the space the shared app should be installed to</param>
        /// <param name="dependentShareIds">The list of ids of the dependent shares that should also be installed. If not specified, all dependencies will be installed</param>
        /// <returns></returns>
        public Task <AppMarketShareInstall> InstallShare(int shareId, int spaceId, List <int> dependentShareIds)
        {
            string  url         = string.Format("/app_store/{0}/install", shareId);
            dynamic requestData = new
            {
                space_id     = spaceId,
                dependencies = dependentShareIds
            };

            return(_podio.PostAsync <AppMarketShareInstall>(url, requestData));
        }
Ejemplo n.º 4
0
        /// <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));
        }
Ejemplo n.º 5
0
        /// <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&lt;System.Int32&gt;.</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"]);
        }
Ejemplo n.º 6
0
        /// <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"]);
        }
Ejemplo n.º 7
0
        /// <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&lt;System.Int32&gt;.</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"]);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Create a new widget on the given reference.
        /// <para>Podio API Reference: https://developers.podio.com/doc/widgets/create-widget-22491 </para>
        /// </summary>
        /// <param name="refType">Type of the reference.</param>
        /// <param name="refId">The reference identifier.</param>
        /// <param name="type">The type of widget, see the area for possible values</param>
        /// <param name="title">The title of the widget</param>
        /// <param name="config">The configuration, depends on the types. See the area for details</param>
        /// <returns>Task&lt;System.Int32&gt;.</returns>
        public async Task <int> CreateWidget(string refType, int refId, string type, string title, dynamic config)
        {
            string  url         = string.Format("/widget/{0}/{1}/", refType, refId);
            dynamic requestData = new
            {
                type   = type,
                title  = title,
                config = config
            };

            dynamic respone = await _podio.PostAsync <dynamic>(url, requestData);

            return((int)respone["widget_id"]);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Imports the file into the given app. The mapping value for a field depends on the type of field. See the area for datails.
        /// <para>Podio API Reference: https://developers.podio.com/doc/importer/import-app-items-212899 </para>
        /// </summary>
        /// <param name="fileId">The file identifier.</param>
        /// <param name="appId">The id of the app the values should be imported into</param>
        /// <param name="mappings">The mappings between fields and columns</param>
        /// <param name="tagsColumnId">The id of the column to read tags from, if any</param>
        /// <param name="appItemIdColumnId">The id of the column to read the app item id from, if any</param>
        /// <returns>Task&lt;System.Int32&gt;.</returns>
        public async Task <int> ImportAppItems(int fileId, int appId, List <ImportMappingField> mappings, string tagsColumnId = null, string appItemIdColumnId = null)
        {
            string  url         = string.Format("/importer/{0}/item/app/{1}", fileId, appId);
            dynamic requestData = new
            {
                app_id                = appId,
                mappings              = mappings,
                tags_column_id        = tagsColumnId,
                app_item_id_column_id = appItemIdColumnId
            };
            dynamic response = await _podio.PostAsync <dynamic>(url, requestData);

            return((int)response["batch_id"]);
        }
Ejemplo n.º 10
0
        /// <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&lt;FileAttachment&gt;.</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));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Subscribes the user to the given object. Based on the object type, the user will receive notifications when actions are performed on the object. See the area for more details.
        /// <para>Podio API Reference: https://developers.podio.com/doc/subscriptions/subscribe-22409 </para>
        /// </summary>
        /// <param name="refType">Type of the reference.</param>
        /// <param name="refId">The reference identifier.</param>
        /// <returns>Task&lt;System.Int32&gt;.</returns>
        public async Task <int> Subscribe(string refType, int refId)
        {
            string  url      = string.Format("/subscription/{0}/{1}", refType, refId);
            dynamic response = await _podio.PostAsync <dynamic>(url);

            return((int)response["subscription_id"]);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new space contact for use by everyone on the space.
        /// <para>Podio API Reference: https://developers.podio.com/doc/contacts/create-space-contact-65590 </para>
        /// </summary>
        /// <param name="spaceId"></param>
        /// <param name="contact"></param>
        /// <returns>profile_id of the created contact</returns>
        public async Task <int> CreateContact(int spaceId, Contact contact)
        {
            string  url      = string.Format("/contact/space/{0}/", spaceId);
            dynamic response = await _podio.PostAsync <dynamic>(url, contact);

            return((int)response["profile_id"]);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates a new view on the given app.
        /// <para>Podio API Reference: https://developers.podio.com/doc/views/create-view-27453 </para>
        /// </summary>
        /// <param name="appId">The application identifier.</param>
        /// <param name="request">The request.</param>
        /// <returns>System.Int32.</returns>
        public async Task <int> CreateView(int appId, ViewCreateUpdateRequest request)
        {
            string  url      = string.Format("/view/app/{0}/", appId);
            dynamic response = await _podio.PostAsync <dynamic>(url, request);

            return((int)response["view_id"]);
        }
Ejemplo n.º 14
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));
        }
Ejemplo n.º 15
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.º 16
0
        /// <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));
        }
Ejemplo n.º 17
0
        /// <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"]);
        }
Ejemplo n.º 18
0
        /// <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&lt;CreatedGrant&gt;.</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));
        }
Ejemplo n.º 19
0
        /// <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));
        }
Ejemplo n.º 20
0
        /// <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&lt;System.Int32&gt;.</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"]);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Creates a new status message for a user on a specific space.
        /// <para>Podio API Reference: https://developers.podio.com/doc/status/add-new-status-message-22336 </para>
        /// </summary>
        /// <param name="spaceId">The space 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>
        /// <param name="questionText">The text of the question if any</param>
        /// <param name="questionOptions">The list of answer options as strings</param>
        /// <returns>Task&lt;Status&gt;.</returns>
        public Task <Status> AddNewStatusMessage(int spaceId, string text, List <int> fileIds = null, int?embedId = null, string embedUrl = null, string questionText = null, List <string> questionOptions = null)
        {
            string url = string.Format("/status/space/{0}/", spaceId);

            dynamic requestData = new ExpandoObject();

            requestData.value    = text;
            requestData.file_ids = fileIds;
            requestData.embed_id = embedId;
            requestData.embedUrl = embedUrl;
            if (!string.IsNullOrEmpty(questionText) && questionOptions != null)
            {
                requestData.question = new
                {
                    text    = questionText,
                    options = questionOptions
                };
            }

            return(_podio.PostAsync <Status>(url, requestData));
        }
Ejemplo n.º 22
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.º 23
0
        /// <summary>
        /// Enables the form with the given id. Only disabled forms can be enabled, which makes it once again possible to create items in the app using the form.
        /// <para>Podio API Reference: https://developers.podio.com/doc/forms/activate-form-1107439 </para>
        /// </summary>
        /// <param name="formId">The form identifier.</param>
        /// <returns>Task.</returns>
        public Task ActivateForm(int formId)
        {
            string url = string.Format("/form/{0}/activate", formId);

            return(_podio.PostAsync <dynamic>(url));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Star the given notification to move it to the star list.
        /// <para>Podio API Reference: https://developers.podio.com/doc/notifications/star-notification-295910 </para>
        /// </summary>
        /// <param name="notificationId"></param>
        public Task StarNotification(int notificationId)
        {
            string url = string.Format("/notification/{0}/star", notificationId);

            return(_podio.PostAsync <dynamic>(url));
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Adds additional tags to the object. If a tag with the same text is already present, the tag will be ignored. Existing tags on the object are preserved.
 /// <para>Podio API Reference: https://developers.podio.com/doc/tags/create-tags-22464 </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 CreateTags(string refType, int refId, List <string> tags)
 {
     string url = string.Format("/tag/{0}/{1}/", refType, refId);
     await _podio.PostAsync <dynamic>(url, tags);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Joins the open space with the given id.
        /// <para>Podio API Reference: https://developers.podio.com/doc/space-members/join-space-1927286 </para>
        /// </summary>
        /// <param name="spaceId"></param>
        public Task JoinSpace(int spaceId)
        {
            string url = string.Format("/space/{0}/join", spaceId);

            return(_podio.PostAsync <dynamic>(url));
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Activates a deactivated app. This puts the app back in the app navigator and allows insertion of new items.
 /// <para>Podio API Reference: https://developers.podio.com/doc/applications/activate-app-43822 </para>
 /// </summary>
 /// <param name="appId">The application identifier.</param>
 /// <returns>Task.</returns>
 public async Task ActivateApp(int appId)
 {
     string url = string.Format("/app/{0}/activate", appId);
     await _podio.PostAsync <dynamic>(url);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Snoozes the reminder for 10 minutes.
        /// <para>Podio API Reference: https://developers.podio.com/doc/reminders/snooze-reminder-3321049 </para>
        /// </summary>
        /// <param name="refType">Type of the reference.</param>
        /// <param name="refId">The reference identifier.</param>
        /// <param name="reminderId">The reminder identifier.</param>
        /// <returns>Task.</returns>
        public Task SnoozeReminder(string refType, int refId, int reminderId)
        {
            string url = string.Format("/reminder/{0}/{1}/snooze?reminder_id={2}", refType, refId, reminderId);

            return(_podio.PostAsync <dynamic>(url));
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Search for references for use in various contexts.
        /// <para>Podio API Reference: https://developers.podio.com/doc/reference/search-references-13312595 </para>
        /// </summary>
        /// <param name="searchReferenceRequest">The search reference request.</param>
        /// <returns>Task&lt;List&lt;ReferenceGroup&gt;&gt;.</returns>
        public Task <List <ReferenceGroup> > SearchReferences(SearchReferencesRequest searchReferenceRequest)
        {
            string url = "/reference/search";

            return(_podio.PostAsync <List <ReferenceGroup> >(url, searchReferenceRequest));
        }