/// <inheritdoc /> /// <summary> /// Pay with a single use token Obtain a token from Stripe, following their examples and documentation. Pays an invoice without creating a payment method. Ensure that Stripe itself has been configured with the webhook so that invoices are marked paid. <br><br><b>Permissions Needed:</b> ANY /// </summary> /// <param name="request">The request to pay an invoice</param> public void PayStripeInvoice(StripePaymentRequest request) { mWebCallEvent.WebPath = "/payment/provider/stripe/payments"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(request); // 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 mPayStripeInvoiceStartTime = DateTime.Now; mWebCallEvent.Context = mPayStripeInvoiceResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mPayStripeInvoiceStartTime, "PayStripeInvoice", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Get a single notification type /// </summary> /// <param name="id">id</param> public void GetNotificationType(string id) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling GetNotificationType"); } mWebCallEvent.WebPath = "/notifications/types/{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 mGetNotificationTypeStartTime = DateTime.Now; mWebCallEvent.Context = mGetNotificationTypeResponseContext; mWebCallEvent.RequestType = KnetikRequestType.GET; KnetikLogger.LogRequest(mGetNotificationTypeStartTime, "GetNotificationType", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Create a notification type /// </summary> /// <param name="notificationType">notificationType</param> public void CreateNotificationType(NotificationTypeResource notificationType) { mWebCallEvent.WebPath = "/notifications/types"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(notificationType); // 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 mCreateNotificationTypeStartTime = DateTime.Now; mWebCallEvent.Context = mCreateNotificationTypeResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateNotificationTypeStartTime, "CreateNotificationType", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Create a device <b>Permissions Needed:</b> ANY /// </summary> /// <param name="device">device</param> public void CreateDevice(DeviceResource device) { // verify the required parameter 'device' is set if (device == null) { throw new KnetikException(400, "Missing required parameter 'device' when calling CreateDevice"); } mWebCallEvent.WebPath = "/devices"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(device); // 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 mCreateDeviceStartTime = DateTime.Now; mWebCallEvent.Context = mCreateDeviceResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateDeviceStartTime, "CreateDevice", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Create a coupon item SKUs have to be unique in the entire store. <br><br><b>Permissions Needed:</b> COUPONS_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="couponItem">The coupon item object</param> public void CreateCouponItem(bool?cascade, CouponItem couponItem) { mWebCallEvent.WebPath = "/store/coupons"; 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(couponItem); // 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 mCreateCouponItemStartTime = DateTime.Now; mWebCallEvent.Context = mCreateCouponItemResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateCouponItemStartTime, "CreateCouponItem", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Add a user log entry <b>Permissions Needed:</b> owner /// </summary> /// <param name="logEntry">The user log entry to be added</param> public void AddUserLog(UserActionLog logEntry) { mWebCallEvent.WebPath = "/audit/logs"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(logEntry); // 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 mAddUserLogStartTime = DateTime.Now; mWebCallEvent.Context = mAddUserLogResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mAddUserLogStartTime, "AddUserLog", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// List the challenges associated with a campaign <b>Permissions Needed:</b> 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 <b>Permissions Needed:</b> 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); }
/// <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 'Get a single poll' to retrieve the full resource with assets for a given item as needed. <br><br><b>Permissions Needed:</b> 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> /// List and search currencies <b>Permissions Needed:</b> 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: ('virtual', 'real')</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); }
/// <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. <br><br><b>Permissions Needed:</b> 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. <br><br><b>Permissions Needed:</b> 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); }
/// <inheritdoc /> /// <summary> /// Returns a page of flag reports Context can be either a free-form string or a pre-defined context name. <br><br><b>Permissions Needed:</b> 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); }
/// <inheritdoc /> /// <summary> /// List and search taxes within a country <b>Permissions Needed:</b> 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); }
/// <inheritdoc /> /// <summary> /// View a user's notification settings /// </summary> /// <param name="userId">The id of the subscriber or 'me'</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> /// 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. <br><br><b>Permissions Needed:</b> 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); }
private void OnPaymentAuthorizationResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling PaymentAuthorization: " + response.Error); } PaymentAuthorizationData = (PaymentAuthorizationResource)KnetikClient.Deserialize(response.Content, typeof(PaymentAuthorizationResource), response.Headers); KnetikLogger.LogResponse(mPaymentAuthorizationStartTime, "PaymentAuthorization", string.Format("Response received successfully:\n{0}", PaymentAuthorizationData)); if (PaymentAuthorizationComplete != null) { PaymentAuthorizationComplete(response.ResponseCode, PaymentAuthorizationData); } }
private void OnCreateShippingTemplateResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling CreateShippingTemplate: " + response.Error); } CreateShippingTemplateData = (ItemTemplateResource)KnetikClient.Deserialize(response.Content, typeof(ItemTemplateResource), response.Headers); KnetikLogger.LogResponse(mCreateShippingTemplateStartTime, "CreateShippingTemplate", string.Format("Response received successfully:\n{0}", CreateShippingTemplateData)); if (CreateShippingTemplateComplete != null) { CreateShippingTemplateComplete(response.ResponseCode, CreateShippingTemplateData); } }
private void OnHandleGooglePaymentResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling HandleGooglePayment: " + response.Error); } HandleGooglePaymentData = (int?)KnetikClient.Deserialize(response.Content, typeof(int?), response.Headers); KnetikLogger.LogResponse(mHandleGooglePaymentStartTime, "HandleGooglePayment", string.Format("Response received successfully:\n{0}", HandleGooglePaymentData)); if (HandleGooglePaymentComplete != null) { HandleGooglePaymentComplete(response.ResponseCode, HandleGooglePaymentData); } }
private void OnAnswerPollResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling AnswerPoll: " + response.Error); } AnswerPollData = (PollResponseResource)KnetikClient.Deserialize(response.Content, typeof(PollResponseResource), response.Headers); KnetikLogger.LogResponse(mAnswerPollStartTime, "AnswerPoll", string.Format("Response received successfully:\n{0}", AnswerPollData)); if (AnswerPollComplete != null) { AnswerPollComplete(response.ResponseCode, AnswerPollData); } }
private void OnGetSubscriptionRevenueResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling GetSubscriptionRevenue: " + response.Error); } GetSubscriptionRevenueData = (RevenueReportResource)KnetikClient.Deserialize(response.Content, typeof(RevenueReportResource), response.Headers); KnetikLogger.LogResponse(mGetSubscriptionRevenueStartTime, "GetSubscriptionRevenue", string.Format("Response received successfully:\n{0}", GetSubscriptionRevenueData)); if (GetSubscriptionRevenueComplete != null) { GetSubscriptionRevenueComplete(response.ResponseCode, GetSubscriptionRevenueData); } }
private void OnUpdateBRERuleResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateBRERule: " + response.Error); } UpdateBRERuleData = (BreRule)KnetikClient.Deserialize(response.Content, typeof(BreRule), response.Headers); KnetikLogger.LogResponse(mUpdateBRERuleStartTime, "UpdateBRERule", string.Format("Response received successfully:\n{0}", UpdateBRERuleData)); if (UpdateBRERuleComplete != null) { UpdateBRERuleComplete(response.ResponseCode, UpdateBRERuleData); } }
private void OnSendBREEventResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling SendBREEvent: " + response.Error); } SendBREEventData = (string)KnetikClient.Deserialize(response.Content, typeof(string), response.Headers); KnetikLogger.LogResponse(mSendBREEventStartTime, "SendBREEvent", string.Format("Response received successfully:\n{0}", SendBREEventData)); if (SendBREEventComplete != null) { SendBREEventComplete(response.ResponseCode, SendBREEventData); } }
private void OnCompileMessageTemplateResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling CompileMessageTemplate: " + response.Error); } CompileMessageTemplateData = (Dictionary <string, string>)KnetikClient.Deserialize(response.Content, typeof(Dictionary <string, string>), response.Headers); KnetikLogger.LogResponse(mCompileMessageTemplateStartTime, "CompileMessageTemplate", string.Format("Response received successfully:\n{0}", CompileMessageTemplateData)); if (CompileMessageTemplateComplete != null) { CompileMessageTemplateComplete(response.ResponseCode, CompileMessageTemplateData); } }
private void OnGetShippingItemResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling GetShippingItem: " + response.Error); } GetShippingItemData = (ShippingItem)KnetikClient.Deserialize(response.Content, typeof(ShippingItem), response.Headers); KnetikLogger.LogResponse(mGetShippingItemStartTime, "GetShippingItem", string.Format("Response received successfully:\n{0}", GetShippingItemData)); if (GetShippingItemComplete != null) { GetShippingItemComplete(response.ResponseCode, GetShippingItemData); } }
private void OnGetUsersSubscriptionDetailsResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling GetUsersSubscriptionDetails: " + response.Error); } GetUsersSubscriptionDetailsData = (List <InventorySubscriptionResource>)KnetikClient.Deserialize(response.Content, typeof(List <InventorySubscriptionResource>), response.Headers); KnetikLogger.LogResponse(mGetUsersSubscriptionDetailsStartTime, "GetUsersSubscriptionDetails", string.Format("Response received successfully:\n{0}", GetUsersSubscriptionDetailsData)); if (GetUsersSubscriptionDetailsComplete != null) { GetUsersSubscriptionDetailsComplete(response.ResponseCode, GetUsersSubscriptionDetailsData); } }
private void OnGetBRERulesResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling GetBRERules: " + response.Error); } GetBRERulesData = (PageResourceBreRule)KnetikClient.Deserialize(response.Content, typeof(PageResourceBreRule), response.Headers); KnetikLogger.LogResponse(mGetBRERulesStartTime, "GetBRERules", string.Format("Response received successfully:\n{0}", GetBRERulesData)); if (GetBRERulesComplete != null) { GetBRERulesComplete(response.ResponseCode, GetBRERulesData); } }
private void OnReactivateUserSubscriptionResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling ReactivateUserSubscription: " + response.Error); } ReactivateUserSubscriptionData = (InvoiceResource)KnetikClient.Deserialize(response.Content, typeof(InvoiceResource), response.Headers); KnetikLogger.LogResponse(mReactivateUserSubscriptionStartTime, "ReactivateUserSubscription", string.Format("Response received successfully:\n{0}", ReactivateUserSubscriptionData)); if (ReactivateUserSubscriptionComplete != null) { ReactivateUserSubscriptionComplete(response.ResponseCode, ReactivateUserSubscriptionData); } }
private void OnGetSignedS3URLResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling GetSignedS3URL: " + response.Error); } GetSignedS3URLData = (AmazonS3Activity)KnetikClient.Deserialize(response.Content, typeof(AmazonS3Activity), response.Headers); KnetikLogger.LogResponse(mGetSignedS3URLStartTime, "GetSignedS3URL", string.Format("Response received successfully:\n{0}", GetSignedS3URLData)); if (GetSignedS3URLComplete != null) { GetSignedS3URLComplete(response.ResponseCode, GetSignedS3URLData); } }
private void OnVerifyAppleReceiptResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling VerifyAppleReceipt: " + response.Error); } VerifyAppleReceiptData = (string)KnetikClient.Deserialize(response.Content, typeof(string), response.Headers); KnetikLogger.LogResponse(mVerifyAppleReceiptStartTime, "VerifyAppleReceipt", string.Format("Response received successfully:\n{0}", VerifyAppleReceiptData)); if (VerifyAppleReceiptComplete != null) { VerifyAppleReceiptComplete(response.ResponseCode, VerifyAppleReceiptData); } }