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"></param>
        /// <param name="questionOptionId"></param>
        public async Task <dynamic> AnswerQuestion(int questionId, int questionOptionId)
        {
            string  url         = string.Format("/question/{0}/", questionId);
            dynamic requestData = new
            {
                question_option_id = questionOptionId
            };

            return(await _podio.Post <dynamic>(url, requestData));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Upload a new file from URL
        /// </summary>
        /// <param name="fileUrl"></param>
        /// <returns></returns>
        public async Task <FileAttachment> UploadFileFromUrl(string fileUrl)
        {
            string  url         = "/file/from_url/";
            dynamic requestData = new
            {
                url = fileUrl
            };

            return(await _podio.Post <FileAttachment>(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 async 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(await _podio.Post <AppMarketShareInstall>(url, requestData));
        }
Ejemplo n.º 4
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></returns>
        public async Task <Organization> AddNewOrganization(string name, int logo)
        {
            string  url         = "/org/";
            dynamic requestData = new
            {
                name = name,
                logo = logo
            };

            return(await _podio.Post <Organization>(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"></param>
        /// <param name="refId"></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></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.Post <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 async Task <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 = await _podio.Post <dynamic>(url, requestData);

            return((int)response["integration_id"]);
        }
Ejemplo n.º 7
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>
        /// <param name="refType">
        ///     The type of objects to search for. Can be one of "item", "task", "conversation", "app", "status",
        ///     "file" and  "profile"
        /// </param>
        /// <returns></returns>
        public async Task <List <SearchResult> > SearchGlobally(string query, int?limit = null, int offset = 0, string refType = null)
        {
            string  url         = "/search/";
            dynamic requestData = new
            {
                query    = query,
                limit    = limit,
                offset   = offset,
                ref_type = refType
            };

            return(await _podio.Post <List <SearchResult> >(url, requestData));
        }
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"></param>
        /// <param name="refId"></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></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.Post <dynamic>(url, requestData);

            return((int)respone["widget_id"]);
        }
Ejemplo n.º 9
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"></param>
        /// <param name="refId"></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>
        public async Task <int> AddNewFlow(string refType, int refId, string name, string type, List <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.Post <dynamic>(url, requestData);

            return((int)response["flow_id"]);
        }
Ejemplo n.º 10
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"></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></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.Post <dynamic>(url, requestData);

            return((int)response["batch_id"]);
        }
Ejemplo n.º 11
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.Post <dynamic>(url, contact);

            return((int)response["profile_id"]);
        }
Ejemplo n.º 12
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"></param>
        /// <param name="viewCreateRequest"></param>
        /// <returns></returns>
        public async Task <int> CreateView(int appId, ViewCreateUpdateRequest request)
        {
            string  url      = string.Format("/view/app/{0}/", appId);
            dynamic response = await _podio.Post <dynamic>(url, request);

            return((int)response["view_id"]);
        }
Ejemplo n.º 13
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"></param>
        /// <param name="refId"></param>
        /// <returns></returns>
        public async Task <int> Subscribe(string refType, int refId)
        {
            string  url      = string.Format("/subscription/{0}/{1}", refType, refId);
            dynamic response = await _podio.Post <dynamic>(url);

            return((int)response["subscription_id"]);
        }
Ejemplo n.º 14
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 async Task <dynamic> AddParticipants(int conversationId, List <Ref> participants)
        {
            string  url         = string.Format("/conversation/{0}/participant/v2/", conversationId);
            dynamic requestData = new
            {
                participants = participants
            };

            return(await _podio.Post <dynamic>(url, requestData));
        }
Ejemplo n.º 15
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 async System.Threading.Tasks.Task IncompleteTask(int taskId, bool hook = true, bool silent = false)
        {
            string url = string.Format("/task/{0}/incomplete", taskId);

            url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            await _podio.Post <dynamic>(url);
        }
Ejemplo n.º 16
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"></param>
        /// <param name="id"></param>
        /// <param name="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>
        /// <param name="hook">todo: describe hook parameter on AddCommentToObject</param>
        /// <returns></returns>
        public async Task <int> AddCommentToObject(string type, int id, CommentCreateUpdateRequest comment, bool alertInvite = false,
                                                   bool silent = false, bool hook = true)
        {
            string url = string.Format("/comment/{0}/{1}/", type, id);

            url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook, null, alertInvite));
            dynamic response = await _podio.Post <dynamic>(url, comment);

            return((int)response["comment_id"]);
        }
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"></param>
        /// <param name="refId"></param>
        /// <param name="ratingType"></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.Post <dynamic>(url, requestData);

            return((int)response["rating_id"]);
        }
Ejemplo n.º 18
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 async Task <Embed> AddAnEmbed(string embedUrl, string mode = "immediate")
        {
            string  url         = "/embed/";
            dynamic requestData = new
            {
                url  = embedUrl,
                mode = mode
            };

            return(await _podio.Post <Embed>(url, requestData));
        }
Ejemplo n.º 19
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"></param>
        /// <param name="refId"></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></returns>
        public async 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(await _podio.Post <CreatedGrant>(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"></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></returns>
        public async Task <int> CreateSpace(int orgId, string name, string privacy = null, 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.Post <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"></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></returns>
        public async 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(await _podio.Post <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"></param>
        /// <param name="item"></param>
        /// <param name="spaceId"> For use in Podio platform</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, int?spaceId = 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,
                Fields          = fieldValues,
                FileIds         = item.FileIds,
                Tags            = item.Tags,
                Recurrence      = item.Recurrence,
                LinkedAccountId = item.LinkedAccountId,
                Reminder        = item.Reminder,
                Ref             = item.Ref,
                SpaceId         = spaceId
            };

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

            url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook));
            var response = await _podio.Post <Item>(url, requestData);

            return(response.ItemId);
        }
Ejemplo n.º 23
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"></param>
        /// <returns></returns>
        public async Task <List <ReferenceGroup> > SearchReferences(SearchReferencesRequest searchReferenceRequest)
        {
            string url = "/reference/search";

            return(await _podio.Post <List <ReferenceGroup> >(url, searchReferenceRequest));
        }
Ejemplo n.º 24
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"></param>
        public async Task <dynamic> ActivateForm(int formId)
        {
            string url = string.Format("/form/{0}/activate", formId);

            return(await _podio.Post <dynamic>(url));
        }
Ejemplo n.º 25
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 async Task <dynamic> StarNotification(int notificationId)
        {
            string url = string.Format("/notification/{0}/star", notificationId);

            return(await _podio.Post <dynamic>(url));
        }
Ejemplo n.º 26
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"></param>
 public async System.Threading.Tasks.Task ActivateApp(int appId)
 {
     string url = string.Format("/app/{0}/activate", appId);
     await _podio.Post <dynamic>(url);
 }
Ejemplo n.º 27
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 async Task <dynamic> JoinSpace(int spaceId)
        {
            string url = string.Format("/space/{0}/join", spaceId);

            return(await _podio.Post <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"></param>
        /// <param name="refId"></param>
        /// <param name="reminderId"></param>
        public async Task <dynamic> SnoozeReminder(string refType, int refId, int reminderId)
        {
            string url = string.Format("/reminder/{0}/{1}/snooze?reminder_id={2}", refType, refId, reminderId);

            return(await _podio.Post <dynamic>(url));
        }
Ejemplo n.º 29
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"></param>
        /// <param name="refId"></param>
        /// <param name="tags"></param>
        public async Task <dynamic> CreateTags(string refType, int refId, List <string> tags)
        {
            string url = string.Format("/tag/{0}/{1}/", refType, refId);

            return(await _podio.Post <dynamic>(url, tags));
        }