All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.conekta.ProductsApi Maven / Gradle / Ivy

Go to download

This is a java library that allows interaction with https://api.conekta.io API.

The newest version!
package com.conekta;

import com.conekta.ApiException;
import com.conekta.ApiClient;
import com.conekta.ApiResponse;
import com.conekta.Configuration;
import com.conekta.Pair;

import javax.ws.rs.core.GenericType;

import com.conekta.model.Error;
import com.conekta.model.Product;
import com.conekta.model.ProductOrderResponse;
import com.conekta.model.UpdateProduct;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0")
public class ProductsApi {
  private ApiClient apiClient;

  public ProductsApi() {
    this(Configuration.getDefaultApiClient());
  }

  public ProductsApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Get the API client
   *
   * @return API client
   */
  public ApiClient getApiClient() {
    return apiClient;
  }

  /**
   * Set the API client
   *
   * @param apiClient an instance of API client
   */
  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Create Product
   * Create a new product for an existing order.
   * @param id Identifier of the resource (required)
   * @param product requested field for a product (required)
   * @param acceptLanguage Use for knowing which language to use (optional, default to es)
   * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
   * @return ProductOrderResponse
   * @throws ApiException if fails to make API call
   * @http.response.details
     
Status Code Description Response Headers
200 successful -
401 authentication error -
404 not found entity -
500 internal server error -
*/ public ProductOrderResponse ordersCreateProduct(String id, Product product, String acceptLanguage, String xChildCompanyId) throws ApiException { return ordersCreateProductWithHttpInfo(id, product, acceptLanguage, xChildCompanyId).getData(); } /** * Create Product * Create a new product for an existing order. * @param id Identifier of the resource (required) * @param product requested field for a product (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional) * @return ApiResponse<ProductOrderResponse> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
404 not found entity -
500 internal server error -
*/ public ApiResponse ordersCreateProductWithHttpInfo(String id, Product product, String acceptLanguage, String xChildCompanyId) throws ApiException { // Check required parameters if (id == null) { throw new ApiException(400, "Missing the required parameter 'id' when calling ordersCreateProduct"); } if (product == null) { throw new ApiException(400, "Missing the required parameter 'product' when calling ordersCreateProduct"); } // Path parameters String localVarPath = "/orders/{id}/line_items" .replaceAll("\\{id}", apiClient.escapeString(id)); // Header parameters Map localVarHeaderParams = new LinkedHashMap<>(); if (acceptLanguage != null) { localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); } if (xChildCompanyId != null) { localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId)); } String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); String[] localVarAuthNames = new String[] {"bearerAuth"}; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("ProductsApi.ordersCreateProduct", localVarPath, "POST", new ArrayList<>(), product, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType, false); } /** * Delete Product * Delete product for an existing orden * @param id Identifier of the resource (required) * @param lineItemId identifier (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional) * @return ProductOrderResponse * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
422 parameter validation error -
404 not found entity -
500 internal server error -
*/ public ProductOrderResponse ordersDeleteProduct(String id, String lineItemId, String acceptLanguage, String xChildCompanyId) throws ApiException { return ordersDeleteProductWithHttpInfo(id, lineItemId, acceptLanguage, xChildCompanyId).getData(); } /** * Delete Product * Delete product for an existing orden * @param id Identifier of the resource (required) * @param lineItemId identifier (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional) * @return ApiResponse<ProductOrderResponse> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
422 parameter validation error -
404 not found entity -
500 internal server error -
*/ public ApiResponse ordersDeleteProductWithHttpInfo(String id, String lineItemId, String acceptLanguage, String xChildCompanyId) throws ApiException { // Check required parameters if (id == null) { throw new ApiException(400, "Missing the required parameter 'id' when calling ordersDeleteProduct"); } if (lineItemId == null) { throw new ApiException(400, "Missing the required parameter 'lineItemId' when calling ordersDeleteProduct"); } // Path parameters String localVarPath = "/orders/{id}/line_items/{line_item_id}" .replaceAll("\\{id}", apiClient.escapeString(id)) .replaceAll("\\{line_item_id}", apiClient.escapeString(lineItemId)); // Header parameters Map localVarHeaderParams = new LinkedHashMap<>(); if (acceptLanguage != null) { localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); } if (xChildCompanyId != null) { localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId)); } String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json"); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"bearerAuth"}; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("ProductsApi.ordersDeleteProduct", localVarPath, "DELETE", new ArrayList<>(), null, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType, false); } /** * Update Product * Update an existing product for an existing orden * @param id Identifier of the resource (required) * @param lineItemId identifier (required) * @param updateProduct requested field for products (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional) * @return ProductOrderResponse * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
422 parameter validation error -
404 not found entity -
500 internal server error -
*/ public ProductOrderResponse ordersUpdateProduct(String id, String lineItemId, UpdateProduct updateProduct, String acceptLanguage, String xChildCompanyId) throws ApiException { return ordersUpdateProductWithHttpInfo(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId).getData(); } /** * Update Product * Update an existing product for an existing orden * @param id Identifier of the resource (required) * @param lineItemId identifier (required) * @param updateProduct requested field for products (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional) * @return ApiResponse<ProductOrderResponse> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
422 parameter validation error -
404 not found entity -
500 internal server error -
*/ public ApiResponse ordersUpdateProductWithHttpInfo(String id, String lineItemId, UpdateProduct updateProduct, String acceptLanguage, String xChildCompanyId) throws ApiException { // Check required parameters if (id == null) { throw new ApiException(400, "Missing the required parameter 'id' when calling ordersUpdateProduct"); } if (lineItemId == null) { throw new ApiException(400, "Missing the required parameter 'lineItemId' when calling ordersUpdateProduct"); } if (updateProduct == null) { throw new ApiException(400, "Missing the required parameter 'updateProduct' when calling ordersUpdateProduct"); } // Path parameters String localVarPath = "/orders/{id}/line_items/{line_item_id}" .replaceAll("\\{id}", apiClient.escapeString(id)) .replaceAll("\\{line_item_id}", apiClient.escapeString(lineItemId)); // Header parameters Map localVarHeaderParams = new LinkedHashMap<>(); if (acceptLanguage != null) { localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); } if (xChildCompanyId != null) { localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId)); } String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); String[] localVarAuthNames = new String[] {"bearerAuth"}; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("ProductsApi.ordersUpdateProduct", localVarPath, "PUT", new ArrayList<>(), updateProduct, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType, false); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy