Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .spec-sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d95f1962bb73a3e9792c2de01bd086edce7d3c1371ece42f7c4f12032cd29e17
06a7c92e23df7c44f8898a2b18abec43aa5c14b8f12ea10e1ce65a94a14a0fb4
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ client.conversations().list(null, null, null, null, null, null, "BUYER_ID", null
// 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.items().publish(42, new PublishRequest().accountIds(List.of(accountId)).scheduledAt(OffsetDateTime.parse("2026-11-02T10:00:00Z"))); // publish, priceDrop and republish take an optional scheduledAt, at most 30 days ahead; without it they run now
client.conversations().sendMessage(conversationId, new SendMessageRequest().text("Hello!"));

// Webhooks (webhooks:read / webhooks:write): endpoints, endpoint, createEndpoint, updateEndpoint, deleteEndpoint, secret,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/controlresell/sdk/ControlResell.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void delete(long id) {
});
}

/** Schedules the publication of an item on the given accounts, with a random {@code Idempotency-Key}. */
/** Schedules the publication of an item on the given accounts, now or at {@code request.scheduledAt(...)} (at most 30 days ahead), with a random {@code Idempotency-Key}. */
public ScheduledAction publish(long id, PublishRequest request) { return publish(id, request, null); }

/** Schedules the publication of an item on the given accounts; {@code idempotencyKey} may be {@code null}. */
Expand All @@ -263,7 +263,7 @@ public ScheduledAction publish(long id, PublishRequest request, String idempoten
return call(false, h -> api.publishItem(id, key, request));
}

/** Schedules a price drop of the item's listings, with a random {@code Idempotency-Key}. */
/** Schedules a price drop of the item's listings, now or at {@code request.scheduledAt(...)} (at most 30 days ahead), with a random {@code Idempotency-Key}. */
public ScheduledAction priceDrop(long id, PriceDropRequest request) { return priceDrop(id, request, null); }

/** Schedules a price drop of the item's listings; {@code idempotencyKey} may be {@code null}. */
Expand All @@ -272,7 +272,7 @@ public ScheduledAction priceDrop(long id, PriceDropRequest request, String idemp
return call(false, h -> api.dropItemPrice(id, key, request));
}

/** Schedules the republication of an item, with a random {@code Idempotency-Key}; {@code request} may be {@code null} (every account the item is listed on). */
/** Schedules the republication of an item, now or at {@code request.scheduledAt(...)} (at most 30 days ahead), with a random {@code Idempotency-Key}; {@code request} may be {@code null} (every account the item is listed on, now). */
public ScheduledAction republish(long id, RepublishRequest request) { return republish(id, request, null); }

/** Schedules the republication of an item; {@code request} and {@code idempotencyKey} may be {@code null}. */
Expand Down

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/main/java/com/controlresell/sdk/generated/api/ItemsApi.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -44,7 +45,8 @@
PriceDropRequest.JSON_PROPERTY_VALUE,
PriceDropRequest.JSON_PROPERTY_ROUND_TYPE,
PriceDropRequest.JSON_PROPERTY_ROUND_STEP,
PriceDropRequest.JSON_PROPERTY_ACCOUNT_IDS
PriceDropRequest.JSON_PROPERTY_ACCOUNT_IDS,
PriceDropRequest.JSON_PROPERTY_SCHEDULED_AT
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0")
public class PriceDropRequest {
Expand All @@ -65,6 +67,9 @@ public class PriceDropRequest {
public static final String JSON_PROPERTY_ACCOUNT_IDS = "accountIds";
private JsonNullable<List<UUID>> accountIds = JsonNullable.<List<UUID>>undefined();

public static final String JSON_PROPERTY_SCHEDULED_AT = "scheduledAt";
private JsonNullable<OffsetDateTime> scheduledAt = JsonNullable.<OffsetDateTime>undefined();

public PriceDropRequest() {
}

Expand Down Expand Up @@ -224,6 +229,38 @@ public void setAccountIds(@jakarta.annotation.Nullable List<UUID> accountIds) {
}


public PriceDropRequest scheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
return this;
}

/**
* Get scheduledAt
* @return scheduledAt
*/
@jakarta.annotation.Nullable
@JsonIgnore
public OffsetDateTime getScheduledAt() {
return scheduledAt.orElse(null);
}

@JsonProperty(value = JSON_PROPERTY_SCHEDULED_AT, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public JsonNullable<OffsetDateTime> getScheduledAt_JsonNullable() {
return scheduledAt;
}

@JsonProperty(JSON_PROPERTY_SCHEDULED_AT)
public void setScheduledAt_JsonNullable(JsonNullable<OffsetDateTime> scheduledAt) {
this.scheduledAt = scheduledAt;
}

public void setScheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
}


/**
* Return true if this PriceDropRequest object is equal to o.
*/
Expand All @@ -240,7 +277,8 @@ public boolean equals(Object o) {
Objects.equals(this.value, priceDropRequest.value) &&
equalsNullable(this.roundType, priceDropRequest.roundType) &&
equalsNullable(this.roundStep, priceDropRequest.roundStep) &&
equalsNullable(this.accountIds, priceDropRequest.accountIds);
equalsNullable(this.accountIds, priceDropRequest.accountIds) &&
equalsNullable(this.scheduledAt, priceDropRequest.scheduledAt);
}

private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
Expand All @@ -249,7 +287,7 @@ private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b)

