/// <inheritdoc /> /// <summary> /// Create a sale <b>Permissions Needed:</b> SALES_ADMIN /// </summary> /// <param name="catalogSale">The catalog sale object</param> public void CreateCatalogSale(CatalogSale catalogSale) { mWebCallEvent.WebPath = "/store/sales"; 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(catalogSale); // 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 mCreateCatalogSaleStartTime = DateTime.Now; mWebCallEvent.Context = mCreateCatalogSaleResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateCatalogSaleStartTime, "CreateCatalogSale", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateCatalogSaleResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateCatalogSale: " + response.Error); } UpdateCatalogSaleData = (CatalogSale)KnetikClient.Deserialize(response.Content, typeof(CatalogSale), response.Headers); KnetikLogger.LogResponse(mUpdateCatalogSaleStartTime, "UpdateCatalogSale", string.Format("Response received successfully:\n{0}", UpdateCatalogSaleData)); if (UpdateCatalogSaleComplete != null) { UpdateCatalogSaleComplete(response.ResponseCode, UpdateCatalogSaleData); } }
/// <inheritdoc /> /// <summary> /// Update a sale <b>Permissions Needed:</b> SALES_ADMIN /// </summary> /// <param name="id">The id of the sale</param> /// <param name="catalogSale">The catalog sale object</param> public void UpdateCatalogSale(int?id, CatalogSale catalogSale) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateCatalogSale"); } mWebCallEvent.WebPath = "/store/sales/{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(catalogSale); // 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 mUpdateCatalogSaleStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateCatalogSaleResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateCatalogSaleStartTime, "UpdateCatalogSale", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Update a sale <b>Permissions Needed:</b> SALES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the sale</param> /// <param name="catalogSale">The catalog sale object (optional)</param> /// <returns>ApiResponse of CatalogSale</returns> public ApiResponse <CatalogSale> UpdateCatalogSaleWithHttpInfo(int?id, CatalogSale catalogSale = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Store_SalesApi->UpdateCatalogSale"); } var localVarPath = "/store/sales/{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 (catalogSale != null && catalogSale.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(catalogSale); // http body (model) parameter } else { localVarPostBody = catalogSale; // 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("UpdateCatalogSale", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <CatalogSale>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (CatalogSale)Configuration.ApiClient.Deserialize(localVarResponse, typeof(CatalogSale)))); }
/// <summary> /// Update a sale <b>Permissions Needed:</b> SALES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the sale</param> /// <param name="catalogSale">The catalog sale object (optional)</param> /// <returns>CatalogSale</returns> public CatalogSale UpdateCatalogSale(int?id, CatalogSale catalogSale = null) { ApiResponse <CatalogSale> localVarResponse = UpdateCatalogSaleWithHttpInfo(id, catalogSale); return(localVarResponse.Data); }
/// <summary> /// Create a sale <b>Permissions Needed:</b> SALES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="catalogSale">The catalog sale object (optional)</param> /// <returns>CatalogSale</returns> public CatalogSale CreateCatalogSale(CatalogSale catalogSale = null) { ApiResponse <CatalogSale> localVarResponse = CreateCatalogSaleWithHttpInfo(catalogSale); return(localVarResponse.Data); }