/// <summary> /// Partialy update the product. /// </summary> /// <param name="ProductId"></param>/// <param name="Body"></param> /// <returns>ProductResource</returns> public async Task<ProductResource> PatchProductAsync (string ProductId, ProductResource Body) { // verify the required parameter 'ProductId' is set if (ProductId == null) throw new ApiException(400, "Missing required parameter 'ProductId' when calling PatchProduct"); var path = "/products/{productId}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "productId" + "}", apiClient.ParameterToString(ProductId)); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, String>(); String postBody = null; postBody = apiClient.Serialize(Body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "client_id", "access_token" }; // make the HTTP request IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.PATCH, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException ((int)response.StatusCode, "Error calling PatchProduct: " + response.Content, response.Content); } return (ProductResource) apiClient.Deserialize(response.Content, typeof(ProductResource)); }
/// <summary> /// Create a new product. /// </summary> /// <param name="Body"></param> /// <returns>ProductResource</returns> public async Task<ProductResource> SaveProductAsync (ProductResource Body) { var path = "/products"; path = path.Replace("{format}", "json"); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, String>(); String postBody = null; postBody = apiClient.Serialize(Body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "client_id", "access_token" }; // make the HTTP request IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException ((int)response.StatusCode, "Error calling SaveProduct: " + response.Content, response.Content); } return (ProductResource) apiClient.Deserialize(response.Content, typeof(ProductResource)); }