/// <inheritdoc /> /// <summary> /// Create a reward set <b>Permissions Needed:</b> REWARDS_ADMIN /// </summary> /// <param name="rewardSetResource">The reward set resource object</param> public void CreateRewardSet(RewardSetResource rewardSetResource) { mWebCallEvent.WebPath = "/rewards"; 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(rewardSetResource); // 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 mCreateRewardSetStartTime = DateTime.Now; mWebCallEvent.Context = mCreateRewardSetResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateRewardSetStartTime, "CreateRewardSet", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateRewardSetResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateRewardSet: " + response.Error); } UpdateRewardSetData = (RewardSetResource)KnetikClient.Deserialize(response.Content, typeof(RewardSetResource), response.Headers); KnetikLogger.LogResponse(mUpdateRewardSetStartTime, "UpdateRewardSet", string.Format("Response received successfully:\n{0}", UpdateRewardSetData)); if (UpdateRewardSetComplete != null) { UpdateRewardSetComplete(response.ResponseCode, UpdateRewardSetData); } }
/// <inheritdoc /> /// <summary> /// Update a reward set <b>Permissions Needed:</b> REWARDS_ADMIN /// </summary> /// <param name="id">The reward id</param> /// <param name="rewardSetResource">The reward set resource object</param> public void UpdateRewardSet(int?id, RewardSetResource rewardSetResource) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateRewardSet"); } mWebCallEvent.WebPath = "/rewards/{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; mWebCallEvent.PostBody = KnetikClient.Serialize(rewardSetResource); // 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 mUpdateRewardSetStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateRewardSetResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateRewardSetStartTime, "UpdateRewardSet", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Update a reward set <b>Permissions Needed:</b> REWARDS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The reward id</param> /// <param name="rewardSetResource">The reward set resource object (optional)</param> /// <returns>ApiResponse of RewardSetResource</returns> public ApiResponse <RewardSetResource> UpdateRewardSetWithHttpInfo(int?id, RewardSetResource rewardSetResource = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Campaigns_RewardsApi->UpdateRewardSet"); } var localVarPath = "/rewards/{id}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } if (rewardSetResource != null && rewardSetResource.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(rewardSetResource); // http body (model) parameter } else { localVarPostBody = rewardSetResource; // byte array } // authentication (oauth2_client_credentials_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // authentication (oauth2_password_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdateRewardSet", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <RewardSetResource>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (RewardSetResource)Configuration.ApiClient.Deserialize(localVarResponse, typeof(RewardSetResource)))); }
/// <summary> /// Update a reward set <b>Permissions Needed:</b> REWARDS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The reward id</param> /// <param name="rewardSetResource">The reward set resource object (optional)</param> /// <returns>RewardSetResource</returns> public RewardSetResource UpdateRewardSet(int?id, RewardSetResource rewardSetResource = null) { ApiResponse <RewardSetResource> localVarResponse = UpdateRewardSetWithHttpInfo(id, rewardSetResource); return(localVarResponse.Data); }
/// <summary> /// Create a reward set <b>Permissions Needed:</b> REWARDS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="rewardSetResource">The reward set resource object (optional)</param> /// <returns>RewardSetResource</returns> public RewardSetResource CreateRewardSet(RewardSetResource rewardSetResource = null) { ApiResponse <RewardSetResource> localVarResponse = CreateRewardSetWithHttpInfo(rewardSetResource); return(localVarResponse.Data); }