/// <inheritdoc />
        /// <summary>
        /// Get a list of supported expressions to use in conditions or actions Each resource contains a type and a definition that are read-only, all the other fields must be provided when using the expression in a rule. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_EXPRESSIONS_USER
        /// </summary>
        /// <param name="filterTypeGroup">Filter for expressions by type group</param>
        public void GetBREExpressions(string filterTypeGroup)
        {
            mWebCallEvent.WebPath = "/bre/expressions";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterTypeGroup != null)
            {
                mWebCallEvent.QueryParams["filter_type_group"] = KnetikClient.ParameterToString(filterTypeGroup);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetBREExpressionsStartTime = DateTime.Now;
            mWebCallEvent.Context       = mGetBREExpressionsResponseContext;
            mWebCallEvent.RequestType   = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetBREExpressionsStartTime, "GetBREExpressions", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Create a shipping item A shipping item represents a shipping option and cost. SKUs have to be unique in the entire store. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; SHIPPING_ADMIN
        /// </summary>
        /// <param name="cascade">Whether to cascade group changes, such as in the limited gettable behavior. A 400 error will return otherwise if the group is already in use with different values.</param>
        /// <param name="shippingItem">The shipping item object</param>
        public void CreateShippingItem(bool?cascade, ShippingItem shippingItem)
        {
            mWebCallEvent.WebPath = "/store/shipping";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (cascade != null)
            {
                mWebCallEvent.QueryParams["cascade"] = KnetikClient.ParameterToString(cascade);
            }

            mWebCallEvent.PostBody = KnetikClient.Serialize(shippingItem); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mCreateShippingItemStartTime = DateTime.Now;
            mWebCallEvent.Context        = mCreateShippingItemResponseContext;
            mWebCallEvent.RequestType    = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mCreateShippingItemStartTime, "CreateShippingItem", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Get a single rule &lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_RULES_ADMIN
        /// </summary>
        /// <param name="id">The id of the rule</param>
        public void GetBRERule(string id)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling GetBRERule");
            }

            mWebCallEvent.WebPath = "/bre/rules/{id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetBRERuleStartTime      = DateTime.Now;
            mWebCallEvent.Context     = mGetBRERuleResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetBRERuleStartTime, "GetBRERule", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// List the challenges associated with a campaign &lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="id">The campaign id</param>
        /// <param name="filterStartDate">A comma separated string without spaces.  First value is the operator to search on, second value is the challenge start date, a unix timestamp in seconds.  Allowed operators: (GT, LT, EQ, GOE, LOE).</param>
        /// <param name="filterEndDate">A comma separated string without spaces.  First value is the operator to search on, second value is the challenge end date, a unix timestamp in seconds.  Allowed operators: (GT, LT, EQ, GOE, LOE).</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetCampaignChallenges(long?id, string filterStartDate, string filterEndDate, int?size, int?page, string order)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling GetCampaignChallenges");
            }

            mWebCallEvent.WebPath = "/campaigns/{id}/challenges";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterStartDate != null)
            {
                mWebCallEvent.QueryParams["filter_start_date"] = KnetikClient.ParameterToString(filterStartDate);
            }

            if (filterEndDate != null)
            {
                mWebCallEvent.QueryParams["filter_end_date"] = KnetikClient.ParameterToString(filterEndDate);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetCampaignChallengesStartTime = DateTime.Now;
            mWebCallEvent.Context           = mGetCampaignChallengesResponseContext;
            mWebCallEvent.RequestType       = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetCampaignChallengesStartTime, "GetCampaignChallenges", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Returns a page of comments &lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="context">Get comments by context type</param>
        /// <param name="contextId">Get comments by context id</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetComments(string context, int?contextId, int?size, int?page)
        {
            // verify the required parameter 'context' is set
            if (context == null)
            {
                throw new KnetikException(400, "Missing required parameter 'context' when calling GetComments");
            }
            // verify the required parameter 'contextId' is set
            if (contextId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'contextId' when calling GetComments");
            }

            mWebCallEvent.WebPath = "/comments";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (context != null)
            {
                mWebCallEvent.QueryParams["context"] = KnetikClient.ParameterToString(context);
            }

            if (contextId != null)
            {
                mWebCallEvent.QueryParams["context_id"] = KnetikClient.ParameterToString(contextId);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetCommentsStartTime     = DateTime.Now;
            mWebCallEvent.Context     = mGetCommentsResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetCommentsStartTime, "GetComments", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 6
0
        /// <inheritdoc />
        /// <summary>
        /// List and search currencies &lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="filterDefault">Filter for the one currency that is set as default (true), or all that are not (false)</param>
        /// <param name="filterEnabledCurrencies">Filter for alternate currencies setup explicitely in system config</param>
        /// <param name="filterType">Filter currencies by type.  Allowable values: (&#39;virtual&#39;, &#39;real&#39;)</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetCurrencies(bool?filterDefault, bool?filterEnabledCurrencies, string filterType, int?size, int?page, string order)
        {
            mWebCallEvent.WebPath = "/currencies";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterDefault != null)
            {
                mWebCallEvent.QueryParams["filter_default"] = KnetikClient.ParameterToString(filterDefault);
            }

            if (filterEnabledCurrencies != null)
            {
                mWebCallEvent.QueryParams["filter_enabled_currencies"] = KnetikClient.ParameterToString(filterEnabledCurrencies);
            }

            if (filterType != null)
            {
                mWebCallEvent.QueryParams["filter_type"] = KnetikClient.ParameterToString(filterType);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetCurrenciesStartTime   = DateTime.Now;
            mWebCallEvent.Context     = mGetCurrenciesResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetCurrenciesStartTime, "GetCurrencies", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 7
0
        /// <inheritdoc />
        /// <summary>
        /// List and search polls Get a list of polls with optional filtering. Assets will not be filled in on the resources returned. Use &#39;Get a single poll&#39; to retrieve the full resource with assets for a given item as needed. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="filterCategory">Filter for polls from a specific category by id</param>
        /// <param name="filterTagset">Filter for polls with specified tags (separated by comma)</param>
        /// <param name="filterText">Filter for polls whose text contains a string</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetPolls(string filterCategory, string filterTagset, string filterText, int?size, int?page, string order)
        {
            mWebCallEvent.WebPath = "/media/polls";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterCategory != null)
            {
                mWebCallEvent.QueryParams["filter_category"] = KnetikClient.ParameterToString(filterCategory);
            }

            if (filterTagset != null)
            {
                mWebCallEvent.QueryParams["filter_tagset"] = KnetikClient.ParameterToString(filterTagset);
            }

            if (filterText != null)
            {
                mWebCallEvent.QueryParams["filter_text"] = KnetikClient.ParameterToString(filterText);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetPollsStartTime        = DateTime.Now;
            mWebCallEvent.Context     = mGetPollsResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetPollsStartTime, "GetPolls", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Get revenue info by item Get basic info about revenue from sales of all types, summed up within a time range and split out by specific item. Sorted for largest revenue at the top. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; REPORTING_REVENUE_ADMIN
        /// </summary>
        /// <param name="currencyCode">The code for a currency to get sales data for</param>
        /// <param name="startDate">The start of the time range to aggregate, unix timestamp in seconds. Default is beginning of time</param>
        /// <param name="endDate">The end of the time range to aggregate, unix timestamp in seconds. Default is end of time</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetRevenueByItem(string currencyCode, long?startDate, long?endDate, int?size, int?page)
        {
            // verify the required parameter 'currencyCode' is set
            if (currencyCode == null)
            {
                throw new KnetikException(400, "Missing required parameter 'currencyCode' when calling GetRevenueByItem");
            }

            mWebCallEvent.WebPath = "/reporting/revenue/products/{currency_code}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "currency_code" + "}", KnetikClient.ParameterToString(currencyCode));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (startDate != null)
            {
                mWebCallEvent.QueryParams["start_date"] = KnetikClient.ParameterToString(startDate);
            }

            if (endDate != null)
            {
                mWebCallEvent.QueryParams["end_date"] = KnetikClient.ParameterToString(endDate);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetRevenueByItemStartTime = DateTime.Now;
            mWebCallEvent.Context      = mGetRevenueByItemResponseContext;
            mWebCallEvent.RequestType  = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetRevenueByItemStartTime, "GetRevenueByItem", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Get user registration info Get user registration counts grouped by time range. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; REPORTING_USER_ADMIN
        /// </summary>
        /// <param name="granularity">The time duration to aggregate by</param>
        /// <param name="startDate">The start of the time range to aggregate, unix timestamp in seconds. Default is beginning of time</param>
        /// <param name="endDate">The end of the time range to aggregate, unix timestamp in seconds. Default is end of time</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetUserRegistrations(string granularity, long?startDate, long?endDate, int?size, int?page)
        {
            mWebCallEvent.WebPath = "/reporting/users/registrations";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (granularity != null)
            {
                mWebCallEvent.QueryParams["granularity"] = KnetikClient.ParameterToString(granularity);
            }

            if (startDate != null)
            {
                mWebCallEvent.QueryParams["start_date"] = KnetikClient.ParameterToString(startDate);
            }

            if (endDate != null)
            {
                mWebCallEvent.QueryParams["end_date"] = KnetikClient.ParameterToString(endDate);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetUserRegistrationsStartTime = DateTime.Now;
            mWebCallEvent.Context          = mGetUserRegistrationsResponseContext;
            mWebCallEvent.RequestType      = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetUserRegistrationsStartTime, "GetUserRegistrations", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 10
0
        /// <inheritdoc />
        /// <summary>
        /// Returns a page of flag reports Context can be either a free-form string or a pre-defined context name. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; MODERATION_ADMIN
        /// </summary>
        /// <param name="excludeResolved">Ignore resolved context</param>
        /// <param name="filterContext">Filter by moderation context</param>
        /// <param name="filterContextId">Filter by moderation context ID</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetModerationReports(bool?excludeResolved, string filterContext, string filterContextId, int?size, int?page)
        {
            mWebCallEvent.WebPath = "/moderation/reports";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (excludeResolved != null)
            {
                mWebCallEvent.QueryParams["exclude_resolved"] = KnetikClient.ParameterToString(excludeResolved);
            }

            if (filterContext != null)
            {
                mWebCallEvent.QueryParams["filter_context"] = KnetikClient.ParameterToString(filterContext);
            }

            if (filterContextId != null)
            {
                mWebCallEvent.QueryParams["filter_context_id"] = KnetikClient.ParameterToString(filterContextId);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetModerationReportsStartTime = DateTime.Now;
            mWebCallEvent.Context          = mGetModerationReportsResponseContext;
            mWebCallEvent.RequestType      = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetModerationReportsStartTime, "GetModerationReports", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 11
0
        /// <inheritdoc />
        /// <summary>
        /// List and search taxes within a country &lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="countryCodeIso3">The iso3 code of the country</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetStateTaxesForCountry(string countryCodeIso3, int?size, int?page, string order)
        {
            // verify the required parameter 'countryCodeIso3' is set
            if (countryCodeIso3 == null)
            {
                throw new KnetikException(400, "Missing required parameter 'countryCodeIso3' when calling GetStateTaxesForCountry");
            }

            mWebCallEvent.WebPath = "/tax/countries/{country_code_iso3}/states";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "country_code_iso3" + "}", KnetikClient.ParameterToString(countryCodeIso3));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetStateTaxesForCountryStartTime = DateTime.Now;
            mWebCallEvent.Context             = mGetStateTaxesForCountryResponseContext;
            mWebCallEvent.RequestType         = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetStateTaxesForCountryStartTime, "GetStateTaxesForCountry", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 12
0
        /// <inheritdoc />
        /// <summary>
        /// List valid values for a type Used to lookup users to fill in a user constant for example. Only types marked as enumerable are suppoorted here. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_VARIABLES_USER
        /// </summary>
        /// <param name="name">The name of the type</param>
        /// <param name="filterName">Filter results by those with names starting with this string</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetBREVariableValues(string name, string filterName, int?size, int?page)
        {
            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new KnetikException(400, "Missing required parameter 'name' when calling GetBREVariableValues");
            }

            mWebCallEvent.WebPath = "/bre/variable-types/{name}/values";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "name" + "}", KnetikClient.ParameterToString(name));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterName != null)
            {
                mWebCallEvent.QueryParams["filter_name"] = KnetikClient.ParameterToString(filterName);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetBREVariableValuesStartTime = DateTime.Now;
            mWebCallEvent.Context          = mGetBREVariableValuesResponseContext;
            mWebCallEvent.RequestType      = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetBREVariableValuesStartTime, "GetBREVariableValues", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// View a user&#39;s notification settings
        /// </summary>
        /// <param name="userId">The id of the subscriber or &#39;me&#39;</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetUserNotificationInfoList(string userId, int?size, int?page, string order)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling GetUserNotificationInfoList");
            }

            mWebCallEvent.WebPath = "/users/{user_id}/notifications/types";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetUserNotificationInfoListStartTime = DateTime.Now;
            mWebCallEvent.Context     = mGetUserNotificationInfoListResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetUserNotificationInfoListStartTime, "GetUserNotificationInfoList", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Returns list of endpoints called (method and url) &lt;b&gt;Permissions Needed:&lt;/b&gt; USAGE_ADMIN
        /// </summary>
        /// <param name="startDate">The beginning of the range being requested, unix timestamp in seconds</param>
        /// <param name="endDate">The ending of the range being requested, unix timestamp in seconds</param>
        public void GetUsageEndpoints(long?startDate, long?endDate)
        {
            // verify the required parameter 'startDate' is set
            if (startDate == null)
            {
                throw new KnetikException(400, "Missing required parameter 'startDate' when calling GetUsageEndpoints");
            }
            // verify the required parameter 'endDate' is set
            if (endDate == null)
            {
                throw new KnetikException(400, "Missing required parameter 'endDate' when calling GetUsageEndpoints");
            }

            mWebCallEvent.WebPath = "/reporting/usage/endpoints";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (startDate != null)
            {
                mWebCallEvent.QueryParams["start_date"] = KnetikClient.ParameterToString(startDate);
            }

            if (endDate != null)
            {
                mWebCallEvent.QueryParams["end_date"] = KnetikClient.ParameterToString(endDate);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetUsageEndpointsStartTime = DateTime.Now;
            mWebCallEvent.Context       = mGetUsageEndpointsResponseContext;
            mWebCallEvent.RequestType   = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetUsageEndpointsStartTime, "GetUsageEndpoints", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 15
0
        /// <inheritdoc />
        /// <summary>
        /// Returns the authentication log for a user A log entry is recorded everytime a user requests a new token. Standard pagination available. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; SECURITY_ADMIN
        /// </summary>
        /// <param name="userId">The user id</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetUserLocationLog(int?userId, int?size, int?page, string order)
        {
            mWebCallEvent.WebPath = "/security/country-log";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (userId != null)
            {
                mWebCallEvent.QueryParams["user_id"] = KnetikClient.ParameterToString(userId);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetUserLocationLogStartTime = DateTime.Now;
            mWebCallEvent.Context        = mGetUserLocationLogResponseContext;
            mWebCallEvent.RequestType    = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetUserLocationLogStartTime, "GetUserLocationLog", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 16
0
        /// <inheritdoc />
        /// <summary>
        /// Update an object &lt;b&gt;Permissions Needed:&lt;/b&gt; INVENTORY_ADMIN
        /// </summary>
        /// <param name="templateId">The id of the template this object is part of</param>
        /// <param name="objectId">The id of the object</param>
        /// <param name="cascade">Whether to cascade group changes, such as in the limited gettable behavior. A 400 error will return otherwise if the group is already in use with different values.</param>
        /// <param name="objectItem">The object item object</param>
        public void UpdateObjectItem(string templateId, int?objectId, bool?cascade, ObjectResource objectItem)
        {
            // verify the required parameter 'templateId' is set
            if (templateId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'templateId' when calling UpdateObjectItem");
            }
            // verify the required parameter 'objectId' is set
            if (objectId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'objectId' when calling UpdateObjectItem");
            }

            mWebCallEvent.WebPath = "/objects/{template_id}/{object_id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "template_id" + "}", KnetikClient.ParameterToString(templateId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "object_id" + "}", KnetikClient.ParameterToString(objectId));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (cascade != null)
            {
                mWebCallEvent.QueryParams["cascade"] = KnetikClient.ParameterToString(cascade);
            }

            mWebCallEvent.PostBody = KnetikClient.Serialize(objectItem); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mUpdateObjectItemStartTime = DateTime.Now;
            mWebCallEvent.Context      = mUpdateObjectItemResponseContext;
            mWebCallEvent.RequestType  = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mUpdateObjectItemStartTime, "UpdateObjectItem", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Retrieve a challenge event leaderboard details Lists all leaderboard entries with additional user details. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; REPORTING_CHALLENGES_ADMIN
        /// </summary>
        /// <param name="filterEvent">A sepecific challenge event id</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned</param>
        /// <param name="order">A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]</param>
        public void GetChallengeEventLeaderboard(long?filterEvent, int?size, int?page, string order)
        {
            mWebCallEvent.WebPath = "/reporting/events/leaderboard";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterEvent != null)
            {
                mWebCallEvent.QueryParams["filter_event"] = KnetikClient.ParameterToString(filterEvent);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            if (order != null)
            {
                mWebCallEvent.QueryParams["order"] = KnetikClient.ParameterToString(order);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetChallengeEventLeaderboardStartTime = DateTime.Now;
            mWebCallEvent.Context     = mGetChallengeEventLeaderboardResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetChallengeEventLeaderboardStartTime, "GetChallengeEventLeaderboard", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Enable or disable messages for a user Useful for opt-out options on a single topic. Consider multiple topics for multiple opt-out options.
        /// </summary>
        /// <param name="id">The id of the topic</param>
        /// <param name="userId">The id of the subscriber or &#39;me&#39;</param>
        /// <param name="disabled">disabled</param>
        public void DisableTopicSubscriber(string id, string userId, ValueWrapperboolean disabled)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling DisableTopicSubscriber");
            }
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling DisableTopicSubscriber");
            }
            // verify the required parameter 'disabled' is set
            if (disabled == null)
            {
                throw new KnetikException(400, "Missing required parameter 'disabled' when calling DisableTopicSubscriber");
            }

            mWebCallEvent.WebPath = "/messaging/topics/{id}/subscribers/{user_id}/disabled";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(disabled); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mDisableTopicSubscriberStartTime = DateTime.Now;
            mWebCallEvent.Context            = mDisableTopicSubscriberResponseContext;
            mWebCallEvent.RequestType        = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mDisableTopicSubscriberStartTime, "DisableTopicSubscriber", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 19
0
        /// <inheritdoc />
        /// <summary>
        /// Get a temporary signed S3 URL for download To give access to files in your own S3 account, you will need to grant KnetikcCloud access to the file by adjusting your bucket policy accordingly. See S3 documentation for details. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; S3_ADMIN
        /// </summary>
        /// <param name="bucket">S3 bucket name</param>
        /// <param name="path">The path to the file relative the bucket (the s3 object key)</param>
        /// <param name="expiration">The number of seconds this URL will be valid. Default to 60</param>
        public void GetDownloadURL(string bucket, string path, int?expiration)
        {
            mWebCallEvent.WebPath = "/amazon/s3/downloadurl";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (bucket != null)
            {
                mWebCallEvent.QueryParams["bucket"] = KnetikClient.ParameterToString(bucket);
            }

            if (path != null)
            {
                mWebCallEvent.QueryParams["path"] = KnetikClient.ParameterToString(path);
            }

            if (expiration != null)
            {
                mWebCallEvent.QueryParams["expiration"] = KnetikClient.ParameterToString(expiration);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetDownloadURLStartTime  = DateTime.Now;
            mWebCallEvent.Context     = mGetDownloadURLResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetDownloadURLStartTime, "GetDownloadURL", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Update an existing payment method for a user &lt;b&gt;Permissions Needed:&lt;/b&gt; PAYMENTS_ADMIN or owner
        /// </summary>
        /// <param name="userId">ID of the user for whom the payment method is being updated</param>
        /// <param name="id">ID of the payment method being updated</param>
        /// <param name="paymentMethod">The updated payment method data</param>
        public void UpdatePaymentMethod(int?userId, int?id, PaymentMethodResource paymentMethod)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling UpdatePaymentMethod");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling UpdatePaymentMethod");
            }

            mWebCallEvent.WebPath = "/users/{user_id}/payment-methods/{id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(paymentMethod); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mUpdatePaymentMethodStartTime = DateTime.Now;
            mWebCallEvent.Context         = mUpdatePaymentMethodResponseContext;
            mWebCallEvent.RequestType     = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mUpdatePaymentMethodStartTime, "UpdatePaymentMethod", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 21
0
        /// <inheritdoc />
        /// <summary>
        /// Delete a flag &lt;b&gt;Permissions Needed:&lt;/b&gt; MODERATION_ADMIN or owner
        /// </summary>
        /// <param name="contextName">The name of the context</param>
        /// <param name="contextId">The id of the context</param>
        /// <param name="userId">The id of the user</param>
        public void DeleteFlag(string contextName, string contextId, int?userId)
        {
            mWebCallEvent.WebPath = "/moderation/flags";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (contextName != null)
            {
                mWebCallEvent.QueryParams["context_name"] = KnetikClient.ParameterToString(contextName);
            }

            if (contextId != null)
            {
                mWebCallEvent.QueryParams["context_id"] = KnetikClient.ParameterToString(contextId);
            }

            if (userId != null)
            {
                mWebCallEvent.QueryParams["user_id"] = KnetikClient.ParameterToString(userId);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mDeleteFlagStartTime      = DateTime.Now;
            mWebCallEvent.Context     = mDeleteFlagResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.DELETE;

            KnetikLogger.LogRequest(mDeleteFlagStartTime, "DeleteFlag", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// List global definitions &lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_GLOBALS_USER
        /// </summary>
        /// <param name="filterSystem">Filter for globals that are system globals when true, or not when false. Leave off for both mixed</param>
        /// <param name="size">The number of objects returned per page</param>
        /// <param name="page">The number of the page returned, starting with 1</param>
        public void GetBREGlobals(bool?filterSystem, int?size, int?page)
        {
            mWebCallEvent.WebPath = "/bre/globals/definitions";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterSystem != null)
            {
                mWebCallEvent.QueryParams["filter_system"] = KnetikClient.ParameterToString(filterSystem);
            }

            if (size != null)
            {
                mWebCallEvent.QueryParams["size"] = KnetikClient.ParameterToString(size);
            }

            if (page != null)
            {
                mWebCallEvent.QueryParams["page"] = KnetikClient.ParameterToString(page);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetBREGlobalsStartTime   = DateTime.Now;
            mWebCallEvent.Context     = mGetBREGlobalsResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetBREGlobalsStartTime, "GetBREGlobals", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Add device users &lt;b&gt;Permissions Needed:&lt;/b&gt; DEVICES_ADMIN or owner
        /// </summary>
        /// <param name="userResources">userResources</param>
        /// <param name="id">id</param>
        public void AddDeviceUsers(List <SimpleUserResource> userResources, string id)
        {
            // verify the required parameter 'userResources' is set
            if (userResources == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userResources' when calling AddDeviceUsers");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling AddDeviceUsers");
            }

            mWebCallEvent.WebPath = "/devices/{id}/users";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(userResources); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mAddDeviceUsersStartTime  = DateTime.Now;
            mWebCallEvent.Context     = mAddDeviceUsersResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mAddDeviceUsersStartTime, "AddDeviceUsers", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 24
0
        /// <inheritdoc />
        /// <summary>
        /// Add a user to a chat message blacklist &lt;b&gt;Permissions Needed:&lt;/b&gt; CHAT_ADMIN or owner
        /// </summary>
        /// <param name="blacklistedUserId">The user id to blacklist</param>
        /// <param name="id">The user id or &#39;me&#39;</param>
        public void AddChatMessageBlacklist(int?blacklistedUserId, string id)
        {
            // verify the required parameter 'blacklistedUserId' is set
            if (blacklistedUserId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'blacklistedUserId' when calling AddChatMessageBlacklist");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling AddChatMessageBlacklist");
            }

            mWebCallEvent.WebPath = "/chat/users/{id}/blacklist/{blacklisted_user_id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "blacklisted_user_id" + "}", KnetikClient.ParameterToString(blacklistedUserId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mAddChatMessageBlacklistStartTime = DateTime.Now;
            mWebCallEvent.Context             = mAddChatMessageBlacklistResponseContext;
            mWebCallEvent.RequestType         = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mAddChatMessageBlacklistStartTime, "AddChatMessageBlacklist", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 25
0
        /// <inheritdoc />
        /// <summary>
        /// Delete an address &lt;b&gt;Permissions Needed:&lt;/b&gt; USERS_ADMIN or owner
        /// </summary>
        /// <param name="userId">The id of the user</param>
        /// <param name="id">The id of the address</param>
        public void DeleteAddress(string userId, int?id)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling DeleteAddress");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling DeleteAddress");
            }

            mWebCallEvent.WebPath = "/users/{user_id}/addresses/{id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mDeleteAddressStartTime   = DateTime.Now;
            mWebCallEvent.Context     = mDeleteAddressResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.DELETE;

            KnetikLogger.LogRequest(mDeleteAddressStartTime, "DeleteAddress", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Removes a discount coupon from the cart &lt;b&gt;Permissions Needed:&lt;/b&gt; SHOPPING_CARTS_ADMIN or owner
        /// </summary>
        /// <param name="id">The id of the cart</param>
        /// <param name="code">The SKU code of the coupon to remove</param>
        public void RemoveDiscountFromCart(string id, string code)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling RemoveDiscountFromCart");
            }
            // verify the required parameter 'code' is set
            if (code == null)
            {
                throw new KnetikException(400, "Missing required parameter 'code' when calling RemoveDiscountFromCart");
            }

            mWebCallEvent.WebPath = "/carts/{id}/discounts/{code}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "code" + "}", KnetikClient.ParameterToString(code));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mRemoveDiscountFromCartStartTime = DateTime.Now;
            mWebCallEvent.Context            = mRemoveDiscountFromCartResponseContext;
            mWebCallEvent.RequestType        = KnetikRequestType.DELETE;

            KnetikLogger.LogRequest(mRemoveDiscountFromCartStartTime, "RemoveDiscountFromCart", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 27
0
        /// <inheritdoc />
        /// <summary>
        /// Delete a permission &lt;b&gt;Permissions Needed:&lt;/b&gt; PERMISSIONS_ADMIN
        /// </summary>
        /// <param name="permission">The permission value</param>
        /// <param name="force">If true, removes permission assigned to roles</param>
        public void DeletePermission(string permission, bool?force)
        {
            // verify the required parameter 'permission' is set
            if (permission == null)
            {
                throw new KnetikException(400, "Missing required parameter 'permission' when calling DeletePermission");
            }

            mWebCallEvent.WebPath = "/auth/permissions/{permission}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "permission" + "}", KnetikClient.ParameterToString(permission));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (force != null)
            {
                mWebCallEvent.QueryParams["force"] = KnetikClient.ParameterToString(force);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mDeletePermissionStartTime = DateTime.Now;
            mWebCallEvent.Context      = mDeletePermissionResponseContext;
            mWebCallEvent.RequestType  = KnetikRequestType.DELETE;

            KnetikLogger.LogRequest(mDeletePermissionStartTime, "DeletePermission", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 28
0
        /// <inheritdoc />
        /// <summary>
        /// Get a signed S3 URL for upload Requires the file name and file content type (i.e., &#39;video/mpeg&#39;). Make a PUT to the resulting url to upload the file and use the cdn_url to retrieve it after. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; S3_USER or S3_ADMIN
        /// </summary>
        /// <param name="filename">The file name</param>
        /// <param name="contentType">The content type</param>
        public void GetSignedS3URL(string filename, string contentType)
        {
            mWebCallEvent.WebPath = "/amazon/s3/signedposturl";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filename != null)
            {
                mWebCallEvent.QueryParams["filename"] = KnetikClient.ParameterToString(filename);
            }

            if (contentType != null)
            {
                mWebCallEvent.QueryParams["content_type"] = KnetikClient.ParameterToString(contentType);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetSignedS3URLStartTime  = DateTime.Now;
            mWebCallEvent.Context     = mGetSignedS3URLResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetSignedS3URLStartTime, "GetSignedS3URL", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
Esempio n. 29
0
        /// <inheritdoc />
        /// <summary>
        /// Returns a list of disposition counts &lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="filterContext">Filter for dispositions within a context type (games, articles, polls, etc). Optionally with a specific id like filter_context&#x3D;video:47</param>
        /// <param name="filterOwner">Filter for dispositions from a specific user by id or &#39;me&#39;</param>
        public void GetDispositionCounts(string filterContext, string filterOwner)
        {
            mWebCallEvent.WebPath = "/dispositions/count";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (filterContext != null)
            {
                mWebCallEvent.QueryParams["filter_context"] = KnetikClient.ParameterToString(filterContext);
            }

            if (filterOwner != null)
            {
                mWebCallEvent.QueryParams["filter_owner"] = KnetikClient.ParameterToString(filterOwner);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mGetDispositionCountsStartTime = DateTime.Now;
            mWebCallEvent.Context          = mGetDispositionCountsResponseContext;
            mWebCallEvent.RequestType      = KnetikRequestType.GET;

            KnetikLogger.LogRequest(mGetDispositionCountsStartTime, "GetDispositionCounts", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Create a cart You don&#39;t have to have a user to create a cart but the API requires authentication to checkout. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; ANY
        /// </summary>
        /// <param name="owner">Set the owner of a cart. If not specified, defaults to the calling user&#39;s id. If specified and is not the calling user&#39;s id, SHOPPING_CARTS_ADMIN permission is required</param>
        /// <param name="currencyCode">Set the currency for the cart, by currency code. May be disallowed by site settings.</param>
        public void CreateCart(int?owner, string currencyCode)
        {
            mWebCallEvent.WebPath = "/carts";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (owner != null)
            {
                mWebCallEvent.QueryParams["owner"] = KnetikClient.ParameterToString(owner);
            }

            if (currencyCode != null)
            {
                mWebCallEvent.QueryParams["currency_code"] = KnetikClient.ParameterToString(currencyCode);
            }

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mCreateCartStartTime      = DateTime.Now;
            mWebCallEvent.Context     = mCreateCartResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mCreateCartStartTime, "CreateCart", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }