From dc0ffec41f243a05738011b328abc548913f43c8 Mon Sep 17 00:00:00 2001 From: NathanFallet Date: Wed, 21 Oct 2026 17:40:18 +0100 Subject: [PATCH 1/2] feat: regenerate with the from/to filters and the orders labels route --- .spec-sha256 | 2 +- README.md | 2 +- .../com/controlresell/sdk/ControlResell.java | 45 ++++-- .../sdk/generated/api/ConversationsApi.java | 77 ++++++---- .../sdk/generated/api/OrdersApi.java | 134 ++++++++++++++++++ .../sdk/generated/model/OrderLabel.java | 38 ++++- .../controlresell/sdk/ControlResellTest.java | 21 +++ 7 files changed, 279 insertions(+), 40 deletions(-) diff --git a/.spec-sha256 b/.spec-sha256 index b5b7f17..c86c3d8 100644 --- a/.spec-sha256 +++ b/.spec-sha256 @@ -1 +1 @@ -1acbf02fb5996004ee72495da2440677842bc7d8a705b9a4a0741565f353df4e +1c648bd5dd3dab534723d1cb26e19fdbfcc7359cd8a33a1f8d99e5688e4ba54f diff --git a/README.md b/README.md index 16b96ae..8339c24 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ for (Item item : client.items().listAll(null, false, null)) { System.out.println(item.getName()); } 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) + System.out.println(order.getId()); // needs the orders:read scope; also orders().get(id), orders().labels(id), orders().listAllLabelsToShip(null) } // Writes (API key with items:write / conversations:write); the last argument, optional, is the Idempotency-Key. diff --git a/src/main/java/com/controlresell/sdk/ControlResell.java b/src/main/java/com/controlresell/sdk/ControlResell.java index 7aa0175..3de5129 100644 --- a/src/main/java/com/controlresell/sdk/ControlResell.java +++ b/src/main/java/com/controlresell/sdk/ControlResell.java @@ -20,6 +20,7 @@ import com.controlresell.sdk.generated.model.Message; import com.controlresell.sdk.generated.model.MessagePage; import com.controlresell.sdk.generated.model.Order; +import com.controlresell.sdk.generated.model.OrderLabel; import com.controlresell.sdk.generated.model.OrderLabelPage; import com.controlresell.sdk.generated.model.OrderPage; import com.controlresell.sdk.generated.model.PriceDropRequest; @@ -244,16 +245,23 @@ public final class Conversations { private Conversations() {} - /** One page of conversations; every argument may be {@code null}. */ - public ConversationPage list(Integer limit, String cursor, Boolean unread, UUID accountId) { - return call(false, h -> api.listConversations(limit, cursor, unread, accountId, h)); + /** + * One page of conversations; every argument may be {@code null}. {@code from} (inclusive) and {@code to} + * (exclusive) bound the last message. + */ + 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)); } public Conversation get(UUID id) { return call(false, h -> api.getConversation(id, h)); } - /** One page of the messages of a conversation, oldest first. */ - public MessagePage messages(UUID id, Integer limit, String cursor) { - return call(false, h -> api.listConversationMessages(id, limit, cursor, h)); + /** + * One page of the messages of a conversation, oldest first; {@code from} (inclusive) and {@code to} (exclusive) + * bound the period and may be {@code null}. + */ + public MessagePage messages(UUID id, Integer limit, String cursor, OffsetDateTime from, OffsetDateTime to) { + return call(false, h -> api.listConversationMessages(id, limit, cursor, from, to, h)); } /** Sends a message to the buyer, with a random {@code Idempotency-Key}. */ @@ -275,13 +283,15 @@ 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) { - return new Paginator<>(cursor -> list(limit, cursor, unread, accountId), p -> page(p.getData(), p.getNextCursor())); + public Iterable listAll(Integer limit, Boolean unread, UUID accountId, OffsetDateTime from, + OffsetDateTime to) { + return new Paginator<>(cursor -> list(limit, cursor, unread, accountId, from, to), + p -> page(p.getData(), p.getNextCursor())); } - /** Every message of a conversation, page after page. */ - public Iterable listAllMessages(UUID id, Integer limit) { - return new Paginator<>(cursor -> messages(id, limit, cursor), p -> page(p.getData(), p.getNextCursor())); + /** Every message of a conversation, page after page, with the same period. */ + public Iterable listAllMessages(UUID id, Integer limit, OffsetDateTime from, OffsetDateTime to) { + return new Paginator<>(cursor -> messages(id, limit, cursor, from, to), p -> page(p.getData(), p.getNextCursor())); } } @@ -305,6 +315,19 @@ public OrderPage list(Integer limit, String cursor, String bucket, String platfo /** The shipping labels of an order. */ public OrderLabelPage labels(UUID id) { return call(false, h -> api.listOrderLabels(id, h)); } + /** + * One page of the shipping labels still to ship over all the orders, the oldest order first; each label names its + * order ({@code getOrderId()}). Both arguments may be {@code null}. + */ + public OrderLabelPage labelsToShip(Integer limit, String cursor) { + return call(false, h -> api.listLabelsToShip(limit, cursor, h)); + } + + /** Every label still to ship, page after page. */ + public Iterable listAllLabelsToShip(Integer limit) { + return new Paginator<>(cursor -> labelsToShip(limit, cursor), p -> page(p.getData(), p.getNextCursor())); + } + /** Every order, page after page, with the same filters. */ public Iterable listAll(Integer limit, String bucket, String platform, UUID accountId, OffsetDateTime from, OffsetDateTime to) { 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 7c39422..f5a4a94 100644 --- a/src/main/java/com/controlresell/sdk/generated/api/ConversationsApi.java +++ b/src/main/java/com/controlresell/sdk/generated/api/ConversationsApi.java @@ -23,6 +23,7 @@ import com.controlresell.sdk.generated.model.ErrorResponse; import com.controlresell.sdk.generated.model.Message; import com.controlresell.sdk.generated.model.MessagePage; +import java.time.OffsetDateTime; import com.controlresell.sdk.generated.model.SendMessageRequest; import com.controlresell.sdk.generated.model.SendOfferRequest; import java.util.UUID; @@ -289,57 +290,65 @@ private HttpRequest.Builder getConversationRequestBuilder(@jakarta.annotation.No /** * List the messages of a conversation - * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages. Requires `conversations:read`. + * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages (of the period, with `from` or `to`). Pass the `nextCursor` of a page as `cursor` with the same `from` and `to` (a cursor reused with others is an `invalid_cursor`). `from` and `to` go straight to a period: `from` is inclusive, `to` exclusive. Requires `conversations:read`. * @param id The conversation's identifier, a UUID. (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 messages created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the messages created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) * @return MessagePage * @throws ApiException if fails to make API call */ - public MessagePage listConversationMessages(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { - return listConversationMessages(id, limit, cursor, null); + public MessagePage listConversationMessages(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { + return listConversationMessages(id, limit, cursor, from, to, null); } /** * List the messages of a conversation - * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages. Requires `conversations:read`. + * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages (of the period, with `from` or `to`). Pass the `nextCursor` of a page as `cursor` with the same `from` and `to` (a cursor reused with others is an `invalid_cursor`). `from` and `to` go straight to a period: `from` is inclusive, `to` exclusive. Requires `conversations:read`. * @param id The conversation's identifier, a UUID. (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 messages created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the messages created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) * @param headers Optional headers to include in the request * @return MessagePage * @throws ApiException if fails to make API call */ - public MessagePage listConversationMessages(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { - ApiResponse localVarResponse = listConversationMessagesWithHttpInfo(id, limit, cursor, headers); + public MessagePage listConversationMessages(@jakarta.annotation.Nonnull UUID 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 = listConversationMessagesWithHttpInfo(id, limit, cursor, from, to, headers); return localVarResponse.getData(); } /** * List the messages of a conversation - * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages. Requires `conversations:read`. + * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages (of the period, with `from` or `to`). Pass the `nextCursor` of a page as `cursor` with the same `from` and `to` (a cursor reused with others is an `invalid_cursor`). `from` and `to` go straight to a period: `from` is inclusive, `to` exclusive. Requires `conversations:read`. * @param id The conversation's identifier, a UUID. (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 messages created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the messages created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) * @return ApiResponse<MessagePage> * @throws ApiException if fails to make API call */ - public ApiResponse listConversationMessagesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { - return listConversationMessagesWithHttpInfo(id, limit, cursor, null); + public ApiResponse listConversationMessagesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, @jakarta.annotation.Nullable OffsetDateTime from, @jakarta.annotation.Nullable OffsetDateTime to) throws ApiException { + return listConversationMessagesWithHttpInfo(id, limit, cursor, from, to, null); } /** * List the messages of a conversation - * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages. Requires `conversations:read`. + * The messages of one conversation, oldest first, one page at a time: at most its 1 000 most recent messages (of the period, with `from` or `to`). Pass the `nextCursor` of a page as `cursor` with the same `from` and `to` (a cursor reused with others is an `invalid_cursor`). `from` and `to` go straight to a period: `from` is inclusive, `to` exclusive. Requires `conversations:read`. * @param id The conversation's identifier, a UUID. (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 messages created at or after this instant (inclusive), ISO-8601 with its offset, such as `2026-10-01T00:00:00Z`. (optional) + * @param to Only the messages created before this instant (exclusive), ISO-8601 with its offset; after `from`. (optional) * @param headers Optional headers to include in the request * @return ApiResponse<MessagePage> * @throws ApiException if fails to make API call */ - public ApiResponse listConversationMessagesWithHttpInfo(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = listConversationMessagesRequestBuilder(id, limit, cursor, headers); + public ApiResponse listConversationMessagesWithHttpInfo(@jakarta.annotation.Nonnull UUID 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 = listConversationMessagesRequestBuilder(id, limit, cursor, from, to, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -386,7 +395,7 @@ public ApiResponse listConversationMessagesWithHttpInfo(@jakarta.an } } - private HttpRequest.Builder listConversationMessagesRequestBuilder(@jakarta.annotation.Nonnull UUID id, @jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + private HttpRequest.Builder listConversationMessagesRequestBuilder(@jakarta.annotation.Nonnull UUID 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 listConversationMessages"); @@ -404,6 +413,10 @@ private HttpRequest.Builder listConversationMessagesRequestBuilder(@jakarta.anno 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("&"); @@ -432,61 +445,69 @@ 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. 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. 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) * @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) throws ApiException { - return listConversations(limit, cursor, unread, accountId, 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) throws ApiException { + return listConversations(limit, cursor, unread, accountId, from, to, 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. 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. 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 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, Map headers) throws ApiException { - ApiResponse localVarResponse = listConversationsWithHttpInfo(limit, cursor, unread, accountId, 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, Map headers) throws ApiException { + ApiResponse localVarResponse = listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, 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. 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. 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) * @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) throws ApiException { - return listConversationsWithHttpInfo(limit, cursor, unread, accountId, 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) throws ApiException { + return listConversationsWithHttpInfo(limit, cursor, unread, accountId, from, to, 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. 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. 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 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, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = listConversationsRequestBuilder(limit, cursor, unread, accountId, 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, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listConversationsRequestBuilder(limit, cursor, unread, accountId, from, to, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -533,7 +554,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, 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, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -550,6 +571,10 @@ private HttpRequest.Builder listConversationsRequestBuilder(@jakarta.annotation. localVarQueryParams.addAll(ApiClient.parameterToPairs("unread", unread)); localVarQueryParameterBaseName = "accountId"; localVarQueryParams.addAll(ApiClient.parameterToPairs("accountId", accountId)); + 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("&"); diff --git a/src/main/java/com/controlresell/sdk/generated/api/OrdersApi.java b/src/main/java/com/controlresell/sdk/generated/api/OrdersApi.java index 4d1d896..2fb5761 100644 --- a/src/main/java/com/controlresell/sdk/generated/api/OrdersApi.java +++ b/src/main/java/com/controlresell/sdk/generated/api/OrdersApi.java @@ -285,6 +285,140 @@ private HttpRequest.Builder getOrderRequestBuilder(@jakarta.annotation.Nonnull U return localVarRequestBuilder; } + /** + * List the shipping labels still to ship + * The shipping labels of the seller's orders waiting to be shipped (label ordered or sent to the seller, order not marked prepared), oldest order first, one page at a time. Each label names its order. The links are signed and expire: read them again rather than storing them. Requires `orders:read`. + * @param limit Page size, 1 to 100 (50 by default). (optional, default to 50) + * @param cursor The `nextCursor` of the previous page. (optional) + * @return OrderLabelPage + * @throws ApiException if fails to make API call + */ + public OrderLabelPage listLabelsToShip(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listLabelsToShip(limit, cursor, null); + } + + /** + * List the shipping labels still to ship + * The shipping labels of the seller's orders waiting to be shipped (label ordered or sent to the seller, order not marked prepared), oldest order first, one page at a time. Each label names its order. The links are signed and expire: read them again rather than storing them. Requires `orders: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 headers Optional headers to include in the request + * @return OrderLabelPage + * @throws ApiException if fails to make API call + */ + public OrderLabelPage listLabelsToShip(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + ApiResponse localVarResponse = listLabelsToShipWithHttpInfo(limit, cursor, headers); + return localVarResponse.getData(); + } + + /** + * List the shipping labels still to ship + * The shipping labels of the seller's orders waiting to be shipped (label ordered or sent to the seller, order not marked prepared), oldest order first, one page at a time. Each label names its order. The links are signed and expire: read them again rather than storing them. Requires `orders:read`. + * @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<OrderLabelPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listLabelsToShipWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor) throws ApiException { + return listLabelsToShipWithHttpInfo(limit, cursor, null); + } + + /** + * List the shipping labels still to ship + * The shipping labels of the seller's orders waiting to be shipped (label ordered or sent to the seller, order not marked prepared), oldest order first, one page at a time. Each label names its order. The links are signed and expire: read them again rather than storing them. Requires `orders: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 headers Optional headers to include in the request + * @return ApiResponse<OrderLabelPage> + * @throws ApiException if fails to make API call + */ + public ApiResponse listLabelsToShipWithHttpInfo(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = listLabelsToShipRequestBuilder(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("listLabelsToShip", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + OrderLabelPage 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 listLabelsToShipRequestBuilder(@jakarta.annotation.Nullable Integer limit, @jakarta.annotation.Nullable String cursor, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/public/v1/orders/labels"; + + 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)); + + 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; + } + /** * The shipping labels of an order * The order's shipping labels, in one page (`nextCursor` is `null`). The links are signed and expire: read them again rather than storing them. Requires `orders:read`. diff --git a/src/main/java/com/controlresell/sdk/generated/model/OrderLabel.java b/src/main/java/com/controlresell/sdk/generated/model/OrderLabel.java index 8aa08b6..f87eb43 100644 --- a/src/main/java/com/controlresell/sdk/generated/model/OrderLabel.java +++ b/src/main/java/com/controlresell/sdk/generated/model/OrderLabel.java @@ -36,6 +36,7 @@ */ @JsonPropertyOrder({ OrderLabel.JSON_PROPERTY_ID, + OrderLabel.JSON_PROPERTY_ORDER_ID, OrderLabel.JSON_PROPERTY_CARRIER, OrderLabel.JSON_PROPERTY_URL, OrderLabel.JSON_PROPERTY_ORIGINAL_URL, @@ -47,6 +48,10 @@ public class OrderLabel { @jakarta.annotation.Nonnull private UUID id; + public static final String JSON_PROPERTY_ORDER_ID = "orderId"; + @jakarta.annotation.Nonnull + private UUID orderId; + public static final String JSON_PROPERTY_CARRIER = "carrier"; @jakarta.annotation.Nullable private String carrier; @@ -90,6 +95,30 @@ public void setId(@jakarta.annotation.Nonnull UUID id) { } + public OrderLabel orderId(@jakarta.annotation.Nonnull UUID orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * @return orderId + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ORDER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getOrderId() { + return orderId; + } + + + @JsonProperty(value = JSON_PROPERTY_ORDER_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOrderId(@jakarta.annotation.Nonnull UUID orderId) { + this.orderId = orderId; + } + + public OrderLabel carrier(@jakarta.annotation.Nullable String carrier) { this.carrier = carrier; return this; @@ -199,6 +228,7 @@ public boolean equals(Object o) { } OrderLabel orderLabel = (OrderLabel) o; return Objects.equals(this.id, orderLabel.id) && + Objects.equals(this.orderId, orderLabel.orderId) && Objects.equals(this.carrier, orderLabel.carrier) && Objects.equals(this.url, orderLabel.url) && Objects.equals(this.originalUrl, orderLabel.originalUrl) && @@ -207,7 +237,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, carrier, url, originalUrl, createdAt); + return Objects.hash(id, orderId, carrier, url, originalUrl, createdAt); } @Override @@ -215,6 +245,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OrderLabel {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); sb.append(" carrier: ").append(toIndentedString(carrier)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" originalUrl: ").append(toIndentedString(originalUrl)).append("\n"); @@ -268,6 +299,11 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); } + // add `orderId` to the URL query string + if (getOrderId() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sorderId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOrderId())))); + } + // add `carrier` to the URL query string if (getCarrier() != null) { joiner.add(String.format(java.util.Locale.ROOT, "%scarrier%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCarrier())))); diff --git a/src/test/java/com/controlresell/sdk/ControlResellTest.java b/src/test/java/com/controlresell/sdk/ControlResellTest.java index ff2684f..9dc0fec 100644 --- a/src/test/java/com/controlresell/sdk/ControlResellTest.java +++ b/src/test/java/com/controlresell/sdk/ControlResellTest.java @@ -298,4 +298,25 @@ void ordersListAllFollowsTheCursorWithTheSameFilters() throws Exception { for (String q : queries) assertTrue(q.contains("bucket=to_send") && q.contains("platform=VINTED") && q.contains("from="), q); assertTrue(!queries.get(0).contains("cursor") && queries.get(1).contains("cursor=c2"), queries.toString()); } + + @Test + void ordersListAllLabelsToShipFollowsTheCursorOnOrdersLabels() throws Exception { + ControlResell sdk = client(n -> n == 1 + ? new Reply(200, "{\"data\":[{\"id\":\"" + ACCOUNT + "\",\"orderId\":\"" + ACCOUNT + "\"}],\"nextCursor\":\"c2\"}") + : new Reply(200, "{\"data\":[{\"id\":\"" + ACCOUNT + "\",\"orderId\":\"" + ACCOUNT + "\"}],\"nextCursor\":null}")); + List ids = new ArrayList<>(); + for (var l : sdk.orders().listAllLabelsToShip(1)) ids.add(l.getOrderId().toString()); + assertEquals(List.of(ACCOUNT, ACCOUNT), ids); + assertEquals("/api/public/v1/orders/labels", exchanges.get(0).getRequestURI().getPath()); + assertTrue(queries.get(1).contains("cursor=c2"), queries.toString()); + } + + @Test + void conversationMessagesSendTheFromAndToWindow() throws Exception { + ControlResell sdk = client(n -> new Reply(200, "{\"data\":[],\"nextCursor\":null}")); + java.util.UUID id = java.util.UUID.fromString(ACCOUNT); + sdk.conversations().messages(id, null, null, java.time.OffsetDateTime.parse("2026-10-01T00:00:00Z"), + java.time.OffsetDateTime.parse("2026-10-02T00:00:00Z")); + assertTrue(queries.get(0).contains("from=2026-10-01") && queries.get(0).contains("to=2026-10-02"), queries.toString()); + } } From 7ea2854d08ee38a4b6fa16bd50aa9e4b7ed4299e Mon Sep 17 00:00:00 2001 From: NathanFallet Date: Wed, 21 Oct 2026 17:45:55 +0100 Subject: [PATCH 2/2] Leave the README alone (ENG-055) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8339c24..16b96ae 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ for (Item item : client.items().listAll(null, false, null)) { System.out.println(item.getName()); } 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), orders().listAllLabelsToShip(null) + System.out.println(order.getId()); // needs the orders:read scope; also orders().get(id), orders().labels(id) } // Writes (API key with items:write / conversations:write); the last argument, optional, is the Idempotency-Key.