dev.crashteam.openapi.uzumanalytics.api.ProductApi Maven / Gradle / Ivy
package dev.crashteam.openapi.uzumanalytics.api;
import dev.crashteam.openapi.uzumanalytics.ApiClient;
import dev.crashteam.openapi.uzumanalytics.model.Error;
import dev.crashteam.openapi.uzumanalytics.model.GetProductSales200ResponseInner;
import dev.crashteam.openapi.uzumanalytics.model.GetSellerShops400Response;
import java.time.OffsetDateTime;
import dev.crashteam.openapi.uzumanalytics.model.ProductOverallInfo200Response;
import dev.crashteam.openapi.uzumanalytics.model.ProductSkuHistory;
import java.util.UUID;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-21T16:53:18.489277710Z[Etc/UTC]")
public class ProductApi {
private ApiClient apiClient;
public ProductApi() {
this(new ApiClient());
}
public ProductApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Получить информацию по продажам товаров
*
* 200 - Информация по продажам товаров
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productIds List of product id (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @return List<GetProductSales200ResponseInner>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List getProductSales(UUID xRequestID, String X_API_KEY, List productIds, OffsetDateTime fromTime, OffsetDateTime toTime) throws RestClientException {
return getProductSalesWithHttpInfo(xRequestID, X_API_KEY, productIds, fromTime, toTime).getBody();
}
/**
* Получить информацию по продажам товаров
*
* 200 - Информация по продажам товаров
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productIds List of product id (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @return ResponseEntity<List<GetProductSales200ResponseInner>>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity> getProductSalesWithHttpInfo(UUID xRequestID, String X_API_KEY, List productIds, OffsetDateTime fromTime, OffsetDateTime toTime) throws RestClientException {
Object localVarPostBody = null;
// verify the required parameter 'xRequestID' is set
if (xRequestID == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xRequestID' when calling getProductSales");
}
// verify the required parameter 'X_API_KEY' is set
if (X_API_KEY == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'X_API_KEY' when calling getProductSales");
}
// verify the required parameter 'productIds' is set
if (productIds == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'productIds' when calling getProductSales");
}
// verify the required parameter 'fromTime' is set
if (fromTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fromTime' when calling getProductSales");
}
// verify the required parameter 'toTime' is set
if (toTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'toTime' when calling getProductSales");
}
final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap localVarCookieParams = new LinkedMultiValueMap();
final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("multi".toUpperCase(Locale.ROOT)), "productIds", productIds));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "fromTime", fromTime));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "toTime", toTime));
if (xRequestID != null)
localVarHeaderParams.add("X-Request-ID", apiClient.parameterToString(xRequestID));
if (X_API_KEY != null)
localVarHeaderParams.add("X-API-KEY", apiClient.parameterToString(X_API_KEY));
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "apiKey" };
ParameterizedTypeReference> localReturnType = new ParameterizedTypeReference>() {};
return apiClient.invokeAPI("/product/sales", HttpMethod.GET, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
* Общая информация по продукту
*
* 200 - Получены общие аналитические данные по товару
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
*
404 - Данные по продукту не найдены
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productId (required)
* @param skuId (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @return ProductOverallInfo200Response
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ProductOverallInfo200Response productOverallInfo(UUID xRequestID, String X_API_KEY, Long productId, Long skuId, OffsetDateTime fromTime, OffsetDateTime toTime) throws RestClientException {
return productOverallInfoWithHttpInfo(xRequestID, X_API_KEY, productId, skuId, fromTime, toTime).getBody();
}
/**
* Общая информация по продукту
*
*
200 - Получены общие аналитические данные по товару
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
*
404 - Данные по продукту не найдены
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productId (required)
* @param skuId (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @return ResponseEntity<ProductOverallInfo200Response>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity productOverallInfoWithHttpInfo(UUID xRequestID, String X_API_KEY, Long productId, Long skuId, OffsetDateTime fromTime, OffsetDateTime toTime) throws RestClientException {
Object localVarPostBody = null;
// verify the required parameter 'xRequestID' is set
if (xRequestID == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xRequestID' when calling productOverallInfo");
}
// verify the required parameter 'X_API_KEY' is set
if (X_API_KEY == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'X_API_KEY' when calling productOverallInfo");
}
// verify the required parameter 'productId' is set
if (productId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'productId' when calling productOverallInfo");
}
// verify the required parameter 'skuId' is set
if (skuId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'skuId' when calling productOverallInfo");
}
// verify the required parameter 'fromTime' is set
if (fromTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fromTime' when calling productOverallInfo");
}
// verify the required parameter 'toTime' is set
if (toTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'toTime' when calling productOverallInfo");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("productId", productId);
uriVariables.put("skuId", skuId);
final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap localVarCookieParams = new LinkedMultiValueMap();
final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "fromTime", fromTime));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "toTime", toTime));
if (xRequestID != null)
localVarHeaderParams.add("X-Request-ID", apiClient.parameterToString(xRequestID));
if (X_API_KEY != null)
localVarHeaderParams.add("X-API-KEY", apiClient.parameterToString(X_API_KEY));
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "apiKey" };
ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/product/{productId}/sku/{skuId}/additional-info", HttpMethod.GET, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
* Получить историю товара
*
* 200 - Получена история изменения товара
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
*
404 - История товара не найдена
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productId (required)
* @param skuId (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @param limit The collection items limit. (optional)
* @param offset The collection items offset. (optional)
* @return List<ProductSkuHistory>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List productSkuHistory(UUID xRequestID, String X_API_KEY, Long productId, Long skuId, OffsetDateTime fromTime, OffsetDateTime toTime, Integer limit, Integer offset) throws RestClientException {
return productSkuHistoryWithHttpInfo(xRequestID, X_API_KEY, productId, skuId, fromTime, toTime, limit, offset).getBody();
}
/**
* Получить историю товара
*
* 200 - Получена история изменения товара
*
400 - Переданы ошибочные данные
*
401 - Несанкционированный доступ, использовались неверные учетные данные.
*
403 - Access forbidden.
*
404 - История товара не найдена
* @param xRequestID Уникальный идентификатор запроса к системе (required)
* @param X_API_KEY Уникальный токен пользователя расширения (required)
* @param productId (required)
* @param skuId (required)
* @param fromTime Start date time. (required)
* @param toTime End date time. (required)
* @param limit The collection items limit. (optional)
* @param offset The collection items offset. (optional)
* @return ResponseEntity<List<ProductSkuHistory>>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity> productSkuHistoryWithHttpInfo(UUID xRequestID, String X_API_KEY, Long productId, Long skuId, OffsetDateTime fromTime, OffsetDateTime toTime, Integer limit, Integer offset) throws RestClientException {
Object localVarPostBody = null;
// verify the required parameter 'xRequestID' is set
if (xRequestID == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xRequestID' when calling productSkuHistory");
}
// verify the required parameter 'X_API_KEY' is set
if (X_API_KEY == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'X_API_KEY' when calling productSkuHistory");
}
// verify the required parameter 'productId' is set
if (productId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'productId' when calling productSkuHistory");
}
// verify the required parameter 'skuId' is set
if (skuId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'skuId' when calling productSkuHistory");
}
// verify the required parameter 'fromTime' is set
if (fromTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fromTime' when calling productSkuHistory");
}
// verify the required parameter 'toTime' is set
if (toTime == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'toTime' when calling productSkuHistory");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("productId", productId);
uriVariables.put("skuId", skuId);
final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap localVarCookieParams = new LinkedMultiValueMap();
final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "fromTime", fromTime));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "toTime", toTime));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "limit", limit));
localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "offset", offset));
if (xRequestID != null)
localVarHeaderParams.add("X-Request-ID", apiClient.parameterToString(xRequestID));
if (X_API_KEY != null)
localVarHeaderParams.add("X-API-KEY", apiClient.parameterToString(X_API_KEY));
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "apiKey" };
ParameterizedTypeReference> localReturnType = new ParameterizedTypeReference>() {};
return apiClient.invokeAPI("/product/{productId}/sku/{skuId}/sales", HttpMethod.GET, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
}