diff --git a/.spec-sha256 b/.spec-sha256 index fa982ec..aa855c8 100644 --- a/.spec-sha256 +++ b/.spec-sha256 @@ -1 +1 @@ -41311cb64247613fcc1634a63a1804e344c71873d665fc58af33e053a5f919f1 +15321a7caa009c61dd09fb6412b8f44544953a2a90355f1afc081dc79d784900 diff --git a/README.md b/README.md index ee2c368..872109f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ for (Item item : client.items().listAll(null, false, null)) { for (Order order : client.orders().listAll(null, "to_send", null, null, null, null)) { System.out.println(order.getId()); // needs the orders:read scope; also orders().get(id), orders().labels(id) } +for (CatalogBrand brand : client.catalogs().brandsAll(null, "nik")) { + System.out.println(brand.getId() + " " + brand.getName()); // the identifiers an item is written with (items:read): categories, category, categoryFields, brands, sizes, colors, conditions, packageSizes, materials +} // Writes (API key with items:write / conversations:write); the last argument, optional, is the Idempotency-Key. client.items().create(new ItemCreateRequest().name("Jacket")); // items().update(42, new ItemUpdateRequest()...) patches diff --git a/src/main/java/com/controlresell/sdk/ControlResell.java b/src/main/java/com/controlresell/sdk/ControlResell.java index 901b5fb..17f231a 100644 --- a/src/main/java/com/controlresell/sdk/ControlResell.java +++ b/src/main/java/com/controlresell/sdk/ControlResell.java @@ -3,6 +3,7 @@ import com.controlresell.sdk.generated.ApiClient; import com.controlresell.sdk.generated.ApiException; import com.controlresell.sdk.generated.api.AccountsApi; +import com.controlresell.sdk.generated.api.CatalogsApi; import com.controlresell.sdk.generated.api.ConversationsApi; import com.controlresell.sdk.generated.api.CustomersApi; import com.controlresell.sdk.generated.api.ItemsApi; @@ -10,6 +11,15 @@ import com.controlresell.sdk.generated.api.OrdersApi; import com.controlresell.sdk.generated.model.Account; import com.controlresell.sdk.generated.model.AccountPage; +import com.controlresell.sdk.generated.model.CatalogBrand; +import com.controlresell.sdk.generated.model.CatalogBrandPage; +import com.controlresell.sdk.generated.model.CatalogCategory; +import com.controlresell.sdk.generated.model.CatalogCategoryFields; +import com.controlresell.sdk.generated.model.CatalogCategoryPage; +import com.controlresell.sdk.generated.model.CatalogSize; +import com.controlresell.sdk.generated.model.CatalogSizePage; +import com.controlresell.sdk.generated.model.CatalogValue; +import com.controlresell.sdk.generated.model.CatalogValuePage; import com.controlresell.sdk.generated.model.Conversation; import com.controlresell.sdk.generated.model.ConversationPage; import com.controlresell.sdk.generated.model.Customer; @@ -149,6 +159,9 @@ public T call(boolean write, HttpCall call) { /** The other parties of the seller's sales and purchases (needs the {@code customers:read} scope). */ public Customers customers() { return new Customers(); } + /** The catalog an item is written with: categories, brands, sizes, colors... (needs the {@code items:read} scope). */ + public Catalogs catalogs() { return new Catalogs(); } + /** The seller the API key acts for. */ public final class MeResource { private final MeApi api = new MeApi(apiClient); @@ -365,6 +378,89 @@ public Iterable listAll(Integer limit, UUID accountId, OffsetDateTime } } + /** The catalog an item is written with. Every list argument may be {@code null}; {@code categoryId} keeps what applies to one category. */ + public final class Catalogs { + private final CatalogsApi api = new CatalogsApi(apiClient); + + private Catalogs() {} + + /** One page of categories, flat, by identifier; {@code parentId} keeps the children of one, {@code platform} one marketplace. */ + public CatalogCategoryPage categories(Integer limit, String cursor, Long parentId, String platform) { + return call(false, h -> api.listCatalogCategories(limit, cursor, parentId, platform, h)); + } + + /** Every category, page after page, with the same filters. */ + public Iterable categoriesAll(Integer limit, Long parentId, String platform) { + return new Paginator<>(cursor -> categories(limit, cursor, parentId, platform), + p -> page(p.getData(), p.getNextCursor())); + } + + public CatalogCategory category(long id) { return call(false, h -> api.getCatalogCategory(id, h)); } + + /** What an item of a category is filled with: its size groups, enumerated and text fields, measurements. */ + public CatalogCategoryFields categoryFields(long id) { return call(false, h -> api.getCatalogCategoryFields(id, h)); } + + /** One page of brands, by identifier or, with {@code q}, those whose name starts with it. */ + public CatalogBrandPage brands(Integer limit, String cursor, String q) { + return call(false, h -> api.listCatalogBrands(limit, cursor, q, h)); + } + + /** Every brand, page after page, with the same filters. */ + public Iterable brandsAll(Integer limit, String q) { + return new Paginator<>(cursor -> brands(limit, cursor, q), p -> page(p.getData(), p.getNextCursor())); + } + + /** One page of sizes, each with its size group. */ + public CatalogSizePage sizes(Integer limit, String cursor, Long categoryId) { + return call(false, h -> api.listCatalogSizes(limit, cursor, categoryId, h)); + } + + /** Every size, page after page, with the same filters. */ + public Iterable sizesAll(Integer limit, Long categoryId) { + return new Paginator<>(cursor -> sizes(limit, cursor, categoryId), p -> page(p.getData(), p.getNextCursor())); + } + + /** One page of colors. */ + public CatalogValuePage colors(Integer limit, String cursor, Long categoryId) { + return call(false, h -> api.listCatalogColors(limit, cursor, categoryId, h)); + } + + /** Every one of the colors, page after page, with the same filters. */ + public Iterable colorsAll(Integer limit, Long categoryId) { + return new Paginator<>(cursor -> colors(limit, cursor, categoryId), p -> page(p.getData(), p.getNextCursor())); + } + + /** One page of conditions. */ + public CatalogValuePage conditions(Integer limit, String cursor, Long categoryId) { + return call(false, h -> api.listCatalogConditions(limit, cursor, categoryId, h)); + } + + /** Every one of the conditions, page after page, with the same filters. */ + public Iterable conditionsAll(Integer limit, Long categoryId) { + return new Paginator<>(cursor -> conditions(limit, cursor, categoryId), p -> page(p.getData(), p.getNextCursor())); + } + + /** One page of package sizes. */ + public CatalogValuePage packageSizes(Integer limit, String cursor, Long categoryId) { + return call(false, h -> api.listCatalogPackageSizes(limit, cursor, categoryId, h)); + } + + /** Every one of the package sizes, page after page, with the same filters. */ + public Iterable packageSizesAll(Integer limit, Long categoryId) { + return new Paginator<>(cursor -> packageSizes(limit, cursor, categoryId), p -> page(p.getData(), p.getNextCursor())); + } + + /** One page of materials. */ + public CatalogValuePage materials(Integer limit, String cursor, Long categoryId) { + return call(false, h -> api.listCatalogMaterials(limit, cursor, categoryId, h)); + } + + /** Every one of the materials, page after page, with the same filters. */ + public Iterable materialsAll(Integer limit, Long categoryId) { + return new Paginator<>(cursor -> materials(limit, cursor, categoryId), p -> page(p.getData(), p.getNextCursor())); + } + } + /** * The {@code Idempotency-Key} of a write: the caller's, else a random one. It is chosen once, outside the retries, so * every attempt of the call sends the same key (the typed methods take the key as an argument, not through the retrier). diff --git a/src/main/java/com/controlresell/sdk/generated/api/CatalogsApi.java b/src/main/java/com/controlresell/sdk/generated/api/CatalogsApi.java new file mode 100644 index 0000000..706e35c --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/api/CatalogsApi.java @@ -0,0 +1,1393 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.controlresell.sdk.generated.api; + +import com.controlresell.sdk.generated.ApiClient; +import com.controlresell.sdk.generated.ApiException; +import com.controlresell.sdk.generated.ApiResponse; +import com.controlresell.sdk.generated.Configuration; +import com.controlresell.sdk.generated.Pair; + +import com.controlresell.sdk.generated.model.CatalogBrandPage; +import com.controlresell.sdk.generated.model.CatalogCategory; +import com.controlresell.sdk.generated.model.CatalogCategoryFields; +import com.controlresell.sdk.generated.model.CatalogCategoryPage; +import com.controlresell.sdk.generated.model.CatalogSizePage; +import com.controlresell.sdk.generated.model.CatalogValuePage; +import com.controlresell.sdk.generated.model.ErrorResponse; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogsApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public CatalogsApi() { + this(Configuration.getDefaultApiClient()); + } + + public CatalogsApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + try { + body = responseBody == null ? null : new String(responseBody.readAllBytes()); + } finally { + if (responseBody != null) { + responseBody.close(); + } + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * Read one category + * One category of the catalog, by its identifier. Requires `items:read`. + * @param id The category's identifier. (required) + * @return CatalogCategory + * @throws ApiException if fails to make API call + */ + public CatalogCategory getCatalogCategory(@jakarta.annotation.Nonnull Long id) throws ApiException { + return getCatalogCategory(id, null); + } + + /** + * Read one category + * One category of the catalog, by its identifier. Requires `items:read`. + * @param id The category's identifier. (required) + * @param headers Optional headers to include in the request + * @return CatalogCategory + * @throws ApiException if fails to make API call + */ + public CatalogCategory getCatalogCategory(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + ApiResponse localVarResponse = getCatalogCategoryWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * Read one category + * One category of the catalog, by its identifier. Requires `items:read`. + * @param id The category's identifier. (required) + * @return ApiResponse<CatalogCategory> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCatalogCategoryWithHttpInfo(@jakarta.annotation.Nonnull Long id) throws ApiException { + return getCatalogCategoryWithHttpInfo(id, null); + } + + /** + * Read one category + * One category of the catalog, by its identifier. Requires `items:read`. + * @param id The category's identifier. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogCategory> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCatalogCategoryWithHttpInfo(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getCatalogCategoryRequestBuilder(id, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getCatalogCategory", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogCategory responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getCatalogCategoryRequestBuilder(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling getCatalogCategory"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/categories/{id}" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Read what an item of a category is filled with + * Everything an item of this category takes beyond its common fields: its size groups (`sizeId`), its enumerated fields with their values, each naming the item field it is written in (`colorIds`, `materialIds`, `state`, `packageSizeId`, or an `enumValues` entry `{\"enumKey\": field.key, \"enumValue\": value.key}`), its free-text fields (`attributes`, with whether a marketplace requires them) and the measurements. A field used on one marketplace only names it in `platform`. Requires `items:read`. + * @param id The category's identifier. (required) + * @return CatalogCategoryFields + * @throws ApiException if fails to make API call + */ + public CatalogCategoryFields getCatalogCategoryFields(@jakarta.annotation.Nonnull Long id) throws ApiException { + return getCatalogCategoryFields(id, null); + } + + /** + * Read what an item of a category is filled with + * Everything an item of this category takes beyond its common fields: its size groups (`sizeId`), its enumerated fields with their values, each naming the item field it is written in (`colorIds`, `materialIds`, `state`, `packageSizeId`, or an `enumValues` entry `{\"enumKey\": field.key, \"enumValue\": value.key}`), its free-text fields (`attributes`, with whether a marketplace requires them) and the measurements. A field used on one marketplace only names it in `platform`. Requires `items:read`. + * @param id The category's identifier. (required) + * @param headers Optional headers to include in the request + * @return CatalogCategoryFields + * @throws ApiException if fails to make API call + */ + public CatalogCategoryFields getCatalogCategoryFields(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + ApiResponse localVarResponse = getCatalogCategoryFieldsWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * Read what an item of a category is filled with + * Everything an item of this category takes beyond its common fields: its size groups (`sizeId`), its enumerated fields with their values, each naming the item field it is written in (`colorIds`, `materialIds`, `state`, `packageSizeId`, or an `enumValues` entry `{\"enumKey\": field.key, \"enumValue\": value.key}`), its free-text fields (`attributes`, with whether a marketplace requires them) and the measurements. A field used on one marketplace only names it in `platform`. Requires `items:read`. + * @param id The category's identifier. (required) + * @return ApiResponse<CatalogCategoryFields> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCatalogCategoryFieldsWithHttpInfo(@jakarta.annotation.Nonnull Long id) throws ApiException { + return getCatalogCategoryFieldsWithHttpInfo(id, null); + } + + /** + * Read what an item of a category is filled with + * Everything an item of this category takes beyond its common fields: its size groups (`sizeId`), its enumerated fields with their values, each naming the item field it is written in (`colorIds`, `materialIds`, `state`, `packageSizeId`, or an `enumValues` entry `{\"enumKey\": field.key, \"enumValue\": value.key}`), its free-text fields (`attributes`, with whether a marketplace requires them) and the measurements. A field used on one marketplace only names it in `platform`. Requires `items:read`. + * @param id The category's identifier. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogCategoryFields> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCatalogCategoryFieldsWithHttpInfo(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getCatalogCategoryFieldsRequestBuilder(id, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("getCatalogCategoryFields", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogCategoryFields responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder getCatalogCategoryFieldsRequestBuilder(@jakarta.annotation.Nonnull Long id, Map headers) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling getCatalogCategoryFields"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/categories/{id}/fields" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the brands + * The brands an item's `brandId` takes: the global ones and the seller's own (`custom`), by identifier, or with `q` the brands whose name starts with it, by name (case and accents ignored). Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param q Only the brands whose name starts with this text, 1 to 100 characters. (optional) + * @return CatalogBrandPage + * @throws ApiException if fails to make API call + */ + public CatalogBrandPage listCatalogBrands(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable String q) throws ApiException { + return listCatalogBrands(limit, cursor, q, null); + } + + /** + * List the brands + * The brands an item's `brandId` takes: the global ones and the seller's own (`custom`), by identifier, or with `q` the brands whose name starts with it, by name (case and accents ignored). Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param q Only the brands whose name starts with this text, 1 to 100 characters. (optional) + * @param headers Optional headers to include in the request + * @return CatalogBrandPage + * @throws ApiException if fails to make API call + */ + public CatalogBrandPage listCatalogBrands(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable String q, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogBrandsWithHttpInfo(limit, cursor, q, headers); + return localVarResponse.getData(); + } + + /** + * List the brands + * The brands an item's `brandId` takes: the global ones and the seller's own (`custom`), by identifier, or with `q` the brands whose name starts with it, by name (case and accents ignored). Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param q Only the brands whose name starts with this text, 1 to 100 characters. (optional) + * @return ApiResponse<CatalogBrandPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogBrandsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable String q) throws ApiException { + return listCatalogBrandsWithHttpInfo(limit, cursor, q, null); + } + + /** + * List the brands + * The brands an item's `brandId` takes: the global ones and the seller's own (`custom`), by identifier, or with `q` the brands whose name starts with it, by name (case and accents ignored). Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param q Only the brands whose name starts with this text, 1 to 100 characters. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogBrandPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogBrandsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable String q, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogBrandsRequestBuilder(limit, cursor, q, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogBrands", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogBrandPage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogBrandsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable String q, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/brands"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "q"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("q", q)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the catalog's categories + * The categories an item's `categoryId` takes, flat, by identifier; each names its parent, so the tree is rebuilt from the pages (or read level by level with `parentId`). One catalog for every marketplace: `platforms` names where the category already has a mapping. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param parentId Only the direct children of this category. (optional) + * @param platform The categories that already have a mapping on this marketplace (VINTED, EBAY…), and their ancestors so the tree rebuilds; `platforms` names the marketplaces where each category already has a mapping. (optional) + * @return CatalogCategoryPage + * @throws ApiException if fails to make API call + */ + public CatalogCategoryPage listCatalogCategories(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long parentId, @jakarta.annotation.Nullable String platform) throws ApiException { + return listCatalogCategories(limit, cursor, parentId, platform, null); + } + + /** + * List the catalog's categories + * The categories an item's `categoryId` takes, flat, by identifier; each names its parent, so the tree is rebuilt from the pages (or read level by level with `parentId`). One catalog for every marketplace: `platforms` names where the category already has a mapping. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param parentId Only the direct children of this category. (optional) + * @param platform The categories that already have a mapping on this marketplace (VINTED, EBAY…), and their ancestors so the tree rebuilds; `platforms` names the marketplaces where each category already has a mapping. (optional) + * @param headers Optional headers to include in the request + * @return CatalogCategoryPage + * @throws ApiException if fails to make API call + */ + public CatalogCategoryPage listCatalogCategories(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long parentId, @jakarta.annotation.Nullable String platform, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogCategoriesWithHttpInfo(limit, cursor, parentId, platform, headers); + return localVarResponse.getData(); + } + + /** + * List the catalog's categories + * The categories an item's `categoryId` takes, flat, by identifier; each names its parent, so the tree is rebuilt from the pages (or read level by level with `parentId`). One catalog for every marketplace: `platforms` names where the category already has a mapping. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param parentId Only the direct children of this category. (optional) + * @param platform The categories that already have a mapping on this marketplace (VINTED, EBAY…), and their ancestors so the tree rebuilds; `platforms` names the marketplaces where each category already has a mapping. (optional) + * @return ApiResponse<CatalogCategoryPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogCategoriesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long parentId, @jakarta.annotation.Nullable String platform) throws ApiException { + return listCatalogCategoriesWithHttpInfo(limit, cursor, parentId, platform, null); + } + + /** + * List the catalog's categories + * The categories an item's `categoryId` takes, flat, by identifier; each names its parent, so the tree is rebuilt from the pages (or read level by level with `parentId`). One catalog for every marketplace: `platforms` names where the category already has a mapping. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param parentId Only the direct children of this category. (optional) + * @param platform The categories that already have a mapping on this marketplace (VINTED, EBAY…), and their ancestors so the tree rebuilds; `platforms` names the marketplaces where each category already has a mapping. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogCategoryPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogCategoriesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long parentId, @jakarta.annotation.Nullable String platform, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogCategoriesRequestBuilder(limit, cursor, parentId, platform, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogCategories", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogCategoryPage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogCategoriesRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long parentId, @jakarta.annotation.Nullable String platform, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/categories"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "parentId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("parentId", parentId)); + localVarQueryParameterBaseName = "platform"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("platform", platform)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the colors + * The colors an item's `colorIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the colors that apply to this category. (optional) + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogColors(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogColors(limit, cursor, categoryId, null); + } + + /** + * List the colors + * The colors an item's `colorIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the colors that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogColors(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogColorsWithHttpInfo(limit, cursor, categoryId, headers); + return localVarResponse.getData(); + } + + /** + * List the colors + * The colors an item's `colorIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the colors that apply to this category. (optional) + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogColorsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogColorsWithHttpInfo(limit, cursor, categoryId, null); + } + + /** + * List the colors + * The colors an item's `colorIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the colors that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogColorsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogColorsRequestBuilder(limit, cursor, categoryId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogColors", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogValuePage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogColorsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/colors"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "categoryId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("categoryId", categoryId)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the conditions + * The conditions an item's `state` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the conditions that apply to this category. (optional) + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogConditions(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogConditions(limit, cursor, categoryId, null); + } + + /** + * List the conditions + * The conditions an item's `state` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the conditions that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogConditions(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogConditionsWithHttpInfo(limit, cursor, categoryId, headers); + return localVarResponse.getData(); + } + + /** + * List the conditions + * The conditions an item's `state` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the conditions that apply to this category. (optional) + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogConditionsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogConditionsWithHttpInfo(limit, cursor, categoryId, null); + } + + /** + * List the conditions + * The conditions an item's `state` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the conditions that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogConditionsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogConditionsRequestBuilder(limit, cursor, categoryId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogConditions", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogValuePage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogConditionsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/conditions"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "categoryId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("categoryId", categoryId)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the materials + * The materials an item's `materialIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the materials that apply to this category. (optional) + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogMaterials(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogMaterials(limit, cursor, categoryId, null); + } + + /** + * List the materials + * The materials an item's `materialIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the materials that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogMaterials(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogMaterialsWithHttpInfo(limit, cursor, categoryId, headers); + return localVarResponse.getData(); + } + + /** + * List the materials + * The materials an item's `materialIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the materials that apply to this category. (optional) + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogMaterialsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogMaterialsWithHttpInfo(limit, cursor, categoryId, null); + } + + /** + * List the materials + * The materials an item's `materialIds` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the materials that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogMaterialsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogMaterialsRequestBuilder(limit, cursor, categoryId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogMaterials", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogValuePage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogMaterialsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/materials"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "categoryId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("categoryId", categoryId)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the package sizes + * The package sizes an item's `packageSizeId` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the package sizes that apply to this category. (optional) + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogPackageSizes(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogPackageSizes(limit, cursor, categoryId, null); + } + + /** + * List the package sizes + * The package sizes an item's `packageSizeId` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the package sizes that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return CatalogValuePage + * @throws ApiException if fails to make API call + */ + public CatalogValuePage listCatalogPackageSizes(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogPackageSizesWithHttpInfo(limit, cursor, categoryId, headers); + return localVarResponse.getData(); + } + + /** + * List the package sizes + * The package sizes an item's `packageSizeId` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the package sizes that apply to this category. (optional) + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogPackageSizesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogPackageSizesWithHttpInfo(limit, cursor, categoryId, null); + } + + /** + * List the package sizes + * The package sizes an item's `packageSizeId` takes (their `id`), by identifier; with `categoryId`, only those that apply to that category. Titles in the seller's language. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the package sizes that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogValuePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogPackageSizesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogPackageSizesRequestBuilder(limit, cursor, categoryId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogPackageSizes", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogValuePage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogPackageSizesRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/package-sizes"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "categoryId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("categoryId", categoryId)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * List the sizes + * The sizes an item's `sizeId` takes, by identifier, each with its size group; with `categoryId`, only the sizes of that category's size groups. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the sizes that apply to this category. (optional) + * @return CatalogSizePage + * @throws ApiException if fails to make API call + */ + public CatalogSizePage listCatalogSizes(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogSizes(limit, cursor, categoryId, null); + } + + /** + * List the sizes + * The sizes an item's `sizeId` takes, by identifier, each with its size group; with `categoryId`, only the sizes of that category's size groups. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the sizes that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return CatalogSizePage + * @throws ApiException if fails to make API call + */ + public CatalogSizePage listCatalogSizes(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + ApiResponse localVarResponse = listCatalogSizesWithHttpInfo(limit, cursor, categoryId, headers); + return localVarResponse.getData(); + } + + /** + * List the sizes + * The sizes an item's `sizeId` takes, by identifier, each with its size group; with `categoryId`, only the sizes of that category's size groups. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the sizes that apply to this category. (optional) + * @return ApiResponse<CatalogSizePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogSizesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId) throws ApiException { + return listCatalogSizesWithHttpInfo(limit, cursor, categoryId, null); + } + + /** + * List the sizes + * The sizes an item's `sizeId` takes, by identifier, each with its size group; with `categoryId`, only the sizes of that category's size groups. Requires `items:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param categoryId Only the sizes that apply to this category. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<CatalogSizePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listCatalogSizesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listCatalogSizesRequestBuilder(limit, cursor, categoryId, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("listCatalogSizes", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CatalogSizePage responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder listCatalogSizesRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Long categoryId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/catalogs/sizes"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + localVarQueryParameterBaseName = "categoryId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("categoryId", categoryId)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogBrand.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogBrand.java new file mode 100644 index 0000000..7a17439 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogBrand.java @@ -0,0 +1,220 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogBrand + */ +@JsonPropertyOrder({ + CatalogBrand.JSON_PROPERTY_ID, + CatalogBrand.JSON_PROPERTY_NAME, + CatalogBrand.JSON_PROPERTY_CUSTOM +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogBrand { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @jakarta.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + @jakarta.annotation.Nonnull + private Boolean custom; + + public CatalogBrand() { + } + + public CatalogBrand id(@jakarta.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull Long id) { + this.id = id; + } + + + public CatalogBrand name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public CatalogBrand custom(@jakarta.annotation.Nonnull Boolean custom) { + this.custom = custom; + return this; + } + + /** + * Get custom + * @return custom + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CUSTOM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getCustom() { + return custom; + } + + + @JsonProperty(value = JSON_PROPERTY_CUSTOM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCustom(@jakarta.annotation.Nonnull Boolean custom) { + this.custom = custom; + } + + + /** + * Return true if this CatalogBrand object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogBrand catalogBrand = (CatalogBrand) o; + return Objects.equals(this.id, catalogBrand.id) && + Objects.equals(this.name, catalogBrand.name) && + Objects.equals(this.custom, catalogBrand.custom); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, custom); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogBrand {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `custom` to the URL query string + if (getCustom() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scustom%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCustom())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogBrandPage.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogBrandPage.java new file mode 100644 index 0000000..55b02c7 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogBrandPage.java @@ -0,0 +1,222 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogBrand; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogBrandPage + */ +@JsonPropertyOrder({ + CatalogBrandPage.JSON_PROPERTY_DATA, + CatalogBrandPage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogBrandPage { + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + private JsonNullable nextCursor = JsonNullable.undefined(); + + public CatalogBrandPage() { + } + + public CatalogBrandPage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public CatalogBrandPage addDataItem(CatalogBrand dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull List data) { + this.data = data; + } + + + public CatalogBrandPage nextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * Get nextCursor + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNextCursor() { + return nextCursor.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextCursor_JsonNullable() { + return nextCursor; + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + public void setNextCursor_JsonNullable(JsonNullable nextCursor) { + this.nextCursor = nextCursor; + } + + public void setNextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + } + + + /** + * Return true if this CatalogBrandPage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogBrandPage catalogBrandPage = (CatalogBrandPage) o; + return Objects.equals(this.data, catalogBrandPage.data) && + equalsNullable(this.nextCursor, catalogBrandPage.nextCursor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(data, hashCodeNullable(nextCursor)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogBrandPage {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `data` to the URL query string + if (getData() != null) { + for (int i = 0; i < getData().size(); i++) { + if (getData().get(i) != null) { + joiner.add(getData().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sdata%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `nextCursor` to the URL query string + if (getNextCursor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snextCursor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextCursor())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogCategory.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategory.java new file mode 100644 index 0000000..3c437e1 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategory.java @@ -0,0 +1,376 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogCategory + */ +@JsonPropertyOrder({ + CatalogCategory.JSON_PROPERTY_ID, + CatalogCategory.JSON_PROPERTY_PARENT_ID, + CatalogCategory.JSON_PROPERTY_TITLE, + CatalogCategory.JSON_PROPERTY_HAS_CHILDREN, + CatalogCategory.JSON_PROPERTY_SIZE_GROUP_IDS, + CatalogCategory.JSON_PROPERTY_PLATFORMS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogCategory { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private Long id; + + public static final String JSON_PROPERTY_PARENT_ID = "parentId"; + private JsonNullable parentId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TITLE = "title"; + @jakarta.annotation.Nonnull + private String title; + + public static final String JSON_PROPERTY_HAS_CHILDREN = "hasChildren"; + @jakarta.annotation.Nonnull + private Boolean hasChildren; + + public static final String JSON_PROPERTY_SIZE_GROUP_IDS = "sizeGroupIds"; + @jakarta.annotation.Nonnull + private List sizeGroupIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_PLATFORMS = "platforms"; + @jakarta.annotation.Nonnull + private List platforms = new ArrayList<>(); + + public CatalogCategory() { + } + + public CatalogCategory id(@jakarta.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull Long id) { + this.id = id; + } + + + public CatalogCategory parentId(@jakarta.annotation.Nullable Long parentId) { + this.parentId = JsonNullable.of(parentId); + return this; + } + + /** + * Get parentId + * @return parentId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getParentId() { + return parentId.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PARENT_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getParentId_JsonNullable() { + return parentId; + } + + @JsonProperty(JSON_PROPERTY_PARENT_ID) + public void setParentId_JsonNullable(JsonNullable parentId) { + this.parentId = parentId; + } + + public void setParentId(@jakarta.annotation.Nullable Long parentId) { + this.parentId = JsonNullable.of(parentId); + } + + + public CatalogCategory title(@jakarta.annotation.Nonnull String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTitle(@jakarta.annotation.Nonnull String title) { + this.title = title; + } + + + public CatalogCategory hasChildren(@jakarta.annotation.Nonnull Boolean hasChildren) { + this.hasChildren = hasChildren; + return this; + } + + /** + * Get hasChildren + * @return hasChildren + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_HAS_CHILDREN, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasChildren() { + return hasChildren; + } + + + @JsonProperty(value = JSON_PROPERTY_HAS_CHILDREN, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setHasChildren(@jakarta.annotation.Nonnull Boolean hasChildren) { + this.hasChildren = hasChildren; + } + + + public CatalogCategory sizeGroupIds(@jakarta.annotation.Nonnull List sizeGroupIds) { + this.sizeGroupIds = sizeGroupIds; + return this; + } + + public CatalogCategory addSizeGroupIdsItem(Long sizeGroupIdsItem) { + if (this.sizeGroupIds == null) { + this.sizeGroupIds = new ArrayList<>(); + } + this.sizeGroupIds.add(sizeGroupIdsItem); + return this; + } + + /** + * Get sizeGroupIds + * @return sizeGroupIds + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSizeGroupIds() { + return sizeGroupIds; + } + + + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSizeGroupIds(@jakarta.annotation.Nonnull List sizeGroupIds) { + this.sizeGroupIds = sizeGroupIds; + } + + + public CatalogCategory platforms(@jakarta.annotation.Nonnull List platforms) { + this.platforms = platforms; + return this; + } + + public CatalogCategory addPlatformsItem(String platformsItem) { + if (this.platforms == null) { + this.platforms = new ArrayList<>(); + } + this.platforms.add(platformsItem); + return this; + } + + /** + * Get platforms + * @return platforms + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PLATFORMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPlatforms() { + return platforms; + } + + + @JsonProperty(value = JSON_PROPERTY_PLATFORMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPlatforms(@jakarta.annotation.Nonnull List platforms) { + this.platforms = platforms; + } + + + /** + * Return true if this CatalogCategory object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogCategory catalogCategory = (CatalogCategory) o; + return Objects.equals(this.id, catalogCategory.id) && + equalsNullable(this.parentId, catalogCategory.parentId) && + Objects.equals(this.title, catalogCategory.title) && + Objects.equals(this.hasChildren, catalogCategory.hasChildren) && + Objects.equals(this.sizeGroupIds, catalogCategory.sizeGroupIds) && + Objects.equals(this.platforms, catalogCategory.platforms); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, hashCodeNullable(parentId), title, hasChildren, sizeGroupIds, platforms); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" hasChildren: ").append(toIndentedString(hasChildren)).append("\n"); + sb.append(" sizeGroupIds: ").append(toIndentedString(sizeGroupIds)).append("\n"); + sb.append(" platforms: ").append(toIndentedString(platforms)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `parentId` to the URL query string + if (getParentId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sparentId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getParentId())))); + } + + // add `title` to the URL query string + if (getTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTitle())))); + } + + // add `hasChildren` to the URL query string + if (getHasChildren() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%shasChildren%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getHasChildren())))); + } + + // add `sizeGroupIds` to the URL query string + if (getSizeGroupIds() != null) { + for (int i = 0; i < getSizeGroupIds().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssizeGroupIds%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getSizeGroupIds().get(i))))); + } + } + + // add `platforms` to the URL query string + if (getPlatforms() != null) { + for (int i = 0; i < getPlatforms().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%splatforms%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getPlatforms().get(i))))); + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryFields.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryFields.java new file mode 100644 index 0000000..217b268 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryFields.java @@ -0,0 +1,348 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogEnumField; +import com.controlresell.sdk.generated.model.CatalogMeasurement; +import com.controlresell.sdk.generated.model.CatalogTextField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogCategoryFields + */ +@JsonPropertyOrder({ + CatalogCategoryFields.JSON_PROPERTY_CATEGORY_ID, + CatalogCategoryFields.JSON_PROPERTY_SIZE_GROUP_IDS, + CatalogCategoryFields.JSON_PROPERTY_ENUM_FIELDS, + CatalogCategoryFields.JSON_PROPERTY_TEXT_FIELDS, + CatalogCategoryFields.JSON_PROPERTY_MEASUREMENTS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogCategoryFields { + public static final String JSON_PROPERTY_CATEGORY_ID = "categoryId"; + @jakarta.annotation.Nonnull + private Long categoryId; + + public static final String JSON_PROPERTY_SIZE_GROUP_IDS = "sizeGroupIds"; + @jakarta.annotation.Nonnull + private List sizeGroupIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_ENUM_FIELDS = "enumFields"; + @jakarta.annotation.Nonnull + private List enumFields = new ArrayList<>(); + + public static final String JSON_PROPERTY_TEXT_FIELDS = "textFields"; + @jakarta.annotation.Nonnull + private List textFields = new ArrayList<>(); + + public static final String JSON_PROPERTY_MEASUREMENTS = "measurements"; + @jakarta.annotation.Nonnull + private List measurements = new ArrayList<>(); + + public CatalogCategoryFields() { + } + + public CatalogCategoryFields categoryId(@jakarta.annotation.Nonnull Long categoryId) { + this.categoryId = categoryId; + return this; + } + + /** + * Get categoryId + * @return categoryId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getCategoryId() { + return categoryId; + } + + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCategoryId(@jakarta.annotation.Nonnull Long categoryId) { + this.categoryId = categoryId; + } + + + public CatalogCategoryFields sizeGroupIds(@jakarta.annotation.Nonnull List sizeGroupIds) { + this.sizeGroupIds = sizeGroupIds; + return this; + } + + public CatalogCategoryFields addSizeGroupIdsItem(Long sizeGroupIdsItem) { + if (this.sizeGroupIds == null) { + this.sizeGroupIds = new ArrayList<>(); + } + this.sizeGroupIds.add(sizeGroupIdsItem); + return this; + } + + /** + * Get sizeGroupIds + * @return sizeGroupIds + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSizeGroupIds() { + return sizeGroupIds; + } + + + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSizeGroupIds(@jakarta.annotation.Nonnull List sizeGroupIds) { + this.sizeGroupIds = sizeGroupIds; + } + + + public CatalogCategoryFields enumFields(@jakarta.annotation.Nonnull List enumFields) { + this.enumFields = enumFields; + return this; + } + + public CatalogCategoryFields addEnumFieldsItem(CatalogEnumField enumFieldsItem) { + if (this.enumFields == null) { + this.enumFields = new ArrayList<>(); + } + this.enumFields.add(enumFieldsItem); + return this; + } + + /** + * Get enumFields + * @return enumFields + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENUM_FIELDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEnumFields() { + return enumFields; + } + + + @JsonProperty(value = JSON_PROPERTY_ENUM_FIELDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumFields(@jakarta.annotation.Nonnull List enumFields) { + this.enumFields = enumFields; + } + + + public CatalogCategoryFields textFields(@jakarta.annotation.Nonnull List textFields) { + this.textFields = textFields; + return this; + } + + public CatalogCategoryFields addTextFieldsItem(CatalogTextField textFieldsItem) { + if (this.textFields == null) { + this.textFields = new ArrayList<>(); + } + this.textFields.add(textFieldsItem); + return this; + } + + /** + * Get textFields + * @return textFields + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TEXT_FIELDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTextFields() { + return textFields; + } + + + @JsonProperty(value = JSON_PROPERTY_TEXT_FIELDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTextFields(@jakarta.annotation.Nonnull List textFields) { + this.textFields = textFields; + } + + + public CatalogCategoryFields measurements(@jakarta.annotation.Nonnull List measurements) { + this.measurements = measurements; + return this; + } + + public CatalogCategoryFields addMeasurementsItem(CatalogMeasurement measurementsItem) { + if (this.measurements == null) { + this.measurements = new ArrayList<>(); + } + this.measurements.add(measurementsItem); + return this; + } + + /** + * Get measurements + * @return measurements + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MEASUREMENTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getMeasurements() { + return measurements; + } + + + @JsonProperty(value = JSON_PROPERTY_MEASUREMENTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMeasurements(@jakarta.annotation.Nonnull List measurements) { + this.measurements = measurements; + } + + + /** + * Return true if this CatalogCategoryFields object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogCategoryFields catalogCategoryFields = (CatalogCategoryFields) o; + return Objects.equals(this.categoryId, catalogCategoryFields.categoryId) && + Objects.equals(this.sizeGroupIds, catalogCategoryFields.sizeGroupIds) && + Objects.equals(this.enumFields, catalogCategoryFields.enumFields) && + Objects.equals(this.textFields, catalogCategoryFields.textFields) && + Objects.equals(this.measurements, catalogCategoryFields.measurements); + } + + @Override + public int hashCode() { + return Objects.hash(categoryId, sizeGroupIds, enumFields, textFields, measurements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogCategoryFields {\n"); + sb.append(" categoryId: ").append(toIndentedString(categoryId)).append("\n"); + sb.append(" sizeGroupIds: ").append(toIndentedString(sizeGroupIds)).append("\n"); + sb.append(" enumFields: ").append(toIndentedString(enumFields)).append("\n"); + sb.append(" textFields: ").append(toIndentedString(textFields)).append("\n"); + sb.append(" measurements: ").append(toIndentedString(measurements)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `categoryId` to the URL query string + if (getCategoryId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scategoryId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCategoryId())))); + } + + // add `sizeGroupIds` to the URL query string + if (getSizeGroupIds() != null) { + for (int i = 0; i < getSizeGroupIds().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssizeGroupIds%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getSizeGroupIds().get(i))))); + } + } + + // add `enumFields` to the URL query string + if (getEnumFields() != null) { + for (int i = 0; i < getEnumFields().size(); i++) { + if (getEnumFields().get(i) != null) { + joiner.add(getEnumFields().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%senumFields%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `textFields` to the URL query string + if (getTextFields() != null) { + for (int i = 0; i < getTextFields().size(); i++) { + if (getTextFields().get(i) != null) { + joiner.add(getTextFields().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%stextFields%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `measurements` to the URL query string + if (getMeasurements() != null) { + for (int i = 0; i < getMeasurements().size(); i++) { + if (getMeasurements().get(i) != null) { + joiner.add(getMeasurements().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%smeasurements%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryPage.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryPage.java new file mode 100644 index 0000000..b7aec4a --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogCategoryPage.java @@ -0,0 +1,222 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogCategory; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogCategoryPage + */ +@JsonPropertyOrder({ + CatalogCategoryPage.JSON_PROPERTY_DATA, + CatalogCategoryPage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogCategoryPage { + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + private JsonNullable nextCursor = JsonNullable.undefined(); + + public CatalogCategoryPage() { + } + + public CatalogCategoryPage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public CatalogCategoryPage addDataItem(CatalogCategory dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull List data) { + this.data = data; + } + + + public CatalogCategoryPage nextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * Get nextCursor + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNextCursor() { + return nextCursor.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextCursor_JsonNullable() { + return nextCursor; + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + public void setNextCursor_JsonNullable(JsonNullable nextCursor) { + this.nextCursor = nextCursor; + } + + public void setNextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + } + + + /** + * Return true if this CatalogCategoryPage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogCategoryPage catalogCategoryPage = (CatalogCategoryPage) o; + return Objects.equals(this.data, catalogCategoryPage.data) && + equalsNullable(this.nextCursor, catalogCategoryPage.nextCursor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(data, hashCodeNullable(nextCursor)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogCategoryPage {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `data` to the URL query string + if (getData() != null) { + for (int i = 0; i < getData().size(); i++) { + if (getData().get(i) != null) { + joiner.add(getData().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sdata%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `nextCursor` to the URL query string + if (getNextCursor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snextCursor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextCursor())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogEnumField.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogEnumField.java new file mode 100644 index 0000000..264af90 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogEnumField.java @@ -0,0 +1,380 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogValue; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogEnumField + */ +@JsonPropertyOrder({ + CatalogEnumField.JSON_PROPERTY_KEY, + CatalogEnumField.JSON_PROPERTY_TITLE, + CatalogEnumField.JSON_PROPERTY_TARGET, + CatalogEnumField.JSON_PROPERTY_MULTIPLE, + CatalogEnumField.JSON_PROPERTY_PLATFORM, + CatalogEnumField.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogEnumField { + public static final String JSON_PROPERTY_KEY = "key"; + @jakarta.annotation.Nonnull + private String key; + + public static final String JSON_PROPERTY_TITLE = "title"; + private JsonNullable title = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TARGET = "target"; + @jakarta.annotation.Nonnull + private String target; + + public static final String JSON_PROPERTY_MULTIPLE = "multiple"; + private JsonNullable multiple = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PLATFORM = "platform"; + private JsonNullable platform = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_VALUES = "values"; + @jakarta.annotation.Nonnull + private List values = new ArrayList<>(); + + public CatalogEnumField() { + } + + public CatalogEnumField key(@jakarta.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKey(@jakarta.annotation.Nonnull String key) { + this.key = key; + } + + + public CatalogEnumField title(@jakarta.annotation.Nullable String title) { + this.title = JsonNullable.of(title); + return this; + } + + /** + * Get title + * @return title + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getTitle() { + return title.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getTitle_JsonNullable() { + return title; + } + + @JsonProperty(JSON_PROPERTY_TITLE) + public void setTitle_JsonNullable(JsonNullable title) { + this.title = title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = JsonNullable.of(title); + } + + + public CatalogEnumField target(@jakarta.annotation.Nonnull String target) { + this.target = target; + return this; + } + + /** + * Get target + * @return target + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TARGET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTarget() { + return target; + } + + + @JsonProperty(value = JSON_PROPERTY_TARGET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTarget(@jakarta.annotation.Nonnull String target) { + this.target = target; + } + + + public CatalogEnumField multiple(@jakarta.annotation.Nullable Boolean multiple) { + this.multiple = JsonNullable.of(multiple); + return this; + } + + /** + * Get multiple + * @return multiple + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getMultiple() { + return multiple.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_MULTIPLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMultiple_JsonNullable() { + return multiple; + } + + @JsonProperty(JSON_PROPERTY_MULTIPLE) + public void setMultiple_JsonNullable(JsonNullable multiple) { + this.multiple = multiple; + } + + public void setMultiple(@jakarta.annotation.Nullable Boolean multiple) { + this.multiple = JsonNullable.of(multiple); + } + + + public CatalogEnumField platform(@jakarta.annotation.Nullable String platform) { + this.platform = JsonNullable.of(platform); + return this; + } + + /** + * Get platform + * @return platform + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPlatform() { + return platform.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PLATFORM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPlatform_JsonNullable() { + return platform; + } + + @JsonProperty(JSON_PROPERTY_PLATFORM) + public void setPlatform_JsonNullable(JsonNullable platform) { + this.platform = platform; + } + + public void setPlatform(@jakarta.annotation.Nullable String platform) { + this.platform = JsonNullable.of(platform); + } + + + public CatalogEnumField values(@jakarta.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public CatalogEnumField addValuesItem(CatalogValue valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValues(@jakarta.annotation.Nonnull List values) { + this.values = values; + } + + + /** + * Return true if this CatalogEnumField object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogEnumField catalogEnumField = (CatalogEnumField) o; + return Objects.equals(this.key, catalogEnumField.key) && + equalsNullable(this.title, catalogEnumField.title) && + Objects.equals(this.target, catalogEnumField.target) && + equalsNullable(this.multiple, catalogEnumField.multiple) && + equalsNullable(this.platform, catalogEnumField.platform) && + Objects.equals(this.values, catalogEnumField.values); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(key, hashCodeNullable(title), target, hashCodeNullable(multiple), hashCodeNullable(platform), values); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogEnumField {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" multiple: ").append(toIndentedString(multiple)).append("\n"); + sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `key` to the URL query string + if (getKey() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%skey%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getKey())))); + } + + // add `title` to the URL query string + if (getTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTitle())))); + } + + // add `target` to the URL query string + if (getTarget() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%starget%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTarget())))); + } + + // add `multiple` to the URL query string + if (getMultiple() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smultiple%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMultiple())))); + } + + // add `platform` to the URL query string + if (getPlatform() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%splatform%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPlatform())))); + } + + // add `values` to the URL query string + if (getValues() != null) { + for (int i = 0; i < getValues().size(); i++) { + if (getValues().get(i) != null) { + joiner.add(getValues().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%svalues%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogMeasurement.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogMeasurement.java new file mode 100644 index 0000000..c5eefd3 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogMeasurement.java @@ -0,0 +1,220 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogMeasurement + */ +@JsonPropertyOrder({ + CatalogMeasurement.JSON_PROPERTY_TARGET, + CatalogMeasurement.JSON_PROPERTY_UNIT, + CatalogMeasurement.JSON_PROPERTY_REQUIRED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogMeasurement { + public static final String JSON_PROPERTY_TARGET = "target"; + @jakarta.annotation.Nonnull + private String target; + + public static final String JSON_PROPERTY_UNIT = "unit"; + @jakarta.annotation.Nonnull + private String unit; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + @jakarta.annotation.Nonnull + private Boolean required; + + public CatalogMeasurement() { + } + + public CatalogMeasurement target(@jakarta.annotation.Nonnull String target) { + this.target = target; + return this; + } + + /** + * Get target + * @return target + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TARGET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTarget() { + return target; + } + + + @JsonProperty(value = JSON_PROPERTY_TARGET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTarget(@jakarta.annotation.Nonnull String target) { + this.target = target; + } + + + public CatalogMeasurement unit(@jakarta.annotation.Nonnull String unit) { + this.unit = unit; + return this; + } + + /** + * Get unit + * @return unit + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_UNIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUnit() { + return unit; + } + + + @JsonProperty(value = JSON_PROPERTY_UNIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUnit(@jakarta.annotation.Nonnull String unit) { + this.unit = unit; + } + + + public CatalogMeasurement required(@jakarta.annotation.Nonnull Boolean required) { + this.required = required; + return this; + } + + /** + * Get required + * @return required + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getRequired() { + return required; + } + + + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRequired(@jakarta.annotation.Nonnull Boolean required) { + this.required = required; + } + + + /** + * Return true if this CatalogMeasurement object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogMeasurement catalogMeasurement = (CatalogMeasurement) o; + return Objects.equals(this.target, catalogMeasurement.target) && + Objects.equals(this.unit, catalogMeasurement.unit) && + Objects.equals(this.required, catalogMeasurement.required); + } + + @Override + public int hashCode() { + return Objects.hash(target, unit, required); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogMeasurement {\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `target` to the URL query string + if (getTarget() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%starget%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTarget())))); + } + + // add `unit` to the URL query string + if (getUnit() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sunit%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUnit())))); + } + + // add `required` to the URL query string + if (getRequired() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%srequired%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getRequired())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogSize.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogSize.java new file mode 100644 index 0000000..f8022fa --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogSize.java @@ -0,0 +1,256 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogSize + */ +@JsonPropertyOrder({ + CatalogSize.JSON_PROPERTY_ID, + CatalogSize.JSON_PROPERTY_TITLE, + CatalogSize.JSON_PROPERTY_SIZE_GROUP_ID, + CatalogSize.JSON_PROPERTY_SIZE_GROUP_TITLE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogSize { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private Long id; + + public static final String JSON_PROPERTY_TITLE = "title"; + @jakarta.annotation.Nonnull + private String title; + + public static final String JSON_PROPERTY_SIZE_GROUP_ID = "sizeGroupId"; + @jakarta.annotation.Nonnull + private Long sizeGroupId; + + public static final String JSON_PROPERTY_SIZE_GROUP_TITLE = "sizeGroupTitle"; + @jakarta.annotation.Nonnull + private String sizeGroupTitle; + + public CatalogSize() { + } + + public CatalogSize id(@jakarta.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull Long id) { + this.id = id; + } + + + public CatalogSize title(@jakarta.annotation.Nonnull String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTitle(@jakarta.annotation.Nonnull String title) { + this.title = title; + } + + + public CatalogSize sizeGroupId(@jakarta.annotation.Nonnull Long sizeGroupId) { + this.sizeGroupId = sizeGroupId; + return this; + } + + /** + * Get sizeGroupId + * @return sizeGroupId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSizeGroupId() { + return sizeGroupId; + } + + + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSizeGroupId(@jakarta.annotation.Nonnull Long sizeGroupId) { + this.sizeGroupId = sizeGroupId; + } + + + public CatalogSize sizeGroupTitle(@jakarta.annotation.Nonnull String sizeGroupTitle) { + this.sizeGroupTitle = sizeGroupTitle; + return this; + } + + /** + * Get sizeGroupTitle + * @return sizeGroupTitle + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSizeGroupTitle() { + return sizeGroupTitle; + } + + + @JsonProperty(value = JSON_PROPERTY_SIZE_GROUP_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSizeGroupTitle(@jakarta.annotation.Nonnull String sizeGroupTitle) { + this.sizeGroupTitle = sizeGroupTitle; + } + + + /** + * Return true if this CatalogSize object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogSize catalogSize = (CatalogSize) o; + return Objects.equals(this.id, catalogSize.id) && + Objects.equals(this.title, catalogSize.title) && + Objects.equals(this.sizeGroupId, catalogSize.sizeGroupId) && + Objects.equals(this.sizeGroupTitle, catalogSize.sizeGroupTitle); + } + + @Override + public int hashCode() { + return Objects.hash(id, title, sizeGroupId, sizeGroupTitle); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogSize {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" sizeGroupId: ").append(toIndentedString(sizeGroupId)).append("\n"); + sb.append(" sizeGroupTitle: ").append(toIndentedString(sizeGroupTitle)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `title` to the URL query string + if (getTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTitle())))); + } + + // add `sizeGroupId` to the URL query string + if (getSizeGroupId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssizeGroupId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSizeGroupId())))); + } + + // add `sizeGroupTitle` to the URL query string + if (getSizeGroupTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssizeGroupTitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSizeGroupTitle())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogSizePage.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogSizePage.java new file mode 100644 index 0000000..1bbe62a --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogSizePage.java @@ -0,0 +1,222 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogSize; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogSizePage + */ +@JsonPropertyOrder({ + CatalogSizePage.JSON_PROPERTY_DATA, + CatalogSizePage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogSizePage { + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + private JsonNullable nextCursor = JsonNullable.undefined(); + + public CatalogSizePage() { + } + + public CatalogSizePage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public CatalogSizePage addDataItem(CatalogSize dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull List data) { + this.data = data; + } + + + public CatalogSizePage nextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * Get nextCursor + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNextCursor() { + return nextCursor.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextCursor_JsonNullable() { + return nextCursor; + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + public void setNextCursor_JsonNullable(JsonNullable nextCursor) { + this.nextCursor = nextCursor; + } + + public void setNextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + } + + + /** + * Return true if this CatalogSizePage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogSizePage catalogSizePage = (CatalogSizePage) o; + return Objects.equals(this.data, catalogSizePage.data) && + equalsNullable(this.nextCursor, catalogSizePage.nextCursor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(data, hashCodeNullable(nextCursor)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogSizePage {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `data` to the URL query string + if (getData() != null) { + for (int i = 0; i < getData().size(); i++) { + if (getData().get(i) != null) { + joiner.add(getData().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sdata%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `nextCursor` to the URL query string + if (getNextCursor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snextCursor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextCursor())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogTextField.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogTextField.java new file mode 100644 index 0000000..cb17578 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogTextField.java @@ -0,0 +1,364 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogTextField + */ +@JsonPropertyOrder({ + CatalogTextField.JSON_PROPERTY_KEY, + CatalogTextField.JSON_PROPERTY_TITLE, + CatalogTextField.JSON_PROPERTY_TYPE, + CatalogTextField.JSON_PROPERTY_REQUIRED, + CatalogTextField.JSON_PROPERTY_VALIDATION, + CatalogTextField.JSON_PROPERTY_PLATFORM +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogTextField { + public static final String JSON_PROPERTY_KEY = "key"; + @jakarta.annotation.Nonnull + private String key; + + public static final String JSON_PROPERTY_TITLE = "title"; + private JsonNullable title = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TYPE = "type"; + @jakarta.annotation.Nonnull + private String type; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + @jakarta.annotation.Nonnull + private Boolean required; + + public static final String JSON_PROPERTY_VALIDATION = "validation"; + private JsonNullable validation = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PLATFORM = "platform"; + private JsonNullable platform = JsonNullable.undefined(); + + public CatalogTextField() { + } + + public CatalogTextField key(@jakarta.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKey(@jakarta.annotation.Nonnull String key) { + this.key = key; + } + + + public CatalogTextField title(@jakarta.annotation.Nullable String title) { + this.title = JsonNullable.of(title); + return this; + } + + /** + * Get title + * @return title + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getTitle() { + return title.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getTitle_JsonNullable() { + return title; + } + + @JsonProperty(JSON_PROPERTY_TITLE) + public void setTitle_JsonNullable(JsonNullable title) { + this.title = title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = JsonNullable.of(title); + } + + + public CatalogTextField type(@jakarta.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@jakarta.annotation.Nonnull String type) { + this.type = type; + } + + + public CatalogTextField required(@jakarta.annotation.Nonnull Boolean required) { + this.required = required; + return this; + } + + /** + * Get required + * @return required + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getRequired() { + return required; + } + + + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRequired(@jakarta.annotation.Nonnull Boolean required) { + this.required = required; + } + + + public CatalogTextField validation(@jakarta.annotation.Nullable String validation) { + this.validation = JsonNullable.of(validation); + return this; + } + + /** + * Get validation + * @return validation + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getValidation() { + return validation.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_VALIDATION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getValidation_JsonNullable() { + return validation; + } + + @JsonProperty(JSON_PROPERTY_VALIDATION) + public void setValidation_JsonNullable(JsonNullable validation) { + this.validation = validation; + } + + public void setValidation(@jakarta.annotation.Nullable String validation) { + this.validation = JsonNullable.of(validation); + } + + + public CatalogTextField platform(@jakarta.annotation.Nullable String platform) { + this.platform = JsonNullable.of(platform); + return this; + } + + /** + * Get platform + * @return platform + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPlatform() { + return platform.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PLATFORM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPlatform_JsonNullable() { + return platform; + } + + @JsonProperty(JSON_PROPERTY_PLATFORM) + public void setPlatform_JsonNullable(JsonNullable platform) { + this.platform = platform; + } + + public void setPlatform(@jakarta.annotation.Nullable String platform) { + this.platform = JsonNullable.of(platform); + } + + + /** + * Return true if this CatalogTextField object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogTextField catalogTextField = (CatalogTextField) o; + return Objects.equals(this.key, catalogTextField.key) && + equalsNullable(this.title, catalogTextField.title) && + Objects.equals(this.type, catalogTextField.type) && + Objects.equals(this.required, catalogTextField.required) && + equalsNullable(this.validation, catalogTextField.validation) && + equalsNullable(this.platform, catalogTextField.platform); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(key, hashCodeNullable(title), type, required, hashCodeNullable(validation), hashCodeNullable(platform)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogTextField {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" validation: ").append(toIndentedString(validation)).append("\n"); + sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `key` to the URL query string + if (getKey() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%skey%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getKey())))); + } + + // add `title` to the URL query string + if (getTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTitle())))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `required` to the URL query string + if (getRequired() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%srequired%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getRequired())))); + } + + // add `validation` to the URL query string + if (getValidation() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalidation%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValidation())))); + } + + // add `platform` to the URL query string + if (getPlatform() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%splatform%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPlatform())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogValue.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogValue.java new file mode 100644 index 0000000..54e494e --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogValue.java @@ -0,0 +1,220 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogValue + */ +@JsonPropertyOrder({ + CatalogValue.JSON_PROPERTY_ID, + CatalogValue.JSON_PROPERTY_KEY, + CatalogValue.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogValue { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private Long id; + + public static final String JSON_PROPERTY_KEY = "key"; + @jakarta.annotation.Nonnull + private String key; + + public static final String JSON_PROPERTY_TITLE = "title"; + @jakarta.annotation.Nonnull + private String title; + + public CatalogValue() { + } + + public CatalogValue id(@jakarta.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull Long id) { + this.id = id; + } + + + public CatalogValue key(@jakarta.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + + @JsonProperty(value = JSON_PROPERTY_KEY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKey(@jakarta.annotation.Nonnull String key) { + this.key = key; + } + + + public CatalogValue title(@jakarta.annotation.Nonnull String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTitle(@jakarta.annotation.Nonnull String title) { + this.title = title; + } + + + /** + * Return true if this CatalogValue object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogValue catalogValue = (CatalogValue) o; + return Objects.equals(this.id, catalogValue.id) && + Objects.equals(this.key, catalogValue.key) && + Objects.equals(this.title, catalogValue.title); + } + + @Override + public int hashCode() { + return Objects.hash(id, key, title); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogValue {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + // add `key` to the URL query string + if (getKey() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%skey%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getKey())))); + } + + // add `title` to the URL query string + if (getTitle() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stitle%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTitle())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/CatalogValuePage.java b/src/main/java/com/controlresell/sdk/generated/model/CatalogValuePage.java new file mode 100644 index 0000000..2b1bb6a --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CatalogValuePage.java @@ -0,0 +1,222 @@ +/* + * ControlResell public API + * The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header. + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.controlresell.sdk.generated.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.controlresell.sdk.generated.model.CatalogValue; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * CatalogValuePage + */ +@JsonPropertyOrder({ + CatalogValuePage.JSON_PROPERTY_DATA, + CatalogValuePage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CatalogValuePage { + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + private JsonNullable nextCursor = JsonNullable.undefined(); + + public CatalogValuePage() { + } + + public CatalogValuePage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public CatalogValuePage addDataItem(CatalogValue dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull List data) { + this.data = data; + } + + + public CatalogValuePage nextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * Get nextCursor + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNextCursor() { + return nextCursor.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextCursor_JsonNullable() { + return nextCursor; + } + + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + public void setNextCursor_JsonNullable(JsonNullable nextCursor) { + this.nextCursor = nextCursor; + } + + public void setNextCursor(@jakarta.annotation.Nullable String nextCursor) { + this.nextCursor = JsonNullable.of(nextCursor); + } + + + /** + * Return true if this CatalogValuePage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogValuePage catalogValuePage = (CatalogValuePage) o; + return Objects.equals(this.data, catalogValuePage.data) && + equalsNullable(this.nextCursor, catalogValuePage.nextCursor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(data, hashCodeNullable(nextCursor)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogValuePage {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `data` to the URL query string + if (getData() != null) { + for (int i = 0; i < getData().size(); i++) { + if (getData().get(i) != null) { + joiner.add(getData().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sdata%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `nextCursor` to the URL query string + if (getNextCursor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snextCursor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextCursor())))); + } + + return joiner.toString(); + } +} + diff --git a/src/test/java/com/controlresell/sdk/ControlResellTest.java b/src/test/java/com/controlresell/sdk/ControlResellTest.java index d29a5ac..28e8fe4 100644 --- a/src/test/java/com/controlresell/sdk/ControlResellTest.java +++ b/src/test/java/com/controlresell/sdk/ControlResellTest.java @@ -357,4 +357,33 @@ void customersGetReadsOneCustomer() throws Exception { assertEquals("Ann", sdk.customers().get(java.util.UUID.fromString(ACCOUNT)).getFirstName()); assertEquals("/api/public/v1/customers/" + ACCOUNT, exchanges.get(0).getRequestURI().getPath()); } + + @Test + void catalogsBrandsAllFollowsTheCursorWithTheSameQuery() throws Exception { + ControlResell sdk = client(n -> n == 1 + ? new Reply(200, "{\"data\":[{\"id\":1,\"name\":\"Nike\",\"custom\":false}],\"nextCursor\":\"c2\"}") + : new Reply(200, "{\"data\":[{\"id\":2,\"name\":\"Nikon\",\"custom\":true}],\"nextCursor\":null}")); + List names = new ArrayList<>(); + for (var b : sdk.catalogs().brandsAll(null, "nik")) names.add(b.getName()); + assertEquals(List.of("Nike", "Nikon"), names); + assertEquals("/api/public/v1/catalogs/brands", exchanges.get(0).getRequestURI().getPath()); + for (String q : queries) assertTrue(q.contains("q=nik"), q); + assertTrue(!queries.get(0).contains("cursor") && queries.get(1).contains("cursor=c2"), queries.toString()); + } + + @Test + void catalogsColorsSendTheCategoryAndReadTheValues() throws Exception { + ControlResell sdk = client(n -> new Reply(200, "{\"data\":[{\"id\":3,\"key\":\"red\",\"title\":\"Red\"}],\"nextCursor\":null}")); + assertEquals("Red", sdk.catalogs().colors(null, null, 12L).getData().get(0).getTitle()); + assertEquals("/api/public/v1/catalogs/colors", exchanges.get(0).getRequestURI().getPath()); + assertTrue(queries.get(0).contains("categoryId=12"), queries.toString()); + } + + @Test + void catalogsCategoryFieldsReadsTheFieldsOfOneCategory() throws Exception { + ControlResell sdk = client(n -> new Reply(200, + "{\"categoryId\":12,\"sizeGroupIds\":[1],\"enumFields\":[],\"textFields\":[],\"measurements\":[]}")); + assertEquals(12L, sdk.catalogs().categoryFields(12).getCategoryId()); + assertEquals("/api/public/v1/catalogs/categories/12/fields", exchanges.get(0).getRequestURI().getPath()); + } }