@Override
public int hashCode() {
return Objects.hash(type, value, hashCodeNullable(roundType), hashCodeNullable(roundStep), hashCodeNullable(accountIds));
return Objects.hash(type, value, hashCodeNullable(roundType), hashCodeNullable(roundStep), hashCodeNullable(accountIds), hashCodeNullable(scheduledAt));
}

private static <T> int hashCodeNullable(JsonNullable<T> a) {
Expand All @@ -268,6 +306,7 @@ public String toString() {
sb.append(" roundType: ").append(toIndentedString(roundType)).append("\n");
sb.append(" roundStep: ").append(toIndentedString(roundStep)).append("\n");
sb.append(" accountIds: ").append(toIndentedString(accountIds)).append("\n");
sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -343,6 +382,11 @@ public String toUrlQueryString(String prefix) {
}
}

// add `scheduledAt` to the URL query string
if (getScheduledAt() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sscheduledAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getScheduledAt()))));
}

return joiner.toString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -41,7 +42,8 @@
*/
@JsonPropertyOrder({
PublishRequest.JSON_PROPERTY_ACCOUNT_IDS,
PublishRequest.JSON_PROPERTY_CANCEL_BEFORE_PROCEEDING
PublishRequest.JSON_PROPERTY_CANCEL_BEFORE_PROCEEDING,
PublishRequest.JSON_PROPERTY_SCHEDULED_AT
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0")
public class PublishRequest {
Expand All @@ -52,6 +54,9 @@ public class PublishRequest {
public static final String JSON_PROPERTY_CANCEL_BEFORE_PROCEEDING = "cancelBeforeProceeding";
private JsonNullable<Boolean> cancelBeforeProceeding = JsonNullable.<Boolean>undefined();

public static final String JSON_PROPERTY_SCHEDULED_AT = "scheduledAt";
private JsonNullable<OffsetDateTime> scheduledAt = JsonNullable.<OffsetDateTime>undefined();

public PublishRequest() {
}

Expand Down Expand Up @@ -119,6 +124,38 @@ public void setCancelBeforeProceeding(@jakarta.annotation.Nullable Boolean cance
}


public PublishRequest scheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
return this;
}

/**
* Get scheduledAt
* @return scheduledAt
*/
@jakarta.annotation.Nullable
@JsonIgnore
public OffsetDateTime getScheduledAt() {
return scheduledAt.orElse(null);
}

@JsonProperty(value = JSON_PROPERTY_SCHEDULED_AT, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public JsonNullable<OffsetDateTime> getScheduledAt_JsonNullable() {
return scheduledAt;
}

@JsonProperty(JSON_PROPERTY_SCHEDULED_AT)
public void setScheduledAt_JsonNullable(JsonNullable<OffsetDateTime> scheduledAt) {
this.scheduledAt = scheduledAt;
}

public void setScheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
}


/**
* Return true if this PublishRequest object is equal to o.
*/
Expand All @@ -132,7 +169,8 @@ public boolean equals(Object o) {
}
PublishRequest publishRequest = (PublishRequest) o;
return Objects.equals(this.accountIds, publishRequest.accountIds) &&
equalsNullable(this.cancelBeforeProceeding, publishRequest.cancelBeforeProceeding);
equalsNullable(this.cancelBeforeProceeding, publishRequest.cancelBeforeProceeding) &&
equalsNullable(this.scheduledAt, publishRequest.scheduledAt);
}

private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
Expand All @@ -141,7 +179,7 @@ private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b)

@Override
public int hashCode() {
return Objects.hash(accountIds, hashCodeNullable(cancelBeforeProceeding));
return Objects.hash(accountIds, hashCodeNullable(cancelBeforeProceeding), hashCodeNullable(scheduledAt));
}

private static <T> int hashCodeNullable(JsonNullable<T> a) {
Expand All @@ -157,6 +195,7 @@ public String toString() {
sb.append("class PublishRequest {\n");
sb.append(" accountIds: ").append(toIndentedString(accountIds)).append("\n");
sb.append(" cancelBeforeProceeding: ").append(toIndentedString(cancelBeforeProceeding)).append("\n");
sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -217,6 +256,11 @@ public String toUrlQueryString(String prefix) {
joiner.add(String.format(java.util.Locale.ROOT, "%scancelBeforeProceeding%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCancelBeforeProceeding()))));
}

// add `scheduledAt` to the URL query string
if (getScheduledAt() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sscheduledAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getScheduledAt()))));
}

return joiner.toString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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;
Expand All @@ -44,7 +45,8 @@
RepublishRequest.JSON_PROPERTY_ACCOUNT_IDS,
RepublishRequest.JSON_PROPERTY_PRICE_DROP,
RepublishRequest.JSON_PROPERTY_PRICE_VARIATION,
RepublishRequest.JSON_PROPERTY_ALLOW_IF_DELETED
RepublishRequest.JSON_PROPERTY_ALLOW_IF_DELETED,
RepublishRequest.JSON_PROPERTY_SCHEDULED_AT
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0")
public class RepublishRequest {
Expand All @@ -60,6 +62,9 @@ public class RepublishRequest {
public static final String JSON_PROPERTY_ALLOW_IF_DELETED = "allowIfDeleted";
private JsonNullable<Boolean> allowIfDeleted = JsonNullable.<Boolean>undefined();

public static final String JSON_PROPERTY_SCHEDULED_AT = "scheduledAt";
private JsonNullable<OffsetDateTime> scheduledAt = JsonNullable.<OffsetDateTime>undefined();

public RepublishRequest() {
}

Expand Down Expand Up @@ -203,6 +208,38 @@ public void setAllowIfDeleted(@jakarta.annotation.Nullable Boolean allowIfDelete
}


public RepublishRequest scheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
return this;
}

/**
* Get scheduledAt
* @return scheduledAt
*/
@jakarta.annotation.Nullable
@JsonIgnore
public OffsetDateTime getScheduledAt() {
return scheduledAt.orElse(null);
}

@JsonProperty(value = JSON_PROPERTY_SCHEDULED_AT, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public JsonNullable<OffsetDateTime> getScheduledAt_JsonNullable() {
return scheduledAt;
}

@JsonProperty(JSON_PROPERTY_SCHEDULED_AT)
public void setScheduledAt_JsonNullable(JsonNullable<OffsetDateTime> scheduledAt) {
this.scheduledAt = scheduledAt;
}

public void setScheduledAt(@jakarta.annotation.Nullable OffsetDateTime scheduledAt) {
this.scheduledAt = JsonNullable.<OffsetDateTime>of(scheduledAt);
}


/**
* Return true if this RepublishRequest object is equal to o.
*/
Expand All @@ -218,7 +255,8 @@ public boolean equals(Object o) {
return equalsNullable(this.accountIds, republishRequest.accountIds) &&
equalsNullable(this.priceDrop, republishRequest.priceDrop) &&
equalsNullable(this.priceVariation, republishRequest.priceVariation) &&
equalsNullable(this.allowIfDeleted, republishRequest.allowIfDeleted);
equalsNullable(this.allowIfDeleted, republishRequest.allowIfDeleted) &&
equalsNullable(this.scheduledAt, republishRequest.scheduledAt);
}

private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
Expand All @@ -227,7 +265,7 @@ private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b)

@Override
public int hashCode() {
return Objects.hash(hashCodeNullable(accountIds), hashCodeNullable(priceDrop), hashCodeNullable(priceVariation), hashCodeNullable(allowIfDeleted));
return Objects.hash(hashCodeNullable(accountIds), hashCodeNullable(priceDrop), hashCodeNullable(priceVariation), hashCodeNullable(allowIfDeleted), hashCodeNullable(scheduledAt));
}

private static <T> int hashCodeNullable(JsonNullable<T> a) {
Expand All @@ -245,6 +283,7 @@ public String toString() {
sb.append(" priceDrop: ").append(toIndentedString(priceDrop)).append("\n");
sb.append(" priceVariation: ").append(toIndentedString(priceVariation)).append("\n");
sb.append(" allowIfDeleted: ").append(toIndentedString(allowIfDeleted)).append("\n");
sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -315,6 +354,11 @@ public String toUrlQueryString(String prefix) {
joiner.add(String.format(java.util.Locale.ROOT, "%sallowIfDeleted%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getAllowIfDeleted()))));
}

// add `scheduledAt` to the URL query string
if (getScheduledAt() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sscheduledAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getScheduledAt()))));
}

return joiner.toString();
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/controlresell/sdk/ControlResellTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,18 @@ void priceDropPostsToThePriceDropRoute() throws Exception {
assertTrue(bodies.get(0).contains("\"PERCENT\""), bodies.get(0));
}

@Test
void publishPriceDropAndRepublishSendScheduledAt() throws Exception {
ControlResell sdk = client(n -> new Reply(202, ACTION));
var at = java.time.OffsetDateTime.parse("2026-11-02T10:00:00Z");
sdk.items().publish(7, new com.controlresell.sdk.generated.model.PublishRequest().scheduledAt(at));
sdk.items().priceDrop(7, new com.controlresell.sdk.generated.model.PriceDropRequest().type("PERCENT").value("10").scheduledAt(at));
sdk.items().republish(7, new com.controlresell.sdk.generated.model.RepublishRequest().scheduledAt(at));
for (String body : bodies) {
assertTrue(body.contains("\"scheduledAt\":\"2026-11-02T10:00:00Z\""), body);
}
}

@Test
void deleteResolvesOn204AndThrowsATypedErrorOn409() throws Exception {
ControlResell sdk = client(n -> n == 1 ? new Reply(204, "") : new Reply(409, envelope("item_still_listed")));
Expand Down
Loading