/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of VirtoCommerceInventoryModuleWebModelInventoryInfo</returns> public async System.Threading.Tasks.Task <VirtoCommerceInventoryModuleWebModelInventoryInfo> InventoryModuleUpsertProductInventoryAsync(VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo> localVarResponse = await InventoryModuleUpsertProductInventoryAsyncWithHttpInfo(inventory, productId); return(localVarResponse.Data); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of ApiResponse (VirtoCommerceInventoryModuleWebModelInventoryInfo)</returns> public async System.Threading.Tasks.Task <ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo> > InventoryModuleUpsertProductInventoryAsyncWithHttpInfo(VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { // verify the required parameter 'inventory' is set if (inventory == null) { throw new ApiException(400, "Missing required parameter 'inventory' when calling InventoryModuleApi->InventoryModuleUpsertProductInventory"); } // verify the required parameter 'productId' is set if (productId == null) { throw new ApiException(400, "Missing required parameter 'productId' when calling InventoryModuleApi->InventoryModuleUpsertProductInventory"); } var localVarPath = "/api/inventory/products/{productId}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <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", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (productId != null) { localVarPathParams.Add("productId", Configuration.ApiClient.ParameterToString(productId)); // path parameter } if (inventory.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(inventory); // http body (model) parameter } else { localVarPostBody = inventory; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (localVarStatusCode >= 400 && (localVarStatusCode != 404 || Configuration.ThrowExceptionWhenStatusCodeIs404)) { throw new ApiException(localVarStatusCode, "Error calling InventoryModuleUpsertProductInventory: " + localVarResponse.Content, localVarResponse.Content); } else if (localVarStatusCode == 0) { throw new ApiException(localVarStatusCode, "Error calling InventoryModuleUpsertProductInventory: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); } return(new ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceInventoryModuleWebModelInventoryInfo)Configuration.ApiClient.Deserialize(localVarResponse, typeof(VirtoCommerceInventoryModuleWebModelInventoryInfo)))); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of ApiResponse (VirtoCommerceInventoryModuleWebModelInventoryInfo)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo>> InventoryModuleUpsertProductInventoryAsyncWithHttpInfo (VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { // verify the required parameter 'inventory' is set if (inventory == null) throw new ApiException(400, "Missing required parameter 'inventory' when calling InventoryModuleUpsertProductInventory"); // verify the required parameter 'productId' is set if (productId == null) throw new ApiException(400, "Missing required parameter 'productId' when calling InventoryModuleUpsertProductInventory"); var path_ = "/api/inventory/products/{productId}"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { "application/json", "text/json" }; String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts)); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (productId != null) pathParams.Add("productId", Configuration.ApiClient.ParameterToString(productId)); // path parameter postBody = Configuration.ApiClient.Serialize(inventory); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling InventoryModuleUpsertProductInventory: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling InventoryModuleUpsertProductInventory: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceInventoryModuleWebModelInventoryInfo) Configuration.ApiClient.Deserialize(response, typeof(VirtoCommerceInventoryModuleWebModelInventoryInfo))); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>VirtoCommerceInventoryModuleWebModelInventoryInfo</returns> public VirtoCommerceInventoryModuleWebModelInventoryInfo InventoryModuleUpsertProductInventory(VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo> localVarResponse = InventoryModuleUpsertProductInventoryWithHttpInfo(inventory, productId); return(localVarResponse.Data); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of VirtoCommerceInventoryModuleWebModelInventoryInfo</returns> public async System.Threading.Tasks.Task<VirtoCommerceInventoryModuleWebModelInventoryInfo> InventoryModuleUpsertProductInventoryAsync (VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo> response = await InventoryModuleUpsertProductInventoryAsyncWithHttpInfo(inventory, productId); return response.Data; }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>VirtoCommerceInventoryModuleWebModelInventoryInfo</returns> public VirtoCommerceInventoryModuleWebModelInventoryInfo InventoryModuleUpsertProductInventory (VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo> response = InventoryModuleUpsertProductInventoryWithHttpInfo(inventory, productId); return response.Data; }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>VirtoCommerceInventoryModuleWebModelInventoryInfo</returns> public async System.Threading.Tasks.Task <VirtoCommerceInventoryModuleWebModelInventoryInfo> InventoryModuleUpsertProductInventoryAsync(VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { // verify the required parameter 'inventory' is set if (inventory == null) { throw new ApiException(400, "Missing required parameter 'inventory' when calling InventoryModuleUpsertProductInventory"); } // verify the required parameter 'productId' is set if (productId == null) { throw new ApiException(400, "Missing required parameter 'productId' when calling InventoryModuleUpsertProductInventory"); } var path = "/api/inventory/products/{productId}"; var pathParams = new Dictionary <String, String>(); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { "application/json", "text/json" }; String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) { headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts)); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (productId != null) { pathParams.Add("productId", ApiClient.ParameterToString(productId)); // path parameter } postBody = ApiClient.Serialize(inventory); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; // make the HTTP request IRestResponse response = (IRestResponse)await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling InventoryModuleUpsertProductInventory: " + response.Content, response.Content); } return((VirtoCommerceInventoryModuleWebModelInventoryInfo)ApiClient.Deserialize(response.Content, typeof(VirtoCommerceInventoryModuleWebModelInventoryInfo), response.Headers)); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of ApiResponse (VirtoCommerceInventoryModuleWebModelInventoryInfo)</returns> public async System.Threading.Tasks.Task <ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo> > InventoryModuleUpsertProductInventoryAsyncWithHttpInfo(VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { // verify the required parameter 'inventory' is set if (inventory == null) { throw new ApiException(400, "Missing required parameter 'inventory' when calling InventoryModuleUpsertProductInventory"); } // verify the required parameter 'productId' is set if (productId == null) { throw new ApiException(400, "Missing required parameter 'productId' when calling InventoryModuleUpsertProductInventory"); } var path_ = "/api/inventory/products/{productId}"; var pathParams = new Dictionary <String, String>(); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(Configuration.DefaultHeader); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); Object postBody = null; // to determine the Content-Type header String[] httpContentTypes = new String[] { "application/json", "text/json", "application/x-www-form-urlencoded" }; String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes); // to determine the Accept header String[] httpHeaderAccepts = new String[] { "application/json", "text/json" }; String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts); if (httpHeaderAccept != null) { headerParams.Add("Accept", httpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (productId != null) { pathParams.Add("productId", Configuration.ApiClient.ParameterToString(productId)); // path parameter } postBody = Configuration.ApiClient.Serialize(inventory); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse)await Configuration.ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int)response.StatusCode; if (statusCode >= 400) { throw new ApiException(statusCode, "Error calling InventoryModuleUpsertProductInventory: " + response.Content, response.Content); } else if (statusCode == 0) { throw new ApiException(statusCode, "Error calling InventoryModuleUpsertProductInventory: " + response.ErrorMessage, response.ErrorMessage); } return(new ApiResponse <VirtoCommerceInventoryModuleWebModelInventoryInfo>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceInventoryModuleWebModelInventoryInfo)Configuration.ApiClient.Deserialize(response, typeof(VirtoCommerceInventoryModuleWebModelInventoryInfo)))); }
/// <summary> /// Upsert inventory Upsert (add or update) given inventory of product. /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="inventory">Inventory to upsert</param> /// <param name="productId"></param> /// <returns>Task of ApiResponse (VirtoCommerceInventoryModuleWebModelInventoryInfo)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo>> InventoryModuleUpsertProductInventoryAsyncWithHttpInfo (VirtoCommerceInventoryModuleWebModelInventoryInfo inventory, string productId) { // verify the required parameter 'inventory' is set if (inventory == null) throw new ApiException(400, "Missing required parameter 'inventory' when calling InventoryModuleApi->InventoryModuleUpsertProductInventory"); // verify the required parameter 'productId' is set if (productId == null) throw new ApiException(400, "Missing required parameter 'productId' when calling InventoryModuleApi->InventoryModuleUpsertProductInventory"); var localVarPath = "/api/inventory/products/{productId}"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new Dictionary<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", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (productId != null) localVarPathParams.Add("productId", Configuration.ApiClient.ParameterToString(productId)); // path parameter if (inventory.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(inventory); // http body (model) parameter } else { localVarPostBody = inventory; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (localVarStatusCode >= 400 && (localVarStatusCode != 404 || Configuration.ThrowExceptionWhenStatusCodeIs404)) throw new ApiException (localVarStatusCode, "Error calling InventoryModuleUpsertProductInventory: " + localVarResponse.Content, localVarResponse.Content); else if (localVarStatusCode == 0) throw new ApiException (localVarStatusCode, "Error calling InventoryModuleUpsertProductInventory: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); return new ApiResponse<VirtoCommerceInventoryModuleWebModelInventoryInfo>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceInventoryModuleWebModelInventoryInfo) Configuration.ApiClient.Deserialize(localVarResponse, typeof(VirtoCommerceInventoryModuleWebModelInventoryInfo))); }