diff --git a/.spec-sha256 b/.spec-sha256 index fa982ec..3c42680 100644 --- a/.spec-sha256 +++ b/.spec-sha256 @@ -1 +1 @@ -41311cb64247613fcc1634a63a1804e344c71873d665fc58af33e053a5f919f1 +d95f1962bb73a3e9792c2de01bd086edce7d3c1371ece42f7c4f12032cd29e17 diff --git a/README.md b/README.md index ee2c368..912488c 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,28 @@ 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 +} + +for (Favorite favorite : client.favorites().listAll(null, null, 42L, null, null)) { + System.out.println(favorite.getBuyerId()); // the buyers who favorited a listing (items:read); also favorites().listAllItem(42, ...), list, listItem +} +client.conversations().list(null, null, null, null, null, null, "BUYER_ID", null, "PENDING"); // buyerId, itemId and offerStatus filter the conversations // 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 client.items().publish(42, new PublishRequest().accountIds(List.of(accountId))); client.conversations().sendMessage(conversationId, new SendMessageRequest().text("Hello!")); + +// Webhooks (webhooks:read / webhooks:write): endpoints, endpoint, createEndpoint, updateEndpoint, deleteEndpoint, secret, +// rotateSecret, test, deliveries, retryDelivery, recover, eventTypes; eventsAll catches up the last 7 days. +CreatedWebhookEndpoint created = client.webhooks().createEndpoint( + new WebhookEndpointCreateRequest().url("https://example.com/hooks").eventTypes(List.of("item.sold"))); +System.out.println(created.getSecret()); // the signing secret, shown once (webhooks().secret(id) reads it again) +for (WebhookEvent event : client.webhooks().eventsAll(null, null, List.of("item.sold"))) { + System.out.println(event.getType() + " " + event.getData().get("itemId")); +} ``` On `ItemUpdateRequest`, a nullable field left unset is not sent, and one set to `null` (`.sellingPlaceId(null)`) is sent as an explicit `null`, which clears it on the API. A list is replaced as a whole: send an empty list to empty it. diff --git a/src/main/java/com/controlresell/sdk/ControlResell.java b/src/main/java/com/controlresell/sdk/ControlResell.java index 901b5fb..f74aa7a 100644 --- a/src/main/java/com/controlresell/sdk/ControlResell.java +++ b/src/main/java/com/controlresell/sdk/ControlResell.java @@ -3,17 +3,32 @@ 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.FavoritesApi; import com.controlresell.sdk.generated.api.ItemsApi; import com.controlresell.sdk.generated.api.MeApi; import com.controlresell.sdk.generated.api.OrdersApi; +import com.controlresell.sdk.generated.api.WebhooksApi; 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.CreatedWebhookEndpoint; import com.controlresell.sdk.generated.model.Conversation; import com.controlresell.sdk.generated.model.ConversationPage; import com.controlresell.sdk.generated.model.Customer; import com.controlresell.sdk.generated.model.CustomerPage; +import com.controlresell.sdk.generated.model.Favorite; +import com.controlresell.sdk.generated.model.FavoritePage; import com.controlresell.sdk.generated.model.Item; import com.controlresell.sdk.generated.model.ItemCreateRequest; import com.controlresell.sdk.generated.model.ItemPage; @@ -32,6 +47,20 @@ import com.controlresell.sdk.generated.model.ScheduledAction; import com.controlresell.sdk.generated.model.SendMessageRequest; import com.controlresell.sdk.generated.model.SendOfferRequest; +import com.controlresell.sdk.generated.model.WebhookDelivery; +import com.controlresell.sdk.generated.model.WebhookDeliveryPage; +import com.controlresell.sdk.generated.model.WebhookEndpoint; +import com.controlresell.sdk.generated.model.WebhookEndpointCreateRequest; +import com.controlresell.sdk.generated.model.WebhookEndpointPage; +import com.controlresell.sdk.generated.model.WebhookEndpointUpdateRequest; +import com.controlresell.sdk.generated.model.WebhookEvent; +import com.controlresell.sdk.generated.model.WebhookEventPage; +import com.controlresell.sdk.generated.model.WebhookEventTypeList; +import com.controlresell.sdk.generated.model.WebhookRecoverRequest; +import com.controlresell.sdk.generated.model.WebhookRecovery; +import com.controlresell.sdk.generated.model.WebhookSecret; +import com.controlresell.sdk.generated.model.WebhookSecretRotateRequest; +import com.controlresell.sdk.generated.model.WebhookTestResult; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.http.HttpClient; import java.time.Duration; @@ -149,6 +178,15 @@ 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 buyers who put the seller's listings in their favorites (needs the {@code items:read} scope). */ + public Favorites favorites() { return new Favorites(); } + + /** 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's webhook endpoints, their secrets and deliveries, and the recent events (webhooks:read, webhooks:write). */ + public Webhooks webhooks() { return new Webhooks(); } + /** The seller the API key acts for. */ public final class MeResource { private final MeApi api = new MeApi(apiClient); @@ -257,7 +295,18 @@ private Conversations() {} */ public ConversationPage list(Integer limit, String cursor, Boolean unread, UUID accountId, OffsetDateTime from, OffsetDateTime to) { - return call(false, h -> api.listConversations(limit, cursor, unread, accountId, from, to, h)); + return list(limit, cursor, unread, accountId, from, to, null, null, null); + } + + /** + * One page of conversations, filtered further: {@code buyerId} keeps the conversations with one buyer, {@code itemId} + * those about one item, {@code offerStatus} those with an offer at this status ({@code PENDING}, {@code ACCEPTED}, + * {@code REJECTED} or {@code CANCELED}). Every argument may be {@code null}. + */ + public ConversationPage list(Integer limit, String cursor, Boolean unread, UUID accountId, OffsetDateTime from, + OffsetDateTime to, String buyerId, Long itemId, String offerStatus) { + return call(false, h -> api.listConversations(limit, cursor, unread, accountId, from, to, buyerId, itemId, + offerStatus, h)); } public Conversation get(UUID id) { return call(false, h -> api.getConversation(id, h)); } @@ -291,7 +340,13 @@ public Message sendOffer(UUID id, SendOfferRequest request, String idempotencyKe /** Every conversation, page after page, with the same filters. */ public Iterable listAll(Integer limit, Boolean unread, UUID accountId, OffsetDateTime from, OffsetDateTime to) { - return new Paginator<>(cursor -> list(limit, cursor, unread, accountId, from, to), + return listAll(limit, unread, accountId, from, to, null, null, null); + } + + /** Every conversation, page after page, with the same filters, among them the buyer, item and offer status. */ + public Iterable listAll(Integer limit, Boolean unread, UUID accountId, OffsetDateTime from, + OffsetDateTime to, String buyerId, Long itemId, String offerStatus) { + return new Paginator<>(cursor -> list(limit, cursor, unread, accountId, from, to, buyerId, itemId, offerStatus), p -> page(p.getData(), p.getNextCursor())); } @@ -365,6 +420,227 @@ public Iterable listAll(Integer limit, UUID accountId, OffsetDateTime } } + /** The buyers who put the seller's listings in their favorites. */ + public final class Favorites { + private final FavoritesApi api = new FavoritesApi(apiClient); + + private Favorites() {} + + /** + * One page of favorites, the most recent first; every argument may be {@code null}. {@code from} is inclusive and + * {@code to} exclusive, on the date of the favorite; {@code accountId} and {@code itemId} keep the favorites of one + * marketplace account or one item. + */ + public FavoritePage list(Integer limit, String cursor, UUID accountId, Long itemId, OffsetDateTime from, + OffsetDateTime to) { + return call(false, h -> api.listFavorites(limit, cursor, from, to, accountId, itemId, h)); + } + + /** One page of the favorites of an item, on every account it is listed on, the most recent first. */ + public FavoritePage listItem(long id, Integer limit, String cursor, OffsetDateTime from, OffsetDateTime to) { + return call(false, h -> api.listItemFavorites(id, limit, cursor, from, to, h)); + } + + /** Every favorite, page after page, with the same filters. */ + public Iterable listAll(Integer limit, UUID accountId, Long itemId, OffsetDateTime from, + OffsetDateTime to) { + return new Paginator<>(cursor -> list(limit, cursor, accountId, itemId, from, to), + p -> page(p.getData(), p.getNextCursor())); + } + + /** Every favorite of an item, page after page, with the same period. */ + public Iterable listAllItem(long id, Integer limit, OffsetDateTime from, OffsetDateTime to) { + return new Paginator<>(cursor -> listItem(id, limit, cursor, from, to), p -> page(p.getData(), p.getNextCursor())); + } + } + + /** 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 seller's webhook endpoints, their secrets and deliveries, and the events of the last 7 days. */ + public final class Webhooks { + private final WebhooksApi api = new WebhooksApi(apiClient); + + private Webhooks() {} + + /** The seller's endpoints, without their secrets (at most 5: a single page). */ + public WebhookEndpointPage endpoints() { return call(false, h -> api.listWebhookEndpoints(h)); } + + /** One endpoint by its identifier. */ + public WebhookEndpoint endpoint(UUID id) { return call(false, h -> api.getWebhookEndpoint(id, h)); } + + /** Creates an endpoint with a random {@code Idempotency-Key}; the answer carries its signing secret. */ + public CreatedWebhookEndpoint createEndpoint(WebhookEndpointCreateRequest request) { return createEndpoint(request, null); } + + /** Creates an endpoint; {@code idempotencyKey} may be {@code null}. The answer carries its signing secret. */ + public CreatedWebhookEndpoint createEndpoint(WebhookEndpointCreateRequest request, String idempotencyKey) { + String key = key(idempotencyKey); + return call(false, h -> api.createWebhookEndpoint(key, request)); + } + + /** + * Updates the given fields of an endpoint (a JSON merge patch: the fields left out are kept; + * {@code setDescription(null)} clears the description). Status {@code enabled} re-enables a disabled endpoint. + */ + public WebhookEndpoint updateEndpoint(UUID id, WebhookEndpointUpdateRequest request) { + return call(false, h -> api.updateWebhookEndpoint(id, request, h)); + } + + /** Deletes an endpoint; its pending deliveries are dropped. */ + public void deleteEndpoint(UUID id) { + call(false, h -> { + api.deleteWebhookEndpoint(id, h); + return null; + }); + } + + /** The current signing secret of an endpoint. */ + public WebhookSecret secret(UUID id) { return call(false, h -> api.getWebhookSecret(id, h)); } + + /** + * A new signing secret, with a random {@code Idempotency-Key}; the previous one stays valid + * {@code expiresInHours} ({@code null}: 24, {@code 0}: stopped at once). + */ + public WebhookSecret rotateSecret(UUID id, Long expiresInHours) { return rotateSecret(id, expiresInHours, null); } + + /** A new signing secret; {@code expiresInHours} and {@code idempotencyKey} may be {@code null}. */ + public WebhookSecret rotateSecret(UUID id, Long expiresInHours, String idempotencyKey) { + String key = key(idempotencyKey); + WebhookSecretRotateRequest body = new WebhookSecretRotateRequest(); + if (expiresInHours != null) body.setExpiresInHours(expiresInHours); + return call(false, h -> api.rotateWebhookSecret(id, key, body)); + } + + /** Sends a {@code webhook.test} event to the endpoint now and returns how it answered. */ + public WebhookTestResult test(UUID id) { return call(true, h -> api.testWebhookEndpoint(id, h)); } + + /** One page of the deliveries of an endpoint over the last 7 days, the most recent first; filters may be {@code null}. */ + public WebhookDeliveryPage deliveries(UUID id, Integer limit, String cursor, String status, String type) { + return call(false, h -> api.listWebhookDeliveries(id, status, type, limit, cursor, h)); + } + + /** Every delivery of an endpoint, page after page, with the same filters. */ + public Iterable deliveriesAll(UUID id, Integer limit, String status, String type) { + return new Paginator<>(cursor -> deliveries(id, limit, cursor, status, type), p -> page(p.getData(), p.getNextCursor())); + } + + /** Sends one event to the endpoint again, with the same {@code webhook-id} and a random {@code Idempotency-Key}. */ + public WebhookDelivery retryDelivery(UUID id, UUID deliveryId) { return retryDelivery(id, deliveryId, null); } + + /** Sends one event to the endpoint again; {@code idempotencyKey} may be {@code null}. */ + public WebhookDelivery retryDelivery(UUID id, UUID deliveryId, String idempotencyKey) { + String key = key(idempotencyKey); + return call(false, h -> api.retryWebhookDelivery(id, deliveryId, key)); + } + + /** Sends again the failed deliveries since {@code since} (7 days at most, 1,000 per call: call again while {@code hasMore}). */ + public WebhookRecovery recover(UUID id, OffsetDateTime since) { return recover(id, since, null); } + + /** Sends again the failed deliveries since {@code since}; {@code idempotencyKey} may be {@code null}. */ + public WebhookRecovery recover(UUID id, OffsetDateTime since, String idempotencyKey) { + String key = key(idempotencyKey); + WebhookRecoverRequest body = new WebhookRecoverRequest().since(since); + return call(false, h -> api.recoverWebhookDeliveries(id, key, body)); + } + + /** + * One page of the events of the last 7 days, the oldest first: what a client that was offline catches up. + * {@code types} (may be {@code null}) are joined by commas. + */ + public WebhookEventPage events(Integer limit, String cursor, OffsetDateTime since, List types) { + String type = types == null || types.isEmpty() ? null : String.join(",", types); + return call(false, h -> api.listWebhookEvents(since, type, limit, cursor, h)); + } + + /** Every event, page after page, with the same filters. */ + public Iterable eventsAll(Integer limit, OffsetDateTime since, List types) { + return new Paginator<>(cursor -> events(limit, cursor, since, types), p -> page(p.getData(), p.getNextCursor())); + } + + /** The catalog of event types and the scope each one needs. */ + public WebhookEventTypeList eventTypes() { return call(false, h -> api.listWebhookEventTypes(h)); } + } + /** * 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/api/ConversationsApi.java b/src/main/java/com/controlresell/sdk/generated/api/ConversationsApi.java index f5a4a94..bfb367f 100644 --- a/src/main/java/com/controlresell/sdk/generated/api/ConversationsApi.java +++ b/src/main/java/com/controlresell/sdk/generated/api/ConversationsApi.java @@ -445,69 +445,81 @@ private HttpRequest.Builder listConversationMessagesRequestBuilder(@jakarta.anno /** * List the seller's conversations - * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. Requires `conversations:read`. + * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. `buyerId`, `itemId` and `offerStatus` combine with the other filters (AND): `buyerId` is the buyer's identifier on the marketplace (a conversation's `buyerId`); `itemId` keeps the conversations about the item, through their transactions on the marketplace (a conversation the marketplace ties to no listing of the item is not found); `offerStatus` keeps those with at least one offer currently at that status, and with `itemId` that same offer is on the item. An `itemId` that is not one of the seller's items answers an empty page. Requires `conversations: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 unread `true`: only conversations with an unread buyer message; `false`: the others. (optional) * @param accountId Only the conversations of this marketplace account (`GET /accounts`). (optional) * @param from Only the conversations whose last message is at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) * @param to Only the conversations whose last message is before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param buyerId Only the conversations with this buyer, by their identifier on the marketplace (a conversation's or a favorite's `buyerId`). (optional) + * @param itemId Only the conversations about this item of the seller (`GET /items`), through their transactions on the marketplace. (optional) + * @param offerStatus Only the conversations with at least one offer currently at this status: `PENDING`, `ACCEPTED`, `REJECTED` or `CANCELED`; with `itemId`, an offer on that item. (optional) * @return ConversationPage * @throws ApiException if fails to make API call */ - public ConversationPage listConversations(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { - return listConversations(limit, cursor, unread, accountId, from, to, null); + public ConversationPage listConversations(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable String buyerId, @jakarta.annotation.Nullable Long itemId, @jakarta.annotation.Nullable String offerStatus) throws ApiException { + return listConversations(limit, cursor, unread, accountId, from, to, buyerId, itemId, offerStatus, null); } /** * List the seller's conversations - * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. Requires `conversations:read`. + * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. `buyerId`, `itemId` and `offerStatus` combine with the other filters (AND): `buyerId` is the buyer's identifier on the marketplace (a conversation's `buyerId`); `itemId` keeps the conversations about the item, through their transactions on the marketplace (a conversation the marketplace ties to no listing of the item is not found); `offerStatus` keeps those with at least one offer currently at that status, and with `itemId` that same offer is on the item. An `itemId` that is not one of the seller's items answers an empty page. Requires `conversations: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 unread `true`: only conversations with an unread buyer message; `false`: the others. (optional) * @param accountId Only the conversations of this marketplace account (`GET /accounts`). (optional) * @param from Only the conversations whose last message is at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) * @param to Only the conversations whose last message is before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param buyerId Only the conversations with this buyer, by their identifier on the marketplace (a conversation's or a favorite's `buyerId`). (optional) + * @param itemId Only the conversations about this item of the seller (`GET /items`), through their transactions on the marketplace. (optional) + * @param offerStatus Only the conversations with at least one offer currently at this status: `PENDING`, `ACCEPTED`, `REJECTED` or `CANCELED`; with `itemId`, an offer on that item. (optional) * @param headers Optional headers to include in the request * @return ConversationPage * @throws ApiException if fails to make API call */ - public ConversationPage listConversations(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, Map headers) throws ApiException { - ApiResponse localVarResponse = listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, headers); + public ConversationPage listConversations(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable String buyerId, @jakarta.annotation.Nullable Long itemId, @jakarta.annotation.Nullable String offerStatus, Map headers) throws ApiException { + ApiResponse localVarResponse = listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, buyerId, itemId, offerStatus, headers); return localVarResponse.getData(); } /** * List the seller's conversations - * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. Requires `conversations:read`. + * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. `buyerId`, `itemId` and `offerStatus` combine with the other filters (AND): `buyerId` is the buyer's identifier on the marketplace (a conversation's `buyerId`); `itemId` keeps the conversations about the item, through their transactions on the marketplace (a conversation the marketplace ties to no listing of the item is not found); `offerStatus` keeps those with at least one offer currently at that status, and with `itemId` that same offer is on the item. An `itemId` that is not one of the seller's items answers an empty page. Requires `conversations: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 unread `true`: only conversations with an unread buyer message; `false`: the others. (optional) * @param accountId Only the conversations of this marketplace account (`GET /accounts`). (optional) * @param from Only the conversations whose last message is at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) * @param to Only the conversations whose last message is before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param buyerId Only the conversations with this buyer, by their identifier on the marketplace (a conversation's or a favorite's `buyerId`). (optional) + * @param itemId Only the conversations about this item of the seller (`GET /items`), through their transactions on the marketplace. (optional) + * @param offerStatus Only the conversations with at least one offer currently at this status: `PENDING`, `ACCEPTED`, `REJECTED` or `CANCELED`; with `itemId`, an offer on that item. (optional) * @return ApiResponse<ConversationPage> * @throws ApiException if fails to make API call */ - public ApiResponse listConversationsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { - return listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, null); + public ApiResponse listConversationsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable String buyerId, @jakarta.annotation.Nullable Long itemId, @jakarta.annotation.Nullable String offerStatus) throws ApiException { + return listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, buyerId, itemId, offerStatus, null); } /** * List the seller's conversations - * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. Requires `conversations:read`. + * The conversations with buyers on the seller's marketplace accounts, latest activity first, one page at a time. A conversation that receives a message while you read moves to the head: read again from the first page to see it. Pass the `nextCursor` of a page as `cursor` with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the last message: `from` is inclusive, `to` exclusive, and the period is read page by page like the whole list. `buyerId`, `itemId` and `offerStatus` combine with the other filters (AND): `buyerId` is the buyer's identifier on the marketplace (a conversation's `buyerId`); `itemId` keeps the conversations about the item, through their transactions on the marketplace (a conversation the marketplace ties to no listing of the item is not found); `offerStatus` keeps those with at least one offer currently at that status, and with `itemId` that same offer is on the item. An `itemId` that is not one of the seller's items answers an empty page. Requires `conversations: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 unread `true`: only conversations with an unread buyer message; `false`: the others. (optional) * @param accountId Only the conversations of this marketplace account (`GET /accounts`). (optional) * @param from Only the conversations whose last message is at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) * @param to Only the conversations whose last message is before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param buyerId Only the conversations with this buyer, by their identifier on the marketplace (a conversation's or a favorite's `buyerId`). (optional) + * @param itemId Only the conversations about this item of the seller (`GET /items`), through their transactions on the marketplace. (optional) + * @param offerStatus Only the conversations with at least one offer currently at this status: `PENDING`, `ACCEPTED`, `REJECTED` or `CANCELED`; with `itemId`, an offer on that item. (optional) * @param headers Optional headers to include in the request * @return ApiResponse<ConversationPage> * @throws ApiException if fails to make API call */ - public ApiResponse listConversationsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = listConversationsRequestBuilder(limit, cursor, unread, accountId, from, to, headers); + public ApiResponse listConversationsWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable String buyerId, @jakarta.annotation.Nullable Long itemId, @jakarta.annotation.Nullable String offerStatus, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listConversationsRequestBuilder(limit, cursor, unread, accountId, from, to, buyerId, itemId, offerStatus, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -554,7 +566,7 @@ public ApiResponse listConversationsWithHttpInfo(@jakarta.anno } } - private HttpRequest.Builder listConversationsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, Map headers) throws ApiException { + private HttpRequest.Builder listConversationsRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable Boolean unread, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable String buyerId, @jakarta.annotation.Nullable Long itemId, @jakarta.annotation.Nullable String offerStatus, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -575,6 +587,12 @@ private HttpRequest.Builder listConversationsRequestBuilder(@jakarta.annotation. localVarQueryParams.addAll(ApiClient.parameterToPairs("from", from)); localVarQueryParameterBaseName = "to"; localVarQueryParams.addAll(ApiClient.parameterToPairs("to", to)); + localVarQueryParameterBaseName = "buyerId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("buyerId", buyerId)); + localVarQueryParameterBaseName = "itemId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("itemId", itemId)); + localVarQueryParameterBaseName = "offerStatus"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("offerStatus", offerStatus)); if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { StringJoiner queryJoiner = new StringJoiner("&"); diff --git a/src/main/java/com/controlresell/sdk/generated/api/FavoritesApi.java b/src/main/java/com/controlresell/sdk/generated/api/FavoritesApi.java new file mode 100644 index 0000000..061cd67 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/api/FavoritesApi.java @@ -0,0 +1,481 @@ +/* + * 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.ErrorResponse; +import com.controlresell.sdk.generated.model.FavoritePage; +import java.time.OffsetDateTime; +import java.util.UUID; + +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 FavoritesApi { + /** + * 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 FavoritesApi() { + this(Configuration.getDefaultApiClient()); + } + + public FavoritesApi(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; + } + + /** + * List the favorites of the seller's listings + * The favorites of the listings of every marketplace account of the seller. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. An `accountId` or an `itemId` that is not the seller's answers an empty page. 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 from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param accountId Only the favorites of the listings of this marketplace account (`GET /accounts`). (optional) + * @param itemId Only the favorites of the listings of this item (`GET /items`). (optional) + * @return FavoritePage + * @throws ApiException if fails to make API call + */ + public FavoritePage listFavorites(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable Long itemId) throws ApiException { + return listFavorites(limit, cursor, from, to, accountId, itemId, null); + } + + /** + * List the favorites of the seller's listings + * The favorites of the listings of every marketplace account of the seller. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. An `accountId` or an `itemId` that is not the seller's answers an empty page. 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 from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param accountId Only the favorites of the listings of this marketplace account (`GET /accounts`). (optional) + * @param itemId Only the favorites of the listings of this item (`GET /items`). (optional) + * @param headers Optional headers to include in the request + * @return FavoritePage + * @throws ApiException if fails to make API call + */ + public FavoritePage listFavorites(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable Long itemId, Map headers) throws ApiException { + ApiResponse localVarResponse = listFavoritesWithHttpInfo(limit, cursor, from, to, accountId, itemId, headers); + return localVarResponse.getData(); + } + + /** + * List the favorites of the seller's listings + * The favorites of the listings of every marketplace account of the seller. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. An `accountId` or an `itemId` that is not the seller's answers an empty page. 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 from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param accountId Only the favorites of the listings of this marketplace account (`GET /accounts`). (optional) + * @param itemId Only the favorites of the listings of this item (`GET /items`). (optional) + * @return ApiResponse<FavoritePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listFavoritesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable Long itemId) throws ApiException { + return listFavoritesWithHttpInfo(limit, cursor, from, to, accountId, itemId, null); + } + + /** + * List the favorites of the seller's listings + * The favorites of the listings of every marketplace account of the seller. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. An `accountId` or an `itemId` that is not the seller's answers an empty page. 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 from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param accountId Only the favorites of the listings of this marketplace account (`GET /accounts`). (optional) + * @param itemId Only the favorites of the listings of this item (`GET /items`). (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<FavoritePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listFavoritesWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable Long itemId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listFavoritesRequestBuilder(limit, cursor, from, to, accountId, itemId, 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("listFavorites", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + FavoritePage 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 listFavoritesRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, @jakarta.annotation.Nullable UUID accountId, @jakarta.annotation.Nullable Long itemId, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/favorites"; + + 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 = "from"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("from", from)); + localVarQueryParameterBaseName = "to"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("to", to)); + localVarQueryParameterBaseName = "accountId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("accountId", accountId)); + localVarQueryParameterBaseName = "itemId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("itemId", itemId)); + + 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 favorites of an item + * The favorites of the item's listings, on every account it is listed on. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. Requires `items:read`. + * @param id The item's identifier, a number. (required) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @return FavoritePage + * @throws ApiException if fails to make API call + */ + public FavoritePage listItemFavorites(@jakarta.annotation.Nonnull Long id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { + return listItemFavorites(id, limit, cursor, from, to, null); + } + + /** + * List the favorites of an item + * The favorites of the item's listings, on every account it is listed on. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. Requires `items:read`. + * @param id The item's identifier, a number. (required) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param headers Optional headers to include in the request + * @return FavoritePage + * @throws ApiException if fails to make API call + */ + public FavoritePage listItemFavorites(@jakarta.annotation.Nonnull Long id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, Map headers) throws ApiException { + ApiResponse localVarResponse = listItemFavoritesWithHttpInfo(id, limit, cursor, from, to, headers); + return localVarResponse.getData(); + } + + /** + * List the favorites of an item + * The favorites of the item's listings, on every account it is listed on. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. Requires `items:read`. + * @param id The item's identifier, a number. (required) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @return ApiResponse<FavoritePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listItemFavoritesWithHttpInfo(@jakarta.annotation.Nonnull Long id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { + return listItemFavoritesWithHttpInfo(id, limit, cursor, from, to, null); + } + + /** + * List the favorites of an item + * The favorites of the item's listings, on every account it is listed on. A favorite is a buyer of the marketplace who put one of the seller's listings in their favorites, named by their identifier on the marketplace (`buyerId`). Its `item` is a summary of the item of the listing, `null` when ControlResell does not follow the listing. The most recent first (by `createdAt`, then `id`), one page at a time: pass the `nextCursor` of a page as `cursor` to read the next one, with the same filters (a cursor reused with other filters is an `invalid_cursor`). `from` and `to` go straight to a period of the favorite's date: `from` is inclusive, `to` exclusive. Requires `items:read`. + * @param id The item's identifier, a number. (required) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param from Only the favorites created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the favorites created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<FavoritePage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listItemFavoritesWithHttpInfo(@jakarta.annotation.Nonnull Long id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listItemFavoritesRequestBuilder(id, limit, cursor, from, to, 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("listItemFavorites", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + FavoritePage 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 listItemFavoritesRequestBuilder(@jakarta.annotation.Nonnull Long id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to, 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 listItemFavorites"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/items/{id}/favorites" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + 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 = "from"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("from", from)); + localVarQueryParameterBaseName = "to"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("to", to)); + + 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/api/WebhooksApi.java b/src/main/java/com/controlresell/sdk/generated/api/WebhooksApi.java new file mode 100644 index 0000000..ee8ec22 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/api/WebhooksApi.java @@ -0,0 +1,1844 @@ +/* + * 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.CreatedWebhookEndpoint; +import com.controlresell.sdk.generated.model.ErrorResponse; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.controlresell.sdk.generated.model.WebhookDelivery; +import com.controlresell.sdk.generated.model.WebhookDeliveryPage; +import com.controlresell.sdk.generated.model.WebhookEndpoint; +import com.controlresell.sdk.generated.model.WebhookEndpointCreateRequest; +import com.controlresell.sdk.generated.model.WebhookEndpointPage; +import com.controlresell.sdk.generated.model.WebhookEndpointUpdateRequest; +import com.controlresell.sdk.generated.model.WebhookEventPage; +import com.controlresell.sdk.generated.model.WebhookEventTypeList; +import com.controlresell.sdk.generated.model.WebhookRecoverRequest; +import com.controlresell.sdk.generated.model.WebhookRecovery; +import com.controlresell.sdk.generated.model.WebhookSecret; +import com.controlresell.sdk.generated.model.WebhookSecretRotateRequest; +import com.controlresell.sdk.generated.model.WebhookTestResult; + +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 WebhooksApi { + /** + * 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 WebhooksApi() { + this(Configuration.getDefaultApiClient()); + } + + public WebhooksApi(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; + } + + /** + * Create a webhook endpoint + * Registers an `https` URL that receives the seller's events, signed with the secret this response gives (`Cache-Control: no-store`; read it again with `GET /webhook-endpoints/{id}/secret`). `eventTypes` lists the types (`GET /webhook-event-types`) or is `[\"*\"]` for all; the key must be able to read the object of each type. `payloadMode` is `light` (the default) or `full`. 5 endpoints at most per seller. Requires `webhooks:write` and an `Idempotency-Key`. + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookEndpointCreateRequest (required) + * @return CreatedWebhookEndpoint + * @throws ApiException if fails to make API call + */ + public CreatedWebhookEndpoint createWebhookEndpoint(@jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookEndpointCreateRequest webhookEndpointCreateRequest) throws ApiException { + return createWebhookEndpoint(idempotencyKey, webhookEndpointCreateRequest, null); + } + + /** + * Create a webhook endpoint + * Registers an `https` URL that receives the seller's events, signed with the secret this response gives (`Cache-Control: no-store`; read it again with `GET /webhook-endpoints/{id}/secret`). `eventTypes` lists the types (`GET /webhook-event-types`) or is `[\"*\"]` for all; the key must be able to read the object of each type. `payloadMode` is `light` (the default) or `full`. 5 endpoints at most per seller. Requires `webhooks:write` and an `Idempotency-Key`. + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookEndpointCreateRequest (required) + * @param headers Optional headers to include in the request + * @return CreatedWebhookEndpoint + * @throws ApiException if fails to make API call + */ + public CreatedWebhookEndpoint createWebhookEndpoint(@jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookEndpointCreateRequest webhookEndpointCreateRequest, Map headers) throws ApiException { + ApiResponse localVarResponse = createWebhookEndpointWithHttpInfo(idempotencyKey, webhookEndpointCreateRequest, headers); + return localVarResponse.getData(); + } + + /** + * Create a webhook endpoint + * Registers an `https` URL that receives the seller's events, signed with the secret this response gives (`Cache-Control: no-store`; read it again with `GET /webhook-endpoints/{id}/secret`). `eventTypes` lists the types (`GET /webhook-event-types`) or is `[\"*\"]` for all; the key must be able to read the object of each type. `payloadMode` is `light` (the default) or `full`. 5 endpoints at most per seller. Requires `webhooks:write` and an `Idempotency-Key`. + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookEndpointCreateRequest (required) + * @return ApiResponse<CreatedWebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse createWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookEndpointCreateRequest webhookEndpointCreateRequest) throws ApiException { + return createWebhookEndpointWithHttpInfo(idempotencyKey, webhookEndpointCreateRequest, null); + } + + /** + * Create a webhook endpoint + * Registers an `https` URL that receives the seller's events, signed with the secret this response gives (`Cache-Control: no-store`; read it again with `GET /webhook-endpoints/{id}/secret`). `eventTypes` lists the types (`GET /webhook-event-types`) or is `[\"*\"]` for all; the key must be able to read the object of each type. `payloadMode` is `light` (the default) or `full`. 5 endpoints at most per seller. Requires `webhooks:write` and an `Idempotency-Key`. + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookEndpointCreateRequest (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<CreatedWebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse createWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookEndpointCreateRequest webhookEndpointCreateRequest, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = createWebhookEndpointRequestBuilder(idempotencyKey, webhookEndpointCreateRequest, 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("createWebhookEndpoint", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + CreatedWebhookEndpoint 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 createWebhookEndpointRequestBuilder(@jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookEndpointCreateRequest webhookEndpointCreateRequest, Map headers) throws ApiException { + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) { + throw new ApiException(400, "Missing the required parameter 'idempotencyKey' when calling createWebhookEndpoint"); + } + // verify the required parameter 'webhookEndpointCreateRequest' is set + if (webhookEndpointCreateRequest == null) { + throw new ApiException(400, "Missing the required parameter 'webhookEndpointCreateRequest' when calling createWebhookEndpoint"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (idempotencyKey != null) { + localVarRequestBuilder.header("Idempotency-Key", idempotencyKey.toString()); + } + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(webhookEndpointCreateRequest); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Delete a webhook endpoint + * Deletes the endpoint; its pending deliveries are abandoned. Open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @throws ApiException if fails to make API call + */ + public void deleteWebhookEndpoint(@jakarta.annotation.Nonnull UUID id) throws ApiException { + deleteWebhookEndpoint(id, null); + } + + /** + * Delete a webhook endpoint + * Deletes the endpoint; its pending deliveries are abandoned. Open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void deleteWebhookEndpoint(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + deleteWebhookEndpointWithHttpInfo(id, headers); + } + + /** + * Delete a webhook endpoint + * Deletes the endpoint; its pending deliveries are abandoned. Open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return deleteWebhookEndpointWithHttpInfo(id, null); + } + + /** + * Delete a webhook endpoint + * Deletes the endpoint; its pending deliveries are abandoned. Open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = deleteWebhookEndpointRequestBuilder(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("deleteWebhookEndpoint", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody != null) { + localVarResponseBody.readAllBytes(); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } 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 deleteWebhookEndpointRequestBuilder(@jakarta.annotation.Nonnull UUID 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 deleteWebhookEndpoint"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", 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 one webhook endpoint + * One endpoint of the seller, its status and why it is disabled, without its secret. Open without the plan. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @return WebhookEndpoint + * @throws ApiException if fails to make API call + */ + public WebhookEndpoint getWebhookEndpoint(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return getWebhookEndpoint(id, null); + } + + /** + * Read one webhook endpoint + * One endpoint of the seller, its status and why it is disabled, without its secret. Open without the plan. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return WebhookEndpoint + * @throws ApiException if fails to make API call + */ + public WebhookEndpoint getWebhookEndpoint(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + ApiResponse localVarResponse = getWebhookEndpointWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * Read one webhook endpoint + * One endpoint of the seller, its status and why it is disabled, without its secret. Open without the plan. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @return ApiResponse<WebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse getWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return getWebhookEndpointWithHttpInfo(id, null); + } + + /** + * Read one webhook endpoint + * One endpoint of the seller, its status and why it is disabled, without its secret. Open without the plan. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse getWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getWebhookEndpointRequestBuilder(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("getWebhookEndpoint", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookEndpoint 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 getWebhookEndpointRequestBuilder(@jakarta.annotation.Nonnull UUID 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 getWebhookEndpoint"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{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 the signing secret of a webhook endpoint + * The current signing secret (`Cache-Control: no-store`), and until when the previous one still signs after a rotation. Needs a key that can read everything the endpoint receives; the seller is told by e-mail (once an hour at most). Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @return WebhookSecret + * @throws ApiException if fails to make API call + */ + public WebhookSecret getWebhookSecret(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return getWebhookSecret(id, null); + } + + /** + * Read the signing secret of a webhook endpoint + * The current signing secret (`Cache-Control: no-store`), and until when the previous one still signs after a rotation. Needs a key that can read everything the endpoint receives; the seller is told by e-mail (once an hour at most). Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return WebhookSecret + * @throws ApiException if fails to make API call + */ + public WebhookSecret getWebhookSecret(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + ApiResponse localVarResponse = getWebhookSecretWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * Read the signing secret of a webhook endpoint + * The current signing secret (`Cache-Control: no-store`), and until when the previous one still signs after a rotation. Needs a key that can read everything the endpoint receives; the seller is told by e-mail (once an hour at most). Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @return ApiResponse<WebhookSecret> + * @throws ApiException if fails to make API call + */ + public ApiResponse getWebhookSecretWithHttpInfo(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return getWebhookSecretWithHttpInfo(id, null); + } + + /** + * Read the signing secret of a webhook endpoint + * The current signing secret (`Cache-Control: no-store`), and until when the previous one still signs after a rotation. Needs a key that can read everything the endpoint receives; the seller is told by e-mail (once an hour at most). Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookSecret> + * @throws ApiException if fails to make API call + */ + public ApiResponse getWebhookSecretWithHttpInfo(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getWebhookSecretRequestBuilder(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("getWebhookSecret", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookSecret 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 getWebhookSecretRequestBuilder(@jakarta.annotation.Nonnull UUID 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 getWebhookSecret"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/secret" + .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 deliveries of a webhook endpoint + * The delivery log of the last 7 days, the most recent first, one page at a time: status, attempt, HTTP status, duration and error, never the payload. Filters `status` (`pending`, `delivered`, `failed`) and `type`. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param status Only the deliveries in this status: `pending`, `delivered` or `failed`. (optional) + * @param type Only the deliveries of this event type. (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @return WebhookDeliveryPage + * @throws ApiException if fails to make API call + */ + public WebhookDeliveryPage listWebhookDeliveries(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable String status, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listWebhookDeliveries(id, status, type, limit, cursor, null); + } + + /** + * List the deliveries of a webhook endpoint + * The delivery log of the last 7 days, the most recent first, one page at a time: status, attempt, HTTP status, duration and error, never the payload. Filters `status` (`pending`, `delivered`, `failed`) and `type`. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param status Only the deliveries in this status: `pending`, `delivered` or `failed`. (optional) + * @param type Only the deliveries of this event type. (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param headers Optional headers to include in the request + * @return WebhookDeliveryPage + * @throws ApiException if fails to make API call + */ + public WebhookDeliveryPage listWebhookDeliveries(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable String status, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + ApiResponse localVarResponse = listWebhookDeliveriesWithHttpInfo(id, status, type, limit, cursor, headers); + return localVarResponse.getData(); + } + + /** + * List the deliveries of a webhook endpoint + * The delivery log of the last 7 days, the most recent first, one page at a time: status, attempt, HTTP status, duration and error, never the payload. Filters `status` (`pending`, `delivered`, `failed`) and `type`. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param status Only the deliveries in this status: `pending`, `delivered` or `failed`. (optional) + * @param type Only the deliveries of this event type. (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @return ApiResponse<WebhookDeliveryPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookDeliveriesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable String status, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listWebhookDeliveriesWithHttpInfo(id, status, type, limit, cursor, null); + } + + /** + * List the deliveries of a webhook endpoint + * The delivery log of the last 7 days, the most recent first, one page at a time: status, attempt, HTTP status, duration and error, never the payload. Filters `status` (`pending`, `delivered`, `failed`) and `type`. Requires `webhooks:read`. + * @param id The endpoint's identifier, a UUID. (required) + * @param status Only the deliveries in this status: `pending`, `delivered` or `failed`. (optional) + * @param type Only the deliveries of this event type. (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookDeliveryPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookDeliveriesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable String status, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listWebhookDeliveriesRequestBuilder(id, status, type, limit, cursor, 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("listWebhookDeliveries", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookDeliveryPage 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 listWebhookDeliveriesRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable String status, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, 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 listWebhookDeliveries"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/deliveries" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "status"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("status", status)); + localVarQueryParameterBaseName = "type"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("type", type)); + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + + 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 seller's webhook endpoints + * Every webhook endpoint of the seller (5 at most), without their secrets: one page, `nextCursor` is always null. Open without the plan, so a seller can still see what receives their events. Requires `webhooks:read`. + * @return WebhookEndpointPage + * @throws ApiException if fails to make API call + */ + public WebhookEndpointPage listWebhookEndpoints() throws ApiException { + return listWebhookEndpoints(null); + } + + /** + * List the seller's webhook endpoints + * Every webhook endpoint of the seller (5 at most), without their secrets: one page, `nextCursor` is always null. Open without the plan, so a seller can still see what receives their events. Requires `webhooks:read`. + * @param headers Optional headers to include in the request + * @return WebhookEndpointPage + * @throws ApiException if fails to make API call + */ + public WebhookEndpointPage listWebhookEndpoints(Map headers) throws ApiException { + ApiResponse localVarResponse = listWebhookEndpointsWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * List the seller's webhook endpoints + * Every webhook endpoint of the seller (5 at most), without their secrets: one page, `nextCursor` is always null. Open without the plan, so a seller can still see what receives their events. Requires `webhooks:read`. + * @return ApiResponse<WebhookEndpointPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEndpointsWithHttpInfo() throws ApiException { + return listWebhookEndpointsWithHttpInfo(null); + } + + /** + * List the seller's webhook endpoints + * Every webhook endpoint of the seller (5 at most), without their secrets: one page, `nextCursor` is always null. Open without the plan, so a seller can still see what receives their events. Requires `webhooks:read`. + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookEndpointPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEndpointsWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listWebhookEndpointsRequestBuilder(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("listWebhookEndpoints", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookEndpointPage 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 listWebhookEndpointsRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints"; + + 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 webhook event types + * The catalogue of event types and the read scope each one needs; `webhook.test` is only sent by `POST /webhook-endpoints/{id}/test`, never subscribed to. Open to every key, without the plan. + * @return WebhookEventTypeList + * @throws ApiException if fails to make API call + */ + public WebhookEventTypeList listWebhookEventTypes() throws ApiException { + return listWebhookEventTypes(null); + } + + /** + * List the webhook event types + * The catalogue of event types and the read scope each one needs; `webhook.test` is only sent by `POST /webhook-endpoints/{id}/test`, never subscribed to. Open to every key, without the plan. + * @param headers Optional headers to include in the request + * @return WebhookEventTypeList + * @throws ApiException if fails to make API call + */ + public WebhookEventTypeList listWebhookEventTypes(Map headers) throws ApiException { + ApiResponse localVarResponse = listWebhookEventTypesWithHttpInfo(headers); + return localVarResponse.getData(); + } + + /** + * List the webhook event types + * The catalogue of event types and the read scope each one needs; `webhook.test` is only sent by `POST /webhook-endpoints/{id}/test`, never subscribed to. Open to every key, without the plan. + * @return ApiResponse<WebhookEventTypeList> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEventTypesWithHttpInfo() throws ApiException { + return listWebhookEventTypesWithHttpInfo(null); + } + + /** + * List the webhook event types + * The catalogue of event types and the read scope each one needs; `webhook.test` is only sent by `POST /webhook-endpoints/{id}/test`, never subscribed to. Open to every key, without the plan. + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookEventTypeList> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEventTypesWithHttpInfo(Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listWebhookEventTypesRequestBuilder(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("listWebhookEventTypes", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookEventTypeList 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 listWebhookEventTypesRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-event-types"; + + 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 seller's events + * The events of the last 7 days, the oldest first from `since`, in the envelope of a light webhook body: the way to catch up after being offline. Only the types the key can read (a type asked without its scope is a 403); `type` takes several types, comma separated. + * @param since Only the events created at or after this instant, ISO-8601 with its offset, at most 7 days ago (the default). (optional) + * @param type Only these event types, comma separated (`GET /webhook-event-types`). (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @return WebhookEventPage + * @throws ApiException if fails to make API call + */ + public WebhookEventPage listWebhookEvents(@jakarta.annotation.Nullable OffsetDateTime since, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listWebhookEvents(since, type, limit, cursor, null); + } + + /** + * List the seller's events + * The events of the last 7 days, the oldest first from `since`, in the envelope of a light webhook body: the way to catch up after being offline. Only the types the key can read (a type asked without its scope is a 403); `type` takes several types, comma separated. + * @param since Only the events created at or after this instant, ISO-8601 with its offset, at most 7 days ago (the default). (optional) + * @param type Only these event types, comma separated (`GET /webhook-event-types`). (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param headers Optional headers to include in the request + * @return WebhookEventPage + * @throws ApiException if fails to make API call + */ + public WebhookEventPage listWebhookEvents(@jakarta.annotation.Nullable OffsetDateTime since, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + ApiResponse localVarResponse = listWebhookEventsWithHttpInfo(since, type, limit, cursor, headers); + return localVarResponse.getData(); + } + + /** + * List the seller's events + * The events of the last 7 days, the oldest first from `since`, in the envelope of a light webhook body: the way to catch up after being offline. Only the types the key can read (a type asked without its scope is a 403); `type` takes several types, comma separated. + * @param since Only the events created at or after this instant, ISO-8601 with its offset, at most 7 days ago (the default). (optional) + * @param type Only these event types, comma separated (`GET /webhook-event-types`). (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @return ApiResponse<WebhookEventPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEventsWithHttpInfo(@jakarta.annotation.Nullable OffsetDateTime since, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listWebhookEventsWithHttpInfo(since, type, limit, cursor, null); + } + + /** + * List the seller's events + * The events of the last 7 days, the oldest first from `since`, in the envelope of a light webhook body: the way to catch up after being offline. Only the types the key can read (a type asked without its scope is a 403); `type` takes several types, comma separated. + * @param since Only the events created at or after this instant, ISO-8601 with its offset, at most 7 days ago (the default). (optional) + * @param type Only these event types, comma separated (`GET /webhook-event-types`). (optional) + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookEventPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listWebhookEventsWithHttpInfo(@jakarta.annotation.Nullable OffsetDateTime since, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listWebhookEventsRequestBuilder(since, type, limit, cursor, 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("listWebhookEvents", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookEventPage 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 listWebhookEventsRequestBuilder(@jakarta.annotation.Nullable OffsetDateTime since, @jakarta.annotation.Nullable String type, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/events"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "since"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("since", since)); + localVarQueryParameterBaseName = "type"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("type", type)); + localVarQueryParameterBaseName = "limit"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit)); + localVarQueryParameterBaseName = "cursor"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("cursor", cursor)); + + 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; + } + + /** + * Send the failed deliveries again + * Sends again the `failed` deliveries of this endpoint since `since` (7 days back at most), the oldest first, 1 000 at most per call: call again while `hasMore` is true. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookRecoverRequest (required) + * @return WebhookRecovery + * @throws ApiException if fails to make API call + */ + public WebhookRecovery recoverWebhookDeliveries(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookRecoverRequest webhookRecoverRequest) throws ApiException { + return recoverWebhookDeliveries(id, idempotencyKey, webhookRecoverRequest, null); + } + + /** + * Send the failed deliveries again + * Sends again the `failed` deliveries of this endpoint since `since` (7 days back at most), the oldest first, 1 000 at most per call: call again while `hasMore` is true. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookRecoverRequest (required) + * @param headers Optional headers to include in the request + * @return WebhookRecovery + * @throws ApiException if fails to make API call + */ + public WebhookRecovery recoverWebhookDeliveries(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookRecoverRequest webhookRecoverRequest, Map headers) throws ApiException { + ApiResponse localVarResponse = recoverWebhookDeliveriesWithHttpInfo(id, idempotencyKey, webhookRecoverRequest, headers); + return localVarResponse.getData(); + } + + /** + * Send the failed deliveries again + * Sends again the `failed` deliveries of this endpoint since `since` (7 days back at most), the oldest first, 1 000 at most per call: call again while `hasMore` is true. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookRecoverRequest (required) + * @return ApiResponse<WebhookRecovery> + * @throws ApiException if fails to make API call + */ + public ApiResponse recoverWebhookDeliveriesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookRecoverRequest webhookRecoverRequest) throws ApiException { + return recoverWebhookDeliveriesWithHttpInfo(id, idempotencyKey, webhookRecoverRequest, null); + } + + /** + * Send the failed deliveries again + * Sends again the `failed` deliveries of this endpoint since `since` (7 days back at most), the oldest first, 1 000 at most per call: call again while `hasMore` is true. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookRecoverRequest (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookRecovery> + * @throws ApiException if fails to make API call + */ + public ApiResponse recoverWebhookDeliveriesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookRecoverRequest webhookRecoverRequest, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = recoverWebhookDeliveriesRequestBuilder(id, idempotencyKey, webhookRecoverRequest, 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("recoverWebhookDeliveries", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookRecovery 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 recoverWebhookDeliveriesRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nonnull WebhookRecoverRequest webhookRecoverRequest, 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 recoverWebhookDeliveries"); + } + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) { + throw new ApiException(400, "Missing the required parameter 'idempotencyKey' when calling recoverWebhookDeliveries"); + } + // verify the required parameter 'webhookRecoverRequest' is set + if (webhookRecoverRequest == null) { + throw new ApiException(400, "Missing the required parameter 'webhookRecoverRequest' when calling recoverWebhookDeliveries"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/recover" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (idempotencyKey != null) { + localVarRequestBuilder.header("Idempotency-Key", idempotencyKey.toString()); + } + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(webhookRecoverRequest); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Send a delivery again + * Sends this event to this endpoint again, with the same `webhook-id`: a `failed` or `delivered` delivery goes back to `pending`, its attempts from 1 again. A delivery still `pending` (a retry or a recovery in progress) is already queued: it is not queued a second time, and is returned as it is, its attempts unchanged. 409 when the endpoint is disabled, 410 `event_expired` past 7 days. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param deliveryId The delivery's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @return WebhookDelivery + * @throws ApiException if fails to make API call + */ + public WebhookDelivery retryWebhookDelivery(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull UUID deliveryId, @jakarta.annotation.Nonnull String idempotencyKey) throws ApiException { + return retryWebhookDelivery(id, deliveryId, idempotencyKey, null); + } + + /** + * Send a delivery again + * Sends this event to this endpoint again, with the same `webhook-id`: a `failed` or `delivered` delivery goes back to `pending`, its attempts from 1 again. A delivery still `pending` (a retry or a recovery in progress) is already queued: it is not queued a second time, and is returned as it is, its attempts unchanged. 409 when the endpoint is disabled, 410 `event_expired` past 7 days. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param deliveryId The delivery's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param headers Optional headers to include in the request + * @return WebhookDelivery + * @throws ApiException if fails to make API call + */ + public WebhookDelivery retryWebhookDelivery(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull UUID deliveryId, @jakarta.annotation.Nonnull String idempotencyKey, Map headers) throws ApiException { + ApiResponse localVarResponse = retryWebhookDeliveryWithHttpInfo(id, deliveryId, idempotencyKey, headers); + return localVarResponse.getData(); + } + + /** + * Send a delivery again + * Sends this event to this endpoint again, with the same `webhook-id`: a `failed` or `delivered` delivery goes back to `pending`, its attempts from 1 again. A delivery still `pending` (a retry or a recovery in progress) is already queued: it is not queued a second time, and is returned as it is, its attempts unchanged. 409 when the endpoint is disabled, 410 `event_expired` past 7 days. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param deliveryId The delivery's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @return ApiResponse<WebhookDelivery> + * @throws ApiException if fails to make API call + */ + public ApiResponse retryWebhookDeliveryWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull UUID deliveryId, @jakarta.annotation.Nonnull String idempotencyKey) throws ApiException { + return retryWebhookDeliveryWithHttpInfo(id, deliveryId, idempotencyKey, null); + } + + /** + * Send a delivery again + * Sends this event to this endpoint again, with the same `webhook-id`: a `failed` or `delivered` delivery goes back to `pending`, its attempts from 1 again. A delivery still `pending` (a retry or a recovery in progress) is already queued: it is not queued a second time, and is returned as it is, its attempts unchanged. 409 when the endpoint is disabled, 410 `event_expired` past 7 days. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param deliveryId The delivery's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookDelivery> + * @throws ApiException if fails to make API call + */ + public ApiResponse retryWebhookDeliveryWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull UUID deliveryId, @jakarta.annotation.Nonnull String idempotencyKey, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = retryWebhookDeliveryRequestBuilder(id, deliveryId, idempotencyKey, 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("retryWebhookDelivery", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookDelivery 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 retryWebhookDeliveryRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull UUID deliveryId, @jakarta.annotation.Nonnull String idempotencyKey, 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 retryWebhookDelivery"); + } + // verify the required parameter 'deliveryId' is set + if (deliveryId == null) { + throw new ApiException(400, "Missing the required parameter 'deliveryId' when calling retryWebhookDelivery"); + } + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) { + throw new ApiException(400, "Missing the required parameter 'idempotencyKey' when calling retryWebhookDelivery"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/deliveries/{deliveryId}/retry" + .replace("{id}", ApiClient.urlEncode(id.toString())) + .replace("{deliveryId}", ApiClient.urlEncode(deliveryId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (idempotencyKey != null) { + localVarRequestBuilder.header("Idempotency-Key", idempotencyKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", 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; + } + + /** + * Rotate the signing secret of a webhook endpoint + * A new signing secret, in this response (`Cache-Control: no-store`). The previous one keeps signing too for `expiresInHours` (0 to 72, 24 by default), so the receiver can switch without losing a delivery. Needs a key that can read everything the endpoint receives; the seller is told by e-mail. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookSecretRotateRequest (optional) + * @return WebhookSecret + * @throws ApiException if fails to make API call + */ + public WebhookSecret rotateWebhookSecret(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nullable WebhookSecretRotateRequest webhookSecretRotateRequest) throws ApiException { + return rotateWebhookSecret(id, idempotencyKey, webhookSecretRotateRequest, null); + } + + /** + * Rotate the signing secret of a webhook endpoint + * A new signing secret, in this response (`Cache-Control: no-store`). The previous one keeps signing too for `expiresInHours` (0 to 72, 24 by default), so the receiver can switch without losing a delivery. Needs a key that can read everything the endpoint receives; the seller is told by e-mail. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookSecretRotateRequest (optional) + * @param headers Optional headers to include in the request + * @return WebhookSecret + * @throws ApiException if fails to make API call + */ + public WebhookSecret rotateWebhookSecret(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nullable WebhookSecretRotateRequest webhookSecretRotateRequest, Map headers) throws ApiException { + ApiResponse localVarResponse = rotateWebhookSecretWithHttpInfo(id, idempotencyKey, webhookSecretRotateRequest, headers); + return localVarResponse.getData(); + } + + /** + * Rotate the signing secret of a webhook endpoint + * A new signing secret, in this response (`Cache-Control: no-store`). The previous one keeps signing too for `expiresInHours` (0 to 72, 24 by default), so the receiver can switch without losing a delivery. Needs a key that can read everything the endpoint receives; the seller is told by e-mail. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookSecretRotateRequest (optional) + * @return ApiResponse<WebhookSecret> + * @throws ApiException if fails to make API call + */ + public ApiResponse rotateWebhookSecretWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nullable WebhookSecretRotateRequest webhookSecretRotateRequest) throws ApiException { + return rotateWebhookSecretWithHttpInfo(id, idempotencyKey, webhookSecretRotateRequest, null); + } + + /** + * Rotate the signing secret of a webhook endpoint + * A new signing secret, in this response (`Cache-Control: no-store`). The previous one keeps signing too for `expiresInHours` (0 to 72, 24 by default), so the receiver can switch without losing a delivery. Needs a key that can read everything the endpoint receives; the seller is told by e-mail. Requires `webhooks:write` and an `Idempotency-Key`. + * @param id The endpoint's identifier, a UUID. (required) + * @param idempotencyKey 1 to 255 characters, unique per write: a retry with the same key and the same request answers the first response again (`Idempotent-Replayed: true`), without running the write twice. (required) + * @param webhookSecretRotateRequest (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookSecret> + * @throws ApiException if fails to make API call + */ + public ApiResponse rotateWebhookSecretWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nullable WebhookSecretRotateRequest webhookSecretRotateRequest, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = rotateWebhookSecretRequestBuilder(id, idempotencyKey, webhookSecretRotateRequest, 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("rotateWebhookSecret", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookSecret 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 rotateWebhookSecretRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull String idempotencyKey, @jakarta.annotation.Nullable WebhookSecretRotateRequest webhookSecretRotateRequest, 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 rotateWebhookSecret"); + } + // verify the required parameter 'idempotencyKey' is set + if (idempotencyKey == null) { + throw new ApiException(400, "Missing the required parameter 'idempotencyKey' when calling rotateWebhookSecret"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/rotate-secret" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (idempotencyKey != null) { + localVarRequestBuilder.header("Idempotency-Key", idempotencyKey.toString()); + } + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(webhookSecretRotateRequest); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Send a test event to a webhook endpoint + * Sends one signed `webhook.test` now and waits for the answer (10 seconds in all). An `Idempotency-Key` is accepted and ignored: a test is never replayed. 429 `webhook_endpoint_busy` while the endpoint already receives as many calls as it may. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @return WebhookTestResult + * @throws ApiException if fails to make API call + */ + public WebhookTestResult testWebhookEndpoint(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return testWebhookEndpoint(id, null); + } + + /** + * Send a test event to a webhook endpoint + * Sends one signed `webhook.test` now and waits for the answer (10 seconds in all). An `Idempotency-Key` is accepted and ignored: a test is never replayed. 429 `webhook_endpoint_busy` while the endpoint already receives as many calls as it may. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return WebhookTestResult + * @throws ApiException if fails to make API call + */ + public WebhookTestResult testWebhookEndpoint(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + ApiResponse localVarResponse = testWebhookEndpointWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * Send a test event to a webhook endpoint + * Sends one signed `webhook.test` now and waits for the answer (10 seconds in all). An `Idempotency-Key` is accepted and ignored: a test is never replayed. 429 `webhook_endpoint_busy` while the endpoint already receives as many calls as it may. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @return ApiResponse<WebhookTestResult> + * @throws ApiException if fails to make API call + */ + public ApiResponse testWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id) throws ApiException { + return testWebhookEndpointWithHttpInfo(id, null); + } + + /** + * Send a test event to a webhook endpoint + * Sends one signed `webhook.test` now and waits for the answer (10 seconds in all). An `Idempotency-Key` is accepted and ignored: a test is never replayed. 429 `webhook_endpoint_busy` while the endpoint already receives as many calls as it may. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookTestResult> + * @throws ApiException if fails to make API call + */ + public ApiResponse testWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testWebhookEndpointRequestBuilder(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("testWebhookEndpoint", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookTestResult 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 testWebhookEndpointRequestBuilder(@jakarta.annotation.Nonnull UUID 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 testWebhookEndpoint"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}/test" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", 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; + } + + /** + * Change a webhook endpoint + * A JSON merge patch: a field left out keeps its value, `description: null` clears it. Changing `url` or `payloadMode` needs a key that can read everything the endpoint receives. `status` `disabled` stops the deliveries (pending ones fail); `enabled` turns it back on, its failures reset. Only `{\"status\": \"disabled\"}` is open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param webhookEndpointUpdateRequest (required) + * @return WebhookEndpoint + * @throws ApiException if fails to make API call + */ + public WebhookEndpoint updateWebhookEndpoint(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull WebhookEndpointUpdateRequest webhookEndpointUpdateRequest) throws ApiException { + return updateWebhookEndpoint(id, webhookEndpointUpdateRequest, null); + } + + /** + * Change a webhook endpoint + * A JSON merge patch: a field left out keeps its value, `description: null` clears it. Changing `url` or `payloadMode` needs a key that can read everything the endpoint receives. `status` `disabled` stops the deliveries (pending ones fail); `enabled` turns it back on, its failures reset. Only `{\"status\": \"disabled\"}` is open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param webhookEndpointUpdateRequest (required) + * @param headers Optional headers to include in the request + * @return WebhookEndpoint + * @throws ApiException if fails to make API call + */ + public WebhookEndpoint updateWebhookEndpoint(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull WebhookEndpointUpdateRequest webhookEndpointUpdateRequest, Map headers) throws ApiException { + ApiResponse localVarResponse = updateWebhookEndpointWithHttpInfo(id, webhookEndpointUpdateRequest, headers); + return localVarResponse.getData(); + } + + /** + * Change a webhook endpoint + * A JSON merge patch: a field left out keeps its value, `description: null` clears it. Changing `url` or `payloadMode` needs a key that can read everything the endpoint receives. `status` `disabled` stops the deliveries (pending ones fail); `enabled` turns it back on, its failures reset. Only `{\"status\": \"disabled\"}` is open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param webhookEndpointUpdateRequest (required) + * @return ApiResponse<WebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull WebhookEndpointUpdateRequest webhookEndpointUpdateRequest) throws ApiException { + return updateWebhookEndpointWithHttpInfo(id, webhookEndpointUpdateRequest, null); + } + + /** + * Change a webhook endpoint + * A JSON merge patch: a field left out keeps its value, `description: null` clears it. Changing `url` or `payloadMode` needs a key that can read everything the endpoint receives. `status` `disabled` stops the deliveries (pending ones fail); `enabled` turns it back on, its failures reset. Only `{\"status\": \"disabled\"}` is open without the plan. Requires `webhooks:write`. + * @param id The endpoint's identifier, a UUID. (required) + * @param webhookEndpointUpdateRequest (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<WebhookEndpoint> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateWebhookEndpointWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull WebhookEndpointUpdateRequest webhookEndpointUpdateRequest, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = updateWebhookEndpointRequestBuilder(id, webhookEndpointUpdateRequest, 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("updateWebhookEndpoint", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + WebhookEndpoint 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 updateWebhookEndpointRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nonnull WebhookEndpointUpdateRequest webhookEndpointUpdateRequest, 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 updateWebhookEndpoint"); + } + // verify the required parameter 'webhookEndpointUpdateRequest' is set + if (webhookEndpointUpdateRequest == null) { + throw new ApiException(400, "Missing the required parameter 'webhookEndpointUpdateRequest' when calling updateWebhookEndpoint"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/webhook-endpoints/{id}" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(webhookEndpointUpdateRequest); + localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + 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/main/java/com/controlresell/sdk/generated/model/Conversation.java b/src/main/java/com/controlresell/sdk/generated/model/Conversation.java index 44ac630..cc5cae7 100644 --- a/src/main/java/com/controlresell/sdk/generated/model/Conversation.java +++ b/src/main/java/com/controlresell/sdk/generated/model/Conversation.java @@ -44,6 +44,7 @@ Conversation.JSON_PROPERTY_ACCOUNT_ID, Conversation.JSON_PROPERTY_PLATFORM, Conversation.JSON_PROPERTY_BUYER_LOGIN, + Conversation.JSON_PROPERTY_BUYER_ID, Conversation.JSON_PROPERTY_UNREAD, Conversation.JSON_PROPERTY_PINNED, Conversation.JSON_PROPERTY_LAST_MESSAGE, @@ -66,6 +67,9 @@ public class Conversation { public static final String JSON_PROPERTY_BUYER_LOGIN = "buyerLogin"; private JsonNullable buyerLogin = JsonNullable.undefined(); + public static final String JSON_PROPERTY_BUYER_ID = "buyerId"; + private JsonNullable buyerId = JsonNullable.undefined(); + public static final String JSON_PROPERTY_UNREAD = "unread"; @jakarta.annotation.Nonnull private Boolean unread; @@ -199,6 +203,38 @@ public void setBuyerLogin(@jakarta.annotation.Nullable String buyerLogin) { } + public Conversation buyerId(@jakarta.annotation.Nullable String buyerId) { + this.buyerId = JsonNullable.of(buyerId); + return this; + } + + /** + * Get buyerId + * @return buyerId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getBuyerId() { + return buyerId.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_BUYER_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBuyerId_JsonNullable() { + return buyerId; + } + + @JsonProperty(JSON_PROPERTY_BUYER_ID) + public void setBuyerId_JsonNullable(JsonNullable buyerId) { + this.buyerId = buyerId; + } + + public void setBuyerId(@jakarta.annotation.Nullable String buyerId) { + this.buyerId = JsonNullable.of(buyerId); + } + + public Conversation unread(@jakarta.annotation.Nonnull Boolean unread) { this.unread = unread; return this; @@ -351,6 +387,7 @@ public boolean equals(Object o) { Objects.equals(this.accountId, conversation.accountId) && equalsNullable(this.platform, conversation.platform) && equalsNullable(this.buyerLogin, conversation.buyerLogin) && + equalsNullable(this.buyerId, conversation.buyerId) && Objects.equals(this.unread, conversation.unread) && Objects.equals(this.pinned, conversation.pinned) && equalsNullable(this.lastMessage, conversation.lastMessage) && @@ -364,7 +401,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(id, accountId, hashCodeNullable(platform), hashCodeNullable(buyerLogin), unread, pinned, hashCodeNullable(lastMessage), hashCodeNullable(lastMessageAt), updatedAt); + return Objects.hash(id, accountId, hashCodeNullable(platform), hashCodeNullable(buyerLogin), hashCodeNullable(buyerId), unread, pinned, hashCodeNullable(lastMessage), hashCodeNullable(lastMessageAt), updatedAt); } private static int hashCodeNullable(JsonNullable a) { @@ -382,6 +419,7 @@ public String toString() { sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); sb.append(" buyerLogin: ").append(toIndentedString(buyerLogin)).append("\n"); + sb.append(" buyerId: ").append(toIndentedString(buyerId)).append("\n"); sb.append(" unread: ").append(toIndentedString(unread)).append("\n"); sb.append(" pinned: ").append(toIndentedString(pinned)).append("\n"); sb.append(" lastMessage: ").append(toIndentedString(lastMessage)).append("\n"); @@ -451,6 +489,11 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%sbuyerLogin%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getBuyerLogin())))); } + // add `buyerId` to the URL query string + if (getBuyerId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sbuyerId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getBuyerId())))); + } + // add `unread` to the URL query string if (getUnread() != null) { joiner.add(String.format(java.util.Locale.ROOT, "%sunread%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUnread())))); diff --git a/src/main/java/com/controlresell/sdk/generated/model/CreatedWebhookEndpoint.java b/src/main/java/com/controlresell/sdk/generated/model/CreatedWebhookEndpoint.java new file mode 100644 index 0000000..5d51c17 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/CreatedWebhookEndpoint.java @@ -0,0 +1,185 @@ +/* + * 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.WebhookEndpoint; +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; +/** + * CreatedWebhookEndpoint + */ +@JsonPropertyOrder({ + CreatedWebhookEndpoint.JSON_PROPERTY_ENDPOINT, + CreatedWebhookEndpoint.JSON_PROPERTY_SECRET +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class CreatedWebhookEndpoint { + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + @jakarta.annotation.Nonnull + private WebhookEndpoint endpoint; + + public static final String JSON_PROPERTY_SECRET = "secret"; + @jakarta.annotation.Nonnull + private String secret; + + public CreatedWebhookEndpoint() { + } + + public CreatedWebhookEndpoint endpoint(@jakarta.annotation.Nonnull WebhookEndpoint endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get endpoint + * @return endpoint + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhookEndpoint getEndpoint() { + return endpoint; + } + + + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEndpoint(@jakarta.annotation.Nonnull WebhookEndpoint endpoint) { + this.endpoint = endpoint; + } + + + public CreatedWebhookEndpoint secret(@jakarta.annotation.Nonnull String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * @return secret + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SECRET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSecret() { + return secret; + } + + + @JsonProperty(value = JSON_PROPERTY_SECRET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSecret(@jakarta.annotation.Nonnull String secret) { + this.secret = secret; + } + + + /** + * Return true if this CreatedWebhookEndpoint object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatedWebhookEndpoint createdWebhookEndpoint = (CreatedWebhookEndpoint) o; + return Objects.equals(this.endpoint, createdWebhookEndpoint.endpoint) && + Objects.equals(this.secret, createdWebhookEndpoint.secret); + } + + @Override + public int hashCode() { + return Objects.hash(endpoint, secret); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatedWebhookEndpoint {\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).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 `endpoint` to the URL query string + if (getEndpoint() != null) { + joiner.add(getEndpoint().toUrlQueryString(prefix + "endpoint" + suffix)); + } + + // add `secret` to the URL query string + if (getSecret() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssecret%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSecret())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/Favorite.java b/src/main/java/com/controlresell/sdk/generated/model/Favorite.java new file mode 100644 index 0000000..2b208d4 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/Favorite.java @@ -0,0 +1,446 @@ +/* + * 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.FavoriteItem; +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.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +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; +/** + * Favorite + */ +@JsonPropertyOrder({ + Favorite.JSON_PROPERTY_ID, + Favorite.JSON_PROPERTY_ACCOUNT_ID, + Favorite.JSON_PROPERTY_PLATFORM, + Favorite.JSON_PROPERTY_BUYER_ID, + Favorite.JSON_PROPERTY_CREATED_AT, + Favorite.JSON_PROPERTY_MESSAGE_SENT_AT, + Favorite.JSON_PROPERTY_LISTING_ID, + Favorite.JSON_PROPERTY_ITEM +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class Favorite { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private UUID id; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + @jakarta.annotation.Nonnull + private UUID accountId; + + public static final String JSON_PROPERTY_PLATFORM = "platform"; + private JsonNullable platform = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUYER_ID = "buyerId"; + @jakarta.annotation.Nonnull + private String buyerId; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_MESSAGE_SENT_AT = "messageSentAt"; + private JsonNullable messageSentAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LISTING_ID = "listingId"; + private JsonNullable listingId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ITEM = "item"; + private JsonNullable item = JsonNullable.undefined(); + + public Favorite() { + } + + public Favorite id(@jakarta.annotation.Nonnull UUID 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 UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull UUID id) { + this.id = id; + } + + + public Favorite accountId(@jakarta.annotation.Nonnull UUID accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ACCOUNT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAccountId() { + return accountId; + } + + + @JsonProperty(value = JSON_PROPERTY_ACCOUNT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAccountId(@jakarta.annotation.Nonnull UUID accountId) { + this.accountId = accountId; + } + + + public Favorite 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 Favorite buyerId(@jakarta.annotation.Nonnull String buyerId) { + this.buyerId = buyerId; + return this; + } + + /** + * Get buyerId + * @return buyerId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_BUYER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBuyerId() { + return buyerId; + } + + + @JsonProperty(value = JSON_PROPERTY_BUYER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBuyerId(@jakarta.annotation.Nonnull String buyerId) { + this.buyerId = buyerId; + } + + + public Favorite createdAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public Favorite messageSentAt(@jakarta.annotation.Nullable OffsetDateTime messageSentAt) { + this.messageSentAt = JsonNullable.of(messageSentAt); + return this; + } + + /** + * Get messageSentAt + * @return messageSentAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getMessageSentAt() { + return messageSentAt.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_MESSAGE_SENT_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMessageSentAt_JsonNullable() { + return messageSentAt; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_SENT_AT) + public void setMessageSentAt_JsonNullable(JsonNullable messageSentAt) { + this.messageSentAt = messageSentAt; + } + + public void setMessageSentAt(@jakarta.annotation.Nullable OffsetDateTime messageSentAt) { + this.messageSentAt = JsonNullable.of(messageSentAt); + } + + + public Favorite listingId(@jakarta.annotation.Nullable UUID listingId) { + this.listingId = JsonNullable.of(listingId); + return this; + } + + /** + * Get listingId + * @return listingId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public UUID getListingId() { + return listingId.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_LISTING_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getListingId_JsonNullable() { + return listingId; + } + + @JsonProperty(JSON_PROPERTY_LISTING_ID) + public void setListingId_JsonNullable(JsonNullable listingId) { + this.listingId = listingId; + } + + public void setListingId(@jakarta.annotation.Nullable UUID listingId) { + this.listingId = JsonNullable.of(listingId); + } + + + public Favorite item(@jakarta.annotation.Nullable FavoriteItem item) { + this.item = JsonNullable.of(item); + return this; + } + + /** + * Get item + * @return item + */ + @jakarta.annotation.Nullable + @JsonIgnore + public FavoriteItem getItem() { + return item.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_ITEM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getItem_JsonNullable() { + return item; + } + + @JsonProperty(JSON_PROPERTY_ITEM) + public void setItem_JsonNullable(JsonNullable item) { + this.item = item; + } + + public void setItem(@jakarta.annotation.Nullable FavoriteItem item) { + this.item = JsonNullable.of(item); + } + + + /** + * Return true if this Favorite object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Favorite favorite = (Favorite) o; + return Objects.equals(this.id, favorite.id) && + Objects.equals(this.accountId, favorite.accountId) && + equalsNullable(this.platform, favorite.platform) && + Objects.equals(this.buyerId, favorite.buyerId) && + Objects.equals(this.createdAt, favorite.createdAt) && + equalsNullable(this.messageSentAt, favorite.messageSentAt) && + equalsNullable(this.listingId, favorite.listingId) && + equalsNullable(this.item, favorite.item); + } + + 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, accountId, hashCodeNullable(platform), buyerId, createdAt, hashCodeNullable(messageSentAt), hashCodeNullable(listingId), hashCodeNullable(item)); + } + + 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 Favorite {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); + sb.append(" buyerId: ").append(toIndentedString(buyerId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" messageSentAt: ").append(toIndentedString(messageSentAt)).append("\n"); + sb.append(" listingId: ").append(toIndentedString(listingId)).append("\n"); + sb.append(" item: ").append(toIndentedString(item)).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 `accountId` to the URL query string + if (getAccountId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%saccountId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getAccountId())))); + } + + // 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 `buyerId` to the URL query string + if (getBuyerId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sbuyerId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getBuyerId())))); + } + + // add `createdAt` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%screatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCreatedAt())))); + } + + // add `messageSentAt` to the URL query string + if (getMessageSentAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smessageSentAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessageSentAt())))); + } + + // add `listingId` to the URL query string + if (getListingId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%slistingId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getListingId())))); + } + + // add `item` to the URL query string + if (getItem() != null) { + joiner.add(getItem().toUrlQueryString(prefix + "item" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/FavoriteItem.java b/src/main/java/com/controlresell/sdk/generated/model/FavoriteItem.java new file mode 100644 index 0000000..909caf4 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/FavoriteItem.java @@ -0,0 +1,257 @@ +/* + * 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.Money; +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; +/** + * FavoriteItem + */ +@JsonPropertyOrder({ + FavoriteItem.JSON_PROPERTY_ID, + FavoriteItem.JSON_PROPERTY_NAME, + FavoriteItem.JSON_PROPERTY_PRICE, + FavoriteItem.JSON_PROPERTY_SOLD +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class FavoriteItem { + 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_PRICE = "price"; + @jakarta.annotation.Nonnull + private Money price; + + public static final String JSON_PROPERTY_SOLD = "sold"; + @jakarta.annotation.Nonnull + private Boolean sold; + + public FavoriteItem() { + } + + public FavoriteItem 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 FavoriteItem 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 FavoriteItem price(@jakarta.annotation.Nonnull Money price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PRICE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Money getPrice() { + return price; + } + + + @JsonProperty(value = JSON_PROPERTY_PRICE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPrice(@jakarta.annotation.Nonnull Money price) { + this.price = price; + } + + + public FavoriteItem sold(@jakarta.annotation.Nonnull Boolean sold) { + this.sold = sold; + return this; + } + + /** + * Get sold + * @return sold + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SOLD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSold() { + return sold; + } + + + @JsonProperty(value = JSON_PROPERTY_SOLD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSold(@jakarta.annotation.Nonnull Boolean sold) { + this.sold = sold; + } + + + /** + * Return true if this FavoriteItem object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FavoriteItem favoriteItem = (FavoriteItem) o; + return Objects.equals(this.id, favoriteItem.id) && + Objects.equals(this.name, favoriteItem.name) && + Objects.equals(this.price, favoriteItem.price) && + Objects.equals(this.sold, favoriteItem.sold); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, price, sold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FavoriteItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" sold: ").append(toIndentedString(sold)).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 `price` to the URL query string + if (getPrice() != null) { + joiner.add(getPrice().toUrlQueryString(prefix + "price" + suffix)); + } + + // add `sold` to the URL query string + if (getSold() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssold%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSold())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/FavoritePage.java b/src/main/java/com/controlresell/sdk/generated/model/FavoritePage.java new file mode 100644 index 0000000..acf5193 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/FavoritePage.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.Favorite; +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; +/** + * FavoritePage + */ +@JsonPropertyOrder({ + FavoritePage.JSON_PROPERTY_DATA, + FavoritePage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class FavoritePage { + 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 FavoritePage() { + } + + public FavoritePage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public FavoritePage addDataItem(Favorite 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 FavoritePage 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 FavoritePage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FavoritePage favoritePage = (FavoritePage) o; + return Objects.equals(this.data, favoritePage.data) && + equalsNullable(this.nextCursor, favoritePage.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 FavoritePage {\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/WebhookDelivery.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookDelivery.java new file mode 100644 index 0000000..18970e6 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookDelivery.java @@ -0,0 +1,553 @@ +/* + * 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.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +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; +/** + * WebhookDelivery + */ +@JsonPropertyOrder({ + WebhookDelivery.JSON_PROPERTY_ID, + WebhookDelivery.JSON_PROPERTY_EVENT_ID, + WebhookDelivery.JSON_PROPERTY_EVENT_TYPE, + WebhookDelivery.JSON_PROPERTY_STATUS, + WebhookDelivery.JSON_PROPERTY_ATTEMPT, + WebhookDelivery.JSON_PROPERTY_HTTP_STATUS, + WebhookDelivery.JSON_PROPERTY_ERROR, + WebhookDelivery.JSON_PROPERTY_DURATION_MS, + WebhookDelivery.JSON_PROPERTY_NEXT_ATTEMPT_AT, + WebhookDelivery.JSON_PROPERTY_CREATED_AT, + WebhookDelivery.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookDelivery { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private UUID id; + + public static final String JSON_PROPERTY_EVENT_ID = "eventId"; + @jakarta.annotation.Nonnull + private UUID eventId; + + public static final String JSON_PROPERTY_EVENT_TYPE = "eventType"; + @jakarta.annotation.Nonnull + private String eventType; + + public static final String JSON_PROPERTY_STATUS = "status"; + @jakarta.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_ATTEMPT = "attempt"; + @jakarta.annotation.Nonnull + private Long attempt; + + public static final String JSON_PROPERTY_HTTP_STATUS = "httpStatus"; + private JsonNullable httpStatus = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ERROR = "error"; + private JsonNullable error = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DURATION_MS = "durationMs"; + private JsonNullable durationMs = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NEXT_ATTEMPT_AT = "nextAttemptAt"; + private JsonNullable nextAttemptAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime updatedAt; + + public WebhookDelivery() { + } + + public WebhookDelivery id(@jakarta.annotation.Nonnull UUID 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 UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull UUID id) { + this.id = id; + } + + + public WebhookDelivery eventId(@jakarta.annotation.Nonnull UUID eventId) { + this.eventId = eventId; + return this; + } + + /** + * Get eventId + * @return eventId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_EVENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getEventId() { + return eventId; + } + + + @JsonProperty(value = JSON_PROPERTY_EVENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEventId(@jakarta.annotation.Nonnull UUID eventId) { + this.eventId = eventId; + } + + + public WebhookDelivery eventType(@jakarta.annotation.Nonnull String eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get eventType + * @return eventType + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEventType() { + return eventType; + } + + + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEventType(@jakarta.annotation.Nonnull String eventType) { + this.eventType = eventType; + } + + + public WebhookDelivery status(@jakarta.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@jakarta.annotation.Nonnull String status) { + this.status = status; + } + + + public WebhookDelivery attempt(@jakarta.annotation.Nonnull Long attempt) { + this.attempt = attempt; + return this; + } + + /** + * Get attempt + * @return attempt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ATTEMPT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getAttempt() { + return attempt; + } + + + @JsonProperty(value = JSON_PROPERTY_ATTEMPT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAttempt(@jakarta.annotation.Nonnull Long attempt) { + this.attempt = attempt; + } + + + public WebhookDelivery httpStatus(@jakarta.annotation.Nullable Long httpStatus) { + this.httpStatus = JsonNullable.of(httpStatus); + return this; + } + + /** + * Get httpStatus + * @return httpStatus + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getHttpStatus() { + return httpStatus.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_HTTP_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getHttpStatus_JsonNullable() { + return httpStatus; + } + + @JsonProperty(JSON_PROPERTY_HTTP_STATUS) + public void setHttpStatus_JsonNullable(JsonNullable httpStatus) { + this.httpStatus = httpStatus; + } + + public void setHttpStatus(@jakarta.annotation.Nullable Long httpStatus) { + this.httpStatus = JsonNullable.of(httpStatus); + } + + + public WebhookDelivery error(@jakarta.annotation.Nullable String error) { + this.error = JsonNullable.of(error); + return this; + } + + /** + * Get error + * @return error + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getError() { + return error.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getError_JsonNullable() { + return error; + } + + @JsonProperty(JSON_PROPERTY_ERROR) + public void setError_JsonNullable(JsonNullable error) { + this.error = error; + } + + public void setError(@jakarta.annotation.Nullable String error) { + this.error = JsonNullable.of(error); + } + + + public WebhookDelivery durationMs(@jakarta.annotation.Nullable Long durationMs) { + this.durationMs = JsonNullable.of(durationMs); + return this; + } + + /** + * Get durationMs + * @return durationMs + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getDurationMs() { + return durationMs.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_DURATION_MS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDurationMs_JsonNullable() { + return durationMs; + } + + @JsonProperty(JSON_PROPERTY_DURATION_MS) + public void setDurationMs_JsonNullable(JsonNullable durationMs) { + this.durationMs = durationMs; + } + + public void setDurationMs(@jakarta.annotation.Nullable Long durationMs) { + this.durationMs = JsonNullable.of(durationMs); + } + + + public WebhookDelivery nextAttemptAt(@jakarta.annotation.Nullable OffsetDateTime nextAttemptAt) { + this.nextAttemptAt = JsonNullable.of(nextAttemptAt); + return this; + } + + /** + * Get nextAttemptAt + * @return nextAttemptAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getNextAttemptAt() { + return nextAttemptAt.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_ATTEMPT_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextAttemptAt_JsonNullable() { + return nextAttemptAt; + } + + @JsonProperty(JSON_PROPERTY_NEXT_ATTEMPT_AT) + public void setNextAttemptAt_JsonNullable(JsonNullable nextAttemptAt) { + this.nextAttemptAt = nextAttemptAt; + } + + public void setNextAttemptAt(@jakarta.annotation.Nullable OffsetDateTime nextAttemptAt) { + this.nextAttemptAt = JsonNullable.of(nextAttemptAt); + } + + + public WebhookDelivery createdAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WebhookDelivery updatedAt(@jakarta.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUpdatedAt(@jakarta.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + /** + * Return true if this WebhookDelivery object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookDelivery webhookDelivery = (WebhookDelivery) o; + return Objects.equals(this.id, webhookDelivery.id) && + Objects.equals(this.eventId, webhookDelivery.eventId) && + Objects.equals(this.eventType, webhookDelivery.eventType) && + Objects.equals(this.status, webhookDelivery.status) && + Objects.equals(this.attempt, webhookDelivery.attempt) && + equalsNullable(this.httpStatus, webhookDelivery.httpStatus) && + equalsNullable(this.error, webhookDelivery.error) && + equalsNullable(this.durationMs, webhookDelivery.durationMs) && + equalsNullable(this.nextAttemptAt, webhookDelivery.nextAttemptAt) && + Objects.equals(this.createdAt, webhookDelivery.createdAt) && + Objects.equals(this.updatedAt, webhookDelivery.updatedAt); + } + + 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, eventId, eventType, status, attempt, hashCodeNullable(httpStatus), hashCodeNullable(error), hashCodeNullable(durationMs), hashCodeNullable(nextAttemptAt), createdAt, updatedAt); + } + + 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 WebhookDelivery {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" httpStatus: ").append(toIndentedString(httpStatus)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" durationMs: ").append(toIndentedString(durationMs)).append("\n"); + sb.append(" nextAttemptAt: ").append(toIndentedString(nextAttemptAt)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 `eventId` to the URL query string + if (getEventId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%seventId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEventId())))); + } + + // add `eventType` to the URL query string + if (getEventType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%seventType%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEventType())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `attempt` to the URL query string + if (getAttempt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sattempt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getAttempt())))); + } + + // add `httpStatus` to the URL query string + if (getHttpStatus() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%shttpStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getHttpStatus())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + // add `durationMs` to the URL query string + if (getDurationMs() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdurationMs%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDurationMs())))); + } + + // add `nextAttemptAt` to the URL query string + if (getNextAttemptAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snextAttemptAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextAttemptAt())))); + } + + // add `createdAt` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%screatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCreatedAt())))); + } + + // add `updatedAt` to the URL query string + if (getUpdatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%supdatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUpdatedAt())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookDeliveryPage.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookDeliveryPage.java new file mode 100644 index 0000000..457437c --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookDeliveryPage.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.WebhookDelivery; +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; +/** + * WebhookDeliveryPage + */ +@JsonPropertyOrder({ + WebhookDeliveryPage.JSON_PROPERTY_DATA, + WebhookDeliveryPage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookDeliveryPage { + 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 WebhookDeliveryPage() { + } + + public WebhookDeliveryPage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public WebhookDeliveryPage addDataItem(WebhookDelivery 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 WebhookDeliveryPage 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 WebhookDeliveryPage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookDeliveryPage webhookDeliveryPage = (WebhookDeliveryPage) o; + return Objects.equals(this.data, webhookDeliveryPage.data) && + equalsNullable(this.nextCursor, webhookDeliveryPage.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 WebhookDeliveryPage {\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/WebhookEndpoint.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpoint.java new file mode 100644 index 0000000..8233e1e --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpoint.java @@ -0,0 +1,560 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +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; +/** + * WebhookEndpoint + */ +@JsonPropertyOrder({ + WebhookEndpoint.JSON_PROPERTY_ID, + WebhookEndpoint.JSON_PROPERTY_URL, + WebhookEndpoint.JSON_PROPERTY_DESCRIPTION, + WebhookEndpoint.JSON_PROPERTY_EVENT_TYPES, + WebhookEndpoint.JSON_PROPERTY_PAYLOAD_MODE, + WebhookEndpoint.JSON_PROPERTY_STATUS, + WebhookEndpoint.JSON_PROPERTY_DISABLED_REASON, + WebhookEndpoint.JSON_PROPERTY_API_VERSION, + WebhookEndpoint.JSON_PROPERTY_CREATED_AT, + WebhookEndpoint.JSON_PROPERTY_UPDATED_AT, + WebhookEndpoint.JSON_PROPERTY_LAST_SUCCESS_AT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEndpoint { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private UUID id; + + public static final String JSON_PROPERTY_URL = "url"; + @jakarta.annotation.Nonnull + private String url; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EVENT_TYPES = "eventTypes"; + @jakarta.annotation.Nonnull + private List eventTypes = new ArrayList<>(); + + public static final String JSON_PROPERTY_PAYLOAD_MODE = "payloadMode"; + @jakarta.annotation.Nonnull + private String payloadMode; + + public static final String JSON_PROPERTY_STATUS = "status"; + @jakarta.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_DISABLED_REASON = "disabledReason"; + private JsonNullable disabledReason = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_API_VERSION = "apiVersion"; + @jakarta.annotation.Nonnull + private String apiVersion; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_LAST_SUCCESS_AT = "lastSuccessAt"; + private JsonNullable lastSuccessAt = JsonNullable.undefined(); + + public WebhookEndpoint() { + } + + public WebhookEndpoint id(@jakarta.annotation.Nonnull UUID 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 UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull UUID id) { + this.id = id; + } + + + public WebhookEndpoint url(@jakarta.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + + @JsonProperty(value = JSON_PROPERTY_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUrl(@jakarta.annotation.Nonnull String url) { + this.url = url; + } + + + public WebhookEndpoint description(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * Get description + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + } + + + public WebhookEndpoint eventTypes(@jakarta.annotation.Nonnull List eventTypes) { + this.eventTypes = eventTypes; + return this; + } + + public WebhookEndpoint addEventTypesItem(String eventTypesItem) { + if (this.eventTypes == null) { + this.eventTypes = new ArrayList<>(); + } + this.eventTypes.add(eventTypesItem); + return this; + } + + /** + * Get eventTypes + * @return eventTypes + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEventTypes() { + return eventTypes; + } + + + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEventTypes(@jakarta.annotation.Nonnull List eventTypes) { + this.eventTypes = eventTypes; + } + + + public WebhookEndpoint payloadMode(@jakarta.annotation.Nonnull String payloadMode) { + this.payloadMode = payloadMode; + return this; + } + + /** + * Get payloadMode + * @return payloadMode + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PAYLOAD_MODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPayloadMode() { + return payloadMode; + } + + + @JsonProperty(value = JSON_PROPERTY_PAYLOAD_MODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPayloadMode(@jakarta.annotation.Nonnull String payloadMode) { + this.payloadMode = payloadMode; + } + + + public WebhookEndpoint status(@jakarta.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@jakarta.annotation.Nonnull String status) { + this.status = status; + } + + + public WebhookEndpoint disabledReason(@jakarta.annotation.Nullable String disabledReason) { + this.disabledReason = JsonNullable.of(disabledReason); + return this; + } + + /** + * Get disabledReason + * @return disabledReason + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDisabledReason() { + return disabledReason.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_DISABLED_REASON, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisabledReason_JsonNullable() { + return disabledReason; + } + + @JsonProperty(JSON_PROPERTY_DISABLED_REASON) + public void setDisabledReason_JsonNullable(JsonNullable disabledReason) { + this.disabledReason = disabledReason; + } + + public void setDisabledReason(@jakarta.annotation.Nullable String disabledReason) { + this.disabledReason = JsonNullable.of(disabledReason); + } + + + public WebhookEndpoint apiVersion(@jakarta.annotation.Nonnull String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get apiVersion + * @return apiVersion + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_API_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiVersion() { + return apiVersion; + } + + + @JsonProperty(value = JSON_PROPERTY_API_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setApiVersion(@jakarta.annotation.Nonnull String apiVersion) { + this.apiVersion = apiVersion; + } + + + public WebhookEndpoint createdAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WebhookEndpoint updatedAt(@jakarta.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUpdatedAt(@jakarta.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public WebhookEndpoint lastSuccessAt(@jakarta.annotation.Nullable OffsetDateTime lastSuccessAt) { + this.lastSuccessAt = JsonNullable.of(lastSuccessAt); + return this; + } + + /** + * Get lastSuccessAt + * @return lastSuccessAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getLastSuccessAt() { + return lastSuccessAt.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_LAST_SUCCESS_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLastSuccessAt_JsonNullable() { + return lastSuccessAt; + } + + @JsonProperty(JSON_PROPERTY_LAST_SUCCESS_AT) + public void setLastSuccessAt_JsonNullable(JsonNullable lastSuccessAt) { + this.lastSuccessAt = lastSuccessAt; + } + + public void setLastSuccessAt(@jakarta.annotation.Nullable OffsetDateTime lastSuccessAt) { + this.lastSuccessAt = JsonNullable.of(lastSuccessAt); + } + + + /** + * Return true if this WebhookEndpoint object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEndpoint webhookEndpoint = (WebhookEndpoint) o; + return Objects.equals(this.id, webhookEndpoint.id) && + Objects.equals(this.url, webhookEndpoint.url) && + equalsNullable(this.description, webhookEndpoint.description) && + Objects.equals(this.eventTypes, webhookEndpoint.eventTypes) && + Objects.equals(this.payloadMode, webhookEndpoint.payloadMode) && + Objects.equals(this.status, webhookEndpoint.status) && + equalsNullable(this.disabledReason, webhookEndpoint.disabledReason) && + Objects.equals(this.apiVersion, webhookEndpoint.apiVersion) && + Objects.equals(this.createdAt, webhookEndpoint.createdAt) && + Objects.equals(this.updatedAt, webhookEndpoint.updatedAt) && + equalsNullable(this.lastSuccessAt, webhookEndpoint.lastSuccessAt); + } + + 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, url, hashCodeNullable(description), eventTypes, payloadMode, status, hashCodeNullable(disabledReason), apiVersion, createdAt, updatedAt, hashCodeNullable(lastSuccessAt)); + } + + 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 WebhookEndpoint {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" eventTypes: ").append(toIndentedString(eventTypes)).append("\n"); + sb.append(" payloadMode: ").append(toIndentedString(payloadMode)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" disabledReason: ").append(toIndentedString(disabledReason)).append("\n"); + sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" lastSuccessAt: ").append(toIndentedString(lastSuccessAt)).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 `url` to the URL query string + if (getUrl() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%surl%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUrl())))); + } + + // add `description` to the URL query string + if (getDescription() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdescription%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDescription())))); + } + + // add `eventTypes` to the URL query string + if (getEventTypes() != null) { + for (int i = 0; i < getEventTypes().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%seventTypes%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getEventTypes().get(i))))); + } + } + + // add `payloadMode` to the URL query string + if (getPayloadMode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%spayloadMode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPayloadMode())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + // add `disabledReason` to the URL query string + if (getDisabledReason() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdisabledReason%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDisabledReason())))); + } + + // add `apiVersion` to the URL query string + if (getApiVersion() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sapiVersion%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getApiVersion())))); + } + + // add `createdAt` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%screatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCreatedAt())))); + } + + // add `updatedAt` to the URL query string + if (getUpdatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%supdatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUpdatedAt())))); + } + + // add `lastSuccessAt` to the URL query string + if (getLastSuccessAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%slastSuccessAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastSuccessAt())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointCreateRequest.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointCreateRequest.java new file mode 100644 index 0000000..aefc0c0 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointCreateRequest.java @@ -0,0 +1,299 @@ +/* + * 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; +/** + * WebhookEndpointCreateRequest + */ +@JsonPropertyOrder({ + WebhookEndpointCreateRequest.JSON_PROPERTY_URL, + WebhookEndpointCreateRequest.JSON_PROPERTY_EVENT_TYPES, + WebhookEndpointCreateRequest.JSON_PROPERTY_DESCRIPTION, + WebhookEndpointCreateRequest.JSON_PROPERTY_PAYLOAD_MODE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEndpointCreateRequest { + public static final String JSON_PROPERTY_URL = "url"; + @jakarta.annotation.Nonnull + private String url; + + public static final String JSON_PROPERTY_EVENT_TYPES = "eventTypes"; + @jakarta.annotation.Nonnull + private List eventTypes = new ArrayList<>(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PAYLOAD_MODE = "payloadMode"; + private JsonNullable payloadMode = JsonNullable.undefined(); + + public WebhookEndpointCreateRequest() { + } + + public WebhookEndpointCreateRequest url(@jakarta.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + + @JsonProperty(value = JSON_PROPERTY_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUrl(@jakarta.annotation.Nonnull String url) { + this.url = url; + } + + + public WebhookEndpointCreateRequest eventTypes(@jakarta.annotation.Nonnull List eventTypes) { + this.eventTypes = eventTypes; + return this; + } + + public WebhookEndpointCreateRequest addEventTypesItem(String eventTypesItem) { + if (this.eventTypes == null) { + this.eventTypes = new ArrayList<>(); + } + this.eventTypes.add(eventTypesItem); + return this; + } + + /** + * Get eventTypes + * @return eventTypes + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEventTypes() { + return eventTypes; + } + + + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEventTypes(@jakarta.annotation.Nonnull List eventTypes) { + this.eventTypes = eventTypes; + } + + + public WebhookEndpointCreateRequest description(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * Get description + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + } + + + public WebhookEndpointCreateRequest payloadMode(@jakarta.annotation.Nullable String payloadMode) { + this.payloadMode = JsonNullable.of(payloadMode); + return this; + } + + /** + * Get payloadMode + * @return payloadMode + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPayloadMode() { + return payloadMode.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PAYLOAD_MODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPayloadMode_JsonNullable() { + return payloadMode; + } + + @JsonProperty(JSON_PROPERTY_PAYLOAD_MODE) + public void setPayloadMode_JsonNullable(JsonNullable payloadMode) { + this.payloadMode = payloadMode; + } + + public void setPayloadMode(@jakarta.annotation.Nullable String payloadMode) { + this.payloadMode = JsonNullable.of(payloadMode); + } + + + /** + * Return true if this WebhookEndpointCreateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEndpointCreateRequest webhookEndpointCreateRequest = (WebhookEndpointCreateRequest) o; + return Objects.equals(this.url, webhookEndpointCreateRequest.url) && + Objects.equals(this.eventTypes, webhookEndpointCreateRequest.eventTypes) && + equalsNullable(this.description, webhookEndpointCreateRequest.description) && + equalsNullable(this.payloadMode, webhookEndpointCreateRequest.payloadMode); + } + + 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(url, eventTypes, hashCodeNullable(description), hashCodeNullable(payloadMode)); + } + + 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 WebhookEndpointCreateRequest {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" eventTypes: ").append(toIndentedString(eventTypes)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payloadMode: ").append(toIndentedString(payloadMode)).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 `url` to the URL query string + if (getUrl() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%surl%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUrl())))); + } + + // add `eventTypes` to the URL query string + if (getEventTypes() != null) { + for (int i = 0; i < getEventTypes().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%seventTypes%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getEventTypes().get(i))))); + } + } + + // add `description` to the URL query string + if (getDescription() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdescription%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDescription())))); + } + + // add `payloadMode` to the URL query string + if (getPayloadMode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%spayloadMode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPayloadMode())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointPage.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointPage.java new file mode 100644 index 0000000..76a9773 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointPage.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.WebhookEndpoint; +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; +/** + * WebhookEndpointPage + */ +@JsonPropertyOrder({ + WebhookEndpointPage.JSON_PROPERTY_DATA, + WebhookEndpointPage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEndpointPage { + 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 WebhookEndpointPage() { + } + + public WebhookEndpointPage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public WebhookEndpointPage addDataItem(WebhookEndpoint 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 WebhookEndpointPage 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 WebhookEndpointPage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEndpointPage webhookEndpointPage = (WebhookEndpointPage) o; + return Objects.equals(this.data, webhookEndpointPage.data) && + equalsNullable(this.nextCursor, webhookEndpointPage.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 WebhookEndpointPage {\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/WebhookEndpointUpdateRequest.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointUpdateRequest.java new file mode 100644 index 0000000..15f2ae2 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEndpointUpdateRequest.java @@ -0,0 +1,360 @@ +/* + * 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; +/** + * WebhookEndpointUpdateRequest + */ +@JsonPropertyOrder({ + WebhookEndpointUpdateRequest.JSON_PROPERTY_URL, + WebhookEndpointUpdateRequest.JSON_PROPERTY_DESCRIPTION, + WebhookEndpointUpdateRequest.JSON_PROPERTY_EVENT_TYPES, + WebhookEndpointUpdateRequest.JSON_PROPERTY_PAYLOAD_MODE, + WebhookEndpointUpdateRequest.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEndpointUpdateRequest { + public static final String JSON_PROPERTY_URL = "url"; + private JsonNullable url = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EVENT_TYPES = "eventTypes"; + private JsonNullable> eventTypes = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PAYLOAD_MODE = "payloadMode"; + private JsonNullable payloadMode = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STATUS = "status"; + private JsonNullable status = JsonNullable.undefined(); + + public WebhookEndpointUpdateRequest() { + } + + public WebhookEndpointUpdateRequest url(@jakarta.annotation.Nullable String url) { + this.url = JsonNullable.of(url); + return this; + } + + /** + * Get url + * @return url + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getUrl() { + return url.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getUrl_JsonNullable() { + return url; + } + + @JsonProperty(JSON_PROPERTY_URL) + public void setUrl_JsonNullable(JsonNullable url) { + this.url = url; + } + + public void setUrl(@jakarta.annotation.Nullable String url) { + this.url = JsonNullable.of(url); + } + + + public WebhookEndpointUpdateRequest description(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * Get description + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = JsonNullable.of(description); + } + + + public WebhookEndpointUpdateRequest eventTypes(@jakarta.annotation.Nullable List eventTypes) { + this.eventTypes = JsonNullable.>of(eventTypes); + return this; + } + + public WebhookEndpointUpdateRequest addEventTypesItem(String eventTypesItem) { + if (this.eventTypes == null || !this.eventTypes.isPresent() || this.eventTypes.get() == null) { + this.eventTypes = JsonNullable.>of(new ArrayList<>()); + } + try { + this.eventTypes.get().add(eventTypesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get eventTypes + * @return eventTypes + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getEventTypes() { + return eventTypes.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getEventTypes_JsonNullable() { + return eventTypes; + } + + @JsonProperty(JSON_PROPERTY_EVENT_TYPES) + public void setEventTypes_JsonNullable(JsonNullable> eventTypes) { + this.eventTypes = eventTypes; + } + + public void setEventTypes(@jakarta.annotation.Nullable List eventTypes) { + this.eventTypes = JsonNullable.>of(eventTypes); + } + + + public WebhookEndpointUpdateRequest payloadMode(@jakarta.annotation.Nullable String payloadMode) { + this.payloadMode = JsonNullable.of(payloadMode); + return this; + } + + /** + * Get payloadMode + * @return payloadMode + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPayloadMode() { + return payloadMode.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PAYLOAD_MODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPayloadMode_JsonNullable() { + return payloadMode; + } + + @JsonProperty(JSON_PROPERTY_PAYLOAD_MODE) + public void setPayloadMode_JsonNullable(JsonNullable payloadMode) { + this.payloadMode = payloadMode; + } + + public void setPayloadMode(@jakarta.annotation.Nullable String payloadMode) { + this.payloadMode = JsonNullable.of(payloadMode); + } + + + public WebhookEndpointUpdateRequest status(@jakarta.annotation.Nullable String status) { + this.status = JsonNullable.of(status); + return this; + } + + /** + * Get status + * @return status + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getStatus() { + return status.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStatus_JsonNullable() { + return status; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + public void setStatus_JsonNullable(JsonNullable status) { + this.status = status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = JsonNullable.of(status); + } + + + /** + * Return true if this WebhookEndpointUpdateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEndpointUpdateRequest webhookEndpointUpdateRequest = (WebhookEndpointUpdateRequest) o; + return equalsNullable(this.url, webhookEndpointUpdateRequest.url) && + equalsNullable(this.description, webhookEndpointUpdateRequest.description) && + equalsNullable(this.eventTypes, webhookEndpointUpdateRequest.eventTypes) && + equalsNullable(this.payloadMode, webhookEndpointUpdateRequest.payloadMode) && + equalsNullable(this.status, webhookEndpointUpdateRequest.status); + } + + 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(hashCodeNullable(url), hashCodeNullable(description), hashCodeNullable(eventTypes), hashCodeNullable(payloadMode), hashCodeNullable(status)); + } + + 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 WebhookEndpointUpdateRequest {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" eventTypes: ").append(toIndentedString(eventTypes)).append("\n"); + sb.append(" payloadMode: ").append(toIndentedString(payloadMode)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 `url` to the URL query string + if (getUrl() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%surl%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUrl())))); + } + + // add `description` to the URL query string + if (getDescription() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdescription%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDescription())))); + } + + // add `eventTypes` to the URL query string + if (getEventTypes() != null) { + for (int i = 0; i < getEventTypes().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%seventTypes%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getEventTypes().get(i))))); + } + } + + // add `payloadMode` to the URL query string + if (getPayloadMode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%spayloadMode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPayloadMode())))); + } + + // add `status` to the URL query string + if (getStatus() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookEvent.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEvent.java new file mode 100644 index 0000000..f57c500 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEvent.java @@ -0,0 +1,344 @@ +/* + * 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.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * WebhookEvent + */ +@JsonPropertyOrder({ + WebhookEvent.JSON_PROPERTY_ID, + WebhookEvent.JSON_PROPERTY_TYPE, + WebhookEvent.JSON_PROPERTY_CREATED_AT, + WebhookEvent.JSON_PROPERTY_API_VERSION, + WebhookEvent.JSON_PROPERTY_SELLER_ID, + WebhookEvent.JSON_PROPERTY_DATA +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEvent { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nonnull + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + @jakarta.annotation.Nonnull + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + @jakarta.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_API_VERSION = "apiVersion"; + @jakarta.annotation.Nonnull + private String apiVersion; + + public static final String JSON_PROPERTY_SELLER_ID = "sellerId"; + @jakarta.annotation.Nonnull + private Long sellerId; + + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private Map data = new HashMap<>(); + + public WebhookEvent() { + } + + public WebhookEvent id(@jakarta.annotation.Nonnull UUID 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 UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@jakarta.annotation.Nonnull UUID id) { + this.id = id; + } + + + public WebhookEvent 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 WebhookEvent createdAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WebhookEvent apiVersion(@jakarta.annotation.Nonnull String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get apiVersion + * @return apiVersion + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_API_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiVersion() { + return apiVersion; + } + + + @JsonProperty(value = JSON_PROPERTY_API_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setApiVersion(@jakarta.annotation.Nonnull String apiVersion) { + this.apiVersion = apiVersion; + } + + + public WebhookEvent sellerId(@jakarta.annotation.Nonnull Long sellerId) { + this.sellerId = sellerId; + return this; + } + + /** + * Get sellerId + * @return sellerId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SELLER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSellerId() { + return sellerId; + } + + + @JsonProperty(value = JSON_PROPERTY_SELLER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSellerId(@jakarta.annotation.Nonnull Long sellerId) { + this.sellerId = sellerId; + } + + + public WebhookEvent data(@jakarta.annotation.Nonnull Map data) { + this.data = data; + return this; + } + + public WebhookEvent putDataItem(String key, Object dataItem) { + if (this.data == null) { + this.data = new HashMap<>(); + } + this.data.put(key, dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public Map getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull Map data) { + this.data = data; + } + + + /** + * Return true if this WebhookEvent object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEvent webhookEvent = (WebhookEvent) o; + return Objects.equals(this.id, webhookEvent.id) && + Objects.equals(this.type, webhookEvent.type) && + Objects.equals(this.createdAt, webhookEvent.createdAt) && + Objects.equals(this.apiVersion, webhookEvent.apiVersion) && + Objects.equals(this.sellerId, webhookEvent.sellerId) && + Objects.equals(this.data, webhookEvent.data); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, apiVersion, sellerId, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); + sb.append(" sellerId: ").append(toIndentedString(sellerId)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 `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 `createdAt` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%screatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCreatedAt())))); + } + + // add `apiVersion` to the URL query string + if (getApiVersion() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sapiVersion%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getApiVersion())))); + } + + // add `sellerId` to the URL query string + if (getSellerId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssellerId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSellerId())))); + } + + // add `data` to the URL query string + if (getData() != null) { + for (String _key : getData().keySet()) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdata%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix), + getData().get(_key), ApiClient.urlEncode(ApiClient.valueToString(getData().get(_key))))); + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookEventPage.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventPage.java new file mode 100644 index 0000000..e31afcc --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventPage.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.WebhookEvent; +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; +/** + * WebhookEventPage + */ +@JsonPropertyOrder({ + WebhookEventPage.JSON_PROPERTY_DATA, + WebhookEventPage.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEventPage { + 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 WebhookEventPage() { + } + + public WebhookEventPage data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public WebhookEventPage addDataItem(WebhookEvent 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 WebhookEventPage 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 WebhookEventPage object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEventPage webhookEventPage = (WebhookEventPage) o; + return Objects.equals(this.data, webhookEventPage.data) && + equalsNullable(this.nextCursor, webhookEventPage.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 WebhookEventPage {\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/WebhookEventType.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventType.java new file mode 100644 index 0000000..4a03ea5 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventType.java @@ -0,0 +1,206 @@ +/* + * 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; +/** + * WebhookEventType + */ +@JsonPropertyOrder({ + WebhookEventType.JSON_PROPERTY_TYPE, + WebhookEventType.JSON_PROPERTY_SCOPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEventType { + public static final String JSON_PROPERTY_TYPE = "type"; + @jakarta.annotation.Nonnull + private String type; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private JsonNullable scope = JsonNullable.undefined(); + + public WebhookEventType() { + } + + public WebhookEventType 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 WebhookEventType scope(@jakarta.annotation.Nullable String scope) { + this.scope = JsonNullable.of(scope); + return this; + } + + /** + * Get scope + * @return scope + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getScope() { + return scope.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_SCOPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getScope_JsonNullable() { + return scope; + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + public void setScope_JsonNullable(JsonNullable scope) { + this.scope = scope; + } + + public void setScope(@jakarta.annotation.Nullable String scope) { + this.scope = JsonNullable.of(scope); + } + + + /** + * Return true if this WebhookEventType object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEventType webhookEventType = (WebhookEventType) o; + return Objects.equals(this.type, webhookEventType.type) && + equalsNullable(this.scope, webhookEventType.scope); + } + + 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(type, hashCodeNullable(scope)); + } + + 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 WebhookEventType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 `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 `scope` to the URL query string + if (getScope() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sscope%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getScope())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookEventTypeList.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventTypeList.java new file mode 100644 index 0000000..b87019e --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookEventTypeList.java @@ -0,0 +1,164 @@ +/* + * 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.WebhookEventType; +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; +/** + * WebhookEventTypeList + */ +@JsonPropertyOrder({ + WebhookEventTypeList.JSON_PROPERTY_DATA +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookEventTypeList { + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private List data = new ArrayList<>(); + + public WebhookEventTypeList() { + } + + public WebhookEventTypeList data(@jakarta.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public WebhookEventTypeList addDataItem(WebhookEventType 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; + } + + + /** + * Return true if this WebhookEventTypeList object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookEventTypeList webhookEventTypeList = (WebhookEventTypeList) o; + return Objects.equals(this.data, webhookEventTypeList.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookEventTypeList {\n"); + sb.append(" data: ").append(toIndentedString(data)).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)))); + } + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookRecoverRequest.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookRecoverRequest.java new file mode 100644 index 0000000..77e7d74 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookRecoverRequest.java @@ -0,0 +1,149 @@ +/* + * 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.time.OffsetDateTime; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.controlresell.sdk.generated.ApiClient; +/** + * WebhookRecoverRequest + */ +@JsonPropertyOrder({ + WebhookRecoverRequest.JSON_PROPERTY_SINCE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookRecoverRequest { + public static final String JSON_PROPERTY_SINCE = "since"; + @jakarta.annotation.Nonnull + private OffsetDateTime since; + + public WebhookRecoverRequest() { + } + + public WebhookRecoverRequest since(@jakarta.annotation.Nonnull OffsetDateTime since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SINCE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getSince() { + return since; + } + + + @JsonProperty(value = JSON_PROPERTY_SINCE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSince(@jakarta.annotation.Nonnull OffsetDateTime since) { + this.since = since; + } + + + /** + * Return true if this WebhookRecoverRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookRecoverRequest webhookRecoverRequest = (WebhookRecoverRequest) o; + return Objects.equals(this.since, webhookRecoverRequest.since); + } + + @Override + public int hashCode() { + return Objects.hash(since); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookRecoverRequest {\n"); + sb.append(" since: ").append(toIndentedString(since)).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 `since` to the URL query string + if (getSince() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssince%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSince())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookRecovery.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookRecovery.java new file mode 100644 index 0000000..c0c4006 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookRecovery.java @@ -0,0 +1,184 @@ +/* + * 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; +/** + * WebhookRecovery + */ +@JsonPropertyOrder({ + WebhookRecovery.JSON_PROPERTY_COUNT, + WebhookRecovery.JSON_PROPERTY_HAS_MORE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookRecovery { + public static final String JSON_PROPERTY_COUNT = "count"; + @jakarta.annotation.Nonnull + private Long count; + + public static final String JSON_PROPERTY_HAS_MORE = "hasMore"; + @jakarta.annotation.Nonnull + private Boolean hasMore; + + public WebhookRecovery() { + } + + public WebhookRecovery count(@jakarta.annotation.Nonnull Long count) { + this.count = count; + return this; + } + + /** + * Get count + * @return count + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getCount() { + return count; + } + + + @JsonProperty(value = JSON_PROPERTY_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCount(@jakarta.annotation.Nonnull Long count) { + this.count = count; + } + + + public WebhookRecovery hasMore(@jakarta.annotation.Nonnull Boolean hasMore) { + this.hasMore = hasMore; + return this; + } + + /** + * Get hasMore + * @return hasMore + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasMore() { + return hasMore; + } + + + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setHasMore(@jakarta.annotation.Nonnull Boolean hasMore) { + this.hasMore = hasMore; + } + + + /** + * Return true if this WebhookRecovery object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookRecovery webhookRecovery = (WebhookRecovery) o; + return Objects.equals(this.count, webhookRecovery.count) && + Objects.equals(this.hasMore, webhookRecovery.hasMore); + } + + @Override + public int hashCode() { + return Objects.hash(count, hasMore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookRecovery {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).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 `count` to the URL query string + if (getCount() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scount%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCount())))); + } + + // add `hasMore` to the URL query string + if (getHasMore() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%shasMore%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getHasMore())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookSecret.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookSecret.java new file mode 100644 index 0000000..21a8d9d --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookSecret.java @@ -0,0 +1,207 @@ +/* + * 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.time.OffsetDateTime; +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; +/** + * WebhookSecret + */ +@JsonPropertyOrder({ + WebhookSecret.JSON_PROPERTY_SECRET, + WebhookSecret.JSON_PROPERTY_PREVIOUS_SECRET_EXPIRES_AT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookSecret { + public static final String JSON_PROPERTY_SECRET = "secret"; + @jakarta.annotation.Nonnull + private String secret; + + public static final String JSON_PROPERTY_PREVIOUS_SECRET_EXPIRES_AT = "previousSecretExpiresAt"; + private JsonNullable previousSecretExpiresAt = JsonNullable.undefined(); + + public WebhookSecret() { + } + + public WebhookSecret secret(@jakarta.annotation.Nonnull String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * @return secret + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SECRET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSecret() { + return secret; + } + + + @JsonProperty(value = JSON_PROPERTY_SECRET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSecret(@jakarta.annotation.Nonnull String secret) { + this.secret = secret; + } + + + public WebhookSecret previousSecretExpiresAt(@jakarta.annotation.Nullable OffsetDateTime previousSecretExpiresAt) { + this.previousSecretExpiresAt = JsonNullable.of(previousSecretExpiresAt); + return this; + } + + /** + * Get previousSecretExpiresAt + * @return previousSecretExpiresAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getPreviousSecretExpiresAt() { + return previousSecretExpiresAt.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_PREVIOUS_SECRET_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPreviousSecretExpiresAt_JsonNullable() { + return previousSecretExpiresAt; + } + + @JsonProperty(JSON_PROPERTY_PREVIOUS_SECRET_EXPIRES_AT) + public void setPreviousSecretExpiresAt_JsonNullable(JsonNullable previousSecretExpiresAt) { + this.previousSecretExpiresAt = previousSecretExpiresAt; + } + + public void setPreviousSecretExpiresAt(@jakarta.annotation.Nullable OffsetDateTime previousSecretExpiresAt) { + this.previousSecretExpiresAt = JsonNullable.of(previousSecretExpiresAt); + } + + + /** + * Return true if this WebhookSecret object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSecret webhookSecret = (WebhookSecret) o; + return Objects.equals(this.secret, webhookSecret.secret) && + equalsNullable(this.previousSecretExpiresAt, webhookSecret.previousSecretExpiresAt); + } + + 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(secret, hashCodeNullable(previousSecretExpiresAt)); + } + + 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 WebhookSecret {\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" previousSecretExpiresAt: ").append(toIndentedString(previousSecretExpiresAt)).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 `secret` to the URL query string + if (getSecret() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssecret%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSecret())))); + } + + // add `previousSecretExpiresAt` to the URL query string + if (getPreviousSecretExpiresAt() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%spreviousSecretExpiresAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPreviousSecretExpiresAt())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookSecretRotateRequest.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookSecretRotateRequest.java new file mode 100644 index 0000000..3f4af97 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookSecretRotateRequest.java @@ -0,0 +1,170 @@ +/* + * 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; +/** + * WebhookSecretRotateRequest + */ +@JsonPropertyOrder({ + WebhookSecretRotateRequest.JSON_PROPERTY_EXPIRES_IN_HOURS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookSecretRotateRequest { + public static final String JSON_PROPERTY_EXPIRES_IN_HOURS = "expiresInHours"; + private JsonNullable expiresInHours = JsonNullable.undefined(); + + public WebhookSecretRotateRequest() { + } + + public WebhookSecretRotateRequest expiresInHours(@jakarta.annotation.Nullable Long expiresInHours) { + this.expiresInHours = JsonNullable.of(expiresInHours); + return this; + } + + /** + * Get expiresInHours + * @return expiresInHours + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getExpiresInHours() { + return expiresInHours.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_IN_HOURS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getExpiresInHours_JsonNullable() { + return expiresInHours; + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_IN_HOURS) + public void setExpiresInHours_JsonNullable(JsonNullable expiresInHours) { + this.expiresInHours = expiresInHours; + } + + public void setExpiresInHours(@jakarta.annotation.Nullable Long expiresInHours) { + this.expiresInHours = JsonNullable.of(expiresInHours); + } + + + /** + * Return true if this WebhookSecretRotateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSecretRotateRequest webhookSecretRotateRequest = (WebhookSecretRotateRequest) o; + return equalsNullable(this.expiresInHours, webhookSecretRotateRequest.expiresInHours); + } + + 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(hashCodeNullable(expiresInHours)); + } + + 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 WebhookSecretRotateRequest {\n"); + sb.append(" expiresInHours: ").append(toIndentedString(expiresInHours)).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 `expiresInHours` to the URL query string + if (getExpiresInHours() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sexpiresInHours%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getExpiresInHours())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/controlresell/sdk/generated/model/WebhookTestResult.java b/src/main/java/com/controlresell/sdk/generated/model/WebhookTestResult.java new file mode 100644 index 0000000..1ea6b99 --- /dev/null +++ b/src/main/java/com/controlresell/sdk/generated/model/WebhookTestResult.java @@ -0,0 +1,285 @@ +/* + * 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; +/** + * WebhookTestResult + */ +@JsonPropertyOrder({ + WebhookTestResult.JSON_PROPERTY_SUCCESS, + WebhookTestResult.JSON_PROPERTY_STATUS_CODE, + WebhookTestResult.JSON_PROPERTY_DURATION_MS, + WebhookTestResult.JSON_PROPERTY_ERROR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0") +public class WebhookTestResult { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_STATUS_CODE = "statusCode"; + private JsonNullable statusCode = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DURATION_MS = "durationMs"; + @jakarta.annotation.Nonnull + private Long durationMs; + + public static final String JSON_PROPERTY_ERROR = "error"; + private JsonNullable error = JsonNullable.undefined(); + + public WebhookTestResult() { + } + + public WebhookTestResult success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public WebhookTestResult statusCode(@jakarta.annotation.Nullable Long statusCode) { + this.statusCode = JsonNullable.of(statusCode); + return this; + } + + /** + * Get statusCode + * @return statusCode + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getStatusCode() { + return statusCode.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_STATUS_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStatusCode_JsonNullable() { + return statusCode; + } + + @JsonProperty(JSON_PROPERTY_STATUS_CODE) + public void setStatusCode_JsonNullable(JsonNullable statusCode) { + this.statusCode = statusCode; + } + + public void setStatusCode(@jakarta.annotation.Nullable Long statusCode) { + this.statusCode = JsonNullable.of(statusCode); + } + + + public WebhookTestResult durationMs(@jakarta.annotation.Nonnull Long durationMs) { + this.durationMs = durationMs; + return this; + } + + /** + * Get durationMs + * @return durationMs + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DURATION_MS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getDurationMs() { + return durationMs; + } + + + @JsonProperty(value = JSON_PROPERTY_DURATION_MS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDurationMs(@jakarta.annotation.Nonnull Long durationMs) { + this.durationMs = durationMs; + } + + + public WebhookTestResult error(@jakarta.annotation.Nullable String error) { + this.error = JsonNullable.of(error); + return this; + } + + /** + * Get error + * @return error + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getError() { + return error.orElse(null); + } + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getError_JsonNullable() { + return error; + } + + @JsonProperty(JSON_PROPERTY_ERROR) + public void setError_JsonNullable(JsonNullable error) { + this.error = error; + } + + public void setError(@jakarta.annotation.Nullable String error) { + this.error = JsonNullable.of(error); + } + + + /** + * Return true if this WebhookTestResult object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookTestResult webhookTestResult = (WebhookTestResult) o; + return Objects.equals(this.success, webhookTestResult.success) && + equalsNullable(this.statusCode, webhookTestResult.statusCode) && + Objects.equals(this.durationMs, webhookTestResult.durationMs) && + equalsNullable(this.error, webhookTestResult.error); + } + + 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(success, hashCodeNullable(statusCode), durationMs, hashCodeNullable(error)); + } + + 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 WebhookTestResult {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append(" durationMs: ").append(toIndentedString(durationMs)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `statusCode` to the URL query string + if (getStatusCode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sstatusCode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatusCode())))); + } + + // add `durationMs` to the URL query string + if (getDurationMs() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdurationMs%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDurationMs())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + 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..e27449e 100644 --- a/src/test/java/com/controlresell/sdk/ControlResellTest.java +++ b/src/test/java/com/controlresell/sdk/ControlResellTest.java @@ -357,4 +357,152 @@ 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()); } + + private static String favorite(String buyerId, String item) { + return "{\"id\":\"" + ACCOUNT + "\",\"accountId\":\"" + ACCOUNT + "\",\"platform\":\"VINTED\",\"buyerId\":\"" + buyerId + + "\",\"createdAt\":\"2026-10-24T00:00:00Z\",\"messageSentAt\":null,\"listingId\":\"" + ACCOUNT + "\",\"item\":" + item + "}"; + } + + private static final String FAVORITE_ITEM = + "{\"id\":42,\"name\":\"Jacket\",\"price\":{\"amount\":\"12.50\",\"currency\":\"EUR\"},\"sold\":false}"; + + @Test + void favoritesListAllFollowsTheCursorWithTheSameFilters() throws Exception { + ControlResell sdk = client(n -> n == 1 + ? new Reply(200, "{\"data\":[" + favorite("b1", FAVORITE_ITEM) + "],\"nextCursor\":\"c2\"}") + : new Reply(200, "{\"data\":[" + favorite("b2", "null") + "],\"nextCursor\":null}")); + List buyers = new ArrayList<>(); + var from = java.time.OffsetDateTime.parse("2026-10-01T00:00:00Z"); + for (var f : sdk.favorites().listAll(1, java.util.UUID.fromString(ACCOUNT), 42L, from, null)) buyers.add(f.getBuyerId()); + assertEquals(List.of("b1", "b2"), buyers); + assertEquals("/api/public/v1/favorites", exchanges.get(0).getRequestURI().getPath()); + for (String q : queries) { + assertTrue(q.contains("accountId=" + ACCOUNT) && q.contains("itemId=42") && q.contains("from=2026-10-01"), q); + } + assertTrue(!queries.get(0).contains("cursor") && queries.get(1).contains("cursor=c2"), queries.toString()); + } + + @Test + void favoritesListAllItemReadsTheFavoritesOfOneItem() throws Exception { + ControlResell sdk = client(n -> new Reply(200, "{\"data\":[" + favorite("b1", FAVORITE_ITEM) + "],\"nextCursor\":null}")); + List names = new ArrayList<>(); + for (var f : sdk.favorites().listAllItem(42, null, null, java.time.OffsetDateTime.parse("2026-10-02T00:00:00Z"))) { + names.add(f.getItem().getName()); + } + assertEquals(List.of("Jacket"), names); + assertEquals("/api/public/v1/items/42/favorites", exchanges.get(0).getRequestURI().getPath()); + assertTrue(queries.get(0).contains("to=2026-10-02"), queries.toString()); + } + + @Test + void conversationsListSendsTheBuyerItemAndOfferStatusFilters() throws Exception { + ControlResell sdk = client(n -> new Reply(200, "{\"data\":[],\"nextCursor\":null}")); + sdk.conversations().list(null, null, null, null, null, null, "b-1", 42L, "PENDING"); + String q = queries.get(0); + assertTrue(q.contains("buyerId=b-1") && q.contains("itemId=42") && q.contains("offerStatus=PENDING"), q); + } + + @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()); + } + + private static final String ENDPOINT_ID = "0b6f3c1e-8d43-4a4c-9a55-7f1f2c3d4e5f"; + private static final String ENDPOINT = "{\"id\":\"" + ENDPOINT_ID + "\",\"url\":\"https://example.com/hook\"," + + "\"description\":null,\"eventTypes\":[\"item.sold\"],\"payloadMode\":\"light\",\"status\":\"enabled\"," + + "\"apiVersion\":\"v1\",\"createdAt\":\"2026-10-24T00:00:00Z\",\"updatedAt\":\"2026-10-24T00:00:00Z\"}"; + + @Test + void webhooksCreateEndpointPostsWithAKeyAndReturnsTheSecret() throws Exception { + ControlResell sdk = client(n -> new Reply(201, "{\"endpoint\":" + ENDPOINT + ",\"secret\":\"whsec_abc\"}")); + var created = sdk.webhooks().createEndpoint(new com.controlresell.sdk.generated.model.WebhookEndpointCreateRequest() + .url("https://example.com/hook").eventTypes(List.of("item.sold"))); + assertEquals("whsec_abc", created.getSecret()); + assertEquals("POST", exchanges.get(0).getRequestMethod()); + assertEquals("/api/public/v1/webhook-endpoints", exchanges.get(0).getRequestURI().getPath()); + assertFalse(keys.get(0) == null || keys.get(0).isEmpty()); + assertTrue(bodies.get(0).contains("\"eventTypes\":[\"item.sold\"]"), bodies.get(0)); + } + + @Test + void webhooksUpdateEndpointSendsAnExplicitNullToClearTheDescription() throws Exception { + ControlResell sdk = client(n -> new Reply(200, ENDPOINT)); + var request = new com.controlresell.sdk.generated.model.WebhookEndpointUpdateRequest(); + request.setDescription(null); + sdk.webhooks().updateEndpoint(java.util.UUID.fromString(ENDPOINT_ID), request); + assertEquals("PATCH", exchanges.get(0).getRequestMethod()); + assertTrue(bodies.get(0).contains("\"description\":null") && !bodies.get(0).contains("url"), bodies.get(0)); + } + + @Test + void webhooksEventsAllFollowsTheCursorWithTheSameTypesAndReadsAnyData() throws Exception { + ControlResell sdk = client(n -> n == 1 + ? new Reply(200, "{\"data\":[{\"id\":\"0192f3c1-0000-7000-8000-000000000001\",\"type\":\"item.sold\"," + + "\"createdAt\":\"2026-10-24T00:00:00Z\",\"apiVersion\":\"v1\",\"sellerId\":7," + + "\"data\":{\"itemId\":42,\"source\":\"order\",\"object\":null}}],\"nextCursor\":\"c2\"}") + : new Reply(200, "{\"data\":[{\"id\":\"0192f3c1-0000-7000-8000-000000000002\",\"type\":\"order.created\"," + + "\"createdAt\":\"2026-10-24T00:01:00Z\",\"apiVersion\":\"v1\",\"sellerId\":7," + + "\"data\":{\"orderId\":\"o1\",\"items\":[1,2]}}],\"nextCursor\":null}")); + List types = new ArrayList<>(); + Object itemId = null; + for (var e : sdk.webhooks().eventsAll(null, null, List.of("item.sold", "order.created"))) { + types.add(e.getType()); + if (e.getType().equals("item.sold")) itemId = e.getData().get("itemId"); + } + assertEquals(List.of("item.sold", "order.created"), types); + assertEquals(42, ((Number) itemId).intValue()); + for (String q : queries) assertTrue(q.contains("type=item.sold,order.created"), q); + assertTrue(queries.get(1).contains("cursor=c2"), queries.toString()); + } + + @Test + void webhooksDeliveriesSendTheFiltersRetryPostsToTheDeliveryAndDeleteResolvesOn204() throws Exception { + String delivery = "{\"id\":\"11111111-2222-3333-4444-555555555555\",\"eventId\":\"11111111-2222-3333-4444-666666666666\"," + + "\"eventType\":\"item.sold\",\"status\":\"failed\",\"attempt\":3,\"createdAt\":\"2026-10-24T00:00:00Z\"," + + "\"updatedAt\":\"2026-10-24T00:00:00Z\"}"; + ControlResell sdk = client(n -> n == 1 ? new Reply(200, "{\"data\":[" + delivery + "],\"nextCursor\":null}") + : n == 2 ? new Reply(202, delivery) : new Reply(204, "")); + var id = java.util.UUID.fromString(ENDPOINT_ID); + assertEquals(3L, sdk.webhooks().deliveries(id, null, null, "failed", null).getData().get(0).getAttempt()); + sdk.webhooks().retryDelivery(id, java.util.UUID.fromString("11111111-2222-3333-4444-555555555555")); + sdk.webhooks().deleteEndpoint(id); + assertTrue(queries.get(0).contains("status=failed"), queries.toString()); + assertEquals("/api/public/v1/webhook-endpoints/" + ENDPOINT_ID + "/deliveries/11111111-2222-3333-4444-555555555555/retry", + exchanges.get(1).getRequestURI().getPath()); + assertFalse(keys.get(1) == null || keys.get(1).isEmpty()); + assertEquals("DELETE", exchanges.get(2).getRequestMethod()); + } + + @Test + void webhooksTestPostsWithAKeyAndReadsTheResult() throws Exception { + ControlResell sdk = client(n -> new Reply(200, "{\"success\":true,\"statusCode\":200,\"durationMs\":12,\"error\":null}")); + var result = sdk.webhooks().test(java.util.UUID.fromString(ENDPOINT_ID)); + assertTrue(result.getSuccess()); + assertEquals("/api/public/v1/webhook-endpoints/" + ENDPOINT_ID + "/test", exchanges.get(0).getRequestURI().getPath()); + assertFalse(keys.get(0) == null || keys.get(0).isEmpty()); + } }