diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ddf5ac54492..caaaa3cf0ca 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1505 \ No newline at end of file +v1520 \ No newline at end of file diff --git a/src/main/java/com/stripe/param/v2/core/EventListParams.java b/src/main/java/com/stripe/param/v2/core/EventListParams.java index a5c9f901bd4..55ae39caac5 100644 --- a/src/main/java/com/stripe/param/v2/core/EventListParams.java +++ b/src/main/java/com/stripe/param/v2/core/EventListParams.java @@ -3,12 +3,37 @@ import com.google.gson.annotations.SerializedName; import com.stripe.net.ApiRequestParams; +import java.time.Instant; import java.util.HashMap; import java.util.Map; import lombok.Getter; @Getter public class EventListParams extends ApiRequestParams { + /** Filter for events created after the specified timestamp. */ + @SerializedName("created_gt") + Instant createdGt; + + /** Filter for events created at or after the specified timestamp. */ + @SerializedName("created_gte") + Instant createdGte; + + /** Filter for events created before the specified timestamp. */ + @SerializedName("created_lt") + Instant createdLt; + + /** Filter for events created at or before the specified timestamp. */ + @SerializedName("created_lte") + Instant createdLte; + + /** + * Filter events based on whether they were successfully delivered to all subscribed event + * destinations. If false, events which are still pending or have failed all delivery attempts to + * a event destination will be returned. + */ + @SerializedName("delivery_success") + Boolean deliverySuccess; + /** * Map of extra parameters for custom features not available in this client library. The content * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each @@ -22,7 +47,7 @@ public class EventListParams extends ApiRequestParams { @SerializedName("limit") Integer limit; - /** Required. Primary object ID used to retrieve related events. */ + /** Primary object ID used to retrieve related events. */ @SerializedName("object_id") String objectId; @@ -31,7 +56,20 @@ public class EventListParams extends ApiRequestParams { String page; private EventListParams( - Map extraParams, Integer limit, String objectId, String page) { + Instant createdGt, + Instant createdGte, + Instant createdLt, + Instant createdLte, + Boolean deliverySuccess, + Map extraParams, + Integer limit, + String objectId, + String page) { + this.createdGt = createdGt; + this.createdGte = createdGte; + this.createdLt = createdLt; + this.createdLte = createdLte; + this.deliverySuccess = deliverySuccess; this.extraParams = extraParams; this.limit = limit; this.objectId = objectId; @@ -43,6 +81,16 @@ public static Builder builder() { } public static class Builder { + private Instant createdGt; + + private Instant createdGte; + + private Instant createdLt; + + private Instant createdLte; + + private Boolean deliverySuccess; + private Map extraParams; private Integer limit; @@ -53,7 +101,50 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public EventListParams build() { - return new EventListParams(this.extraParams, this.limit, this.objectId, this.page); + return new EventListParams( + this.createdGt, + this.createdGte, + this.createdLt, + this.createdLte, + this.deliverySuccess, + this.extraParams, + this.limit, + this.objectId, + this.page); + } + + /** Filter for events created after the specified timestamp. */ + public Builder setCreatedGt(Instant createdGt) { + this.createdGt = createdGt; + return this; + } + + /** Filter for events created at or after the specified timestamp. */ + public Builder setCreatedGte(Instant createdGte) { + this.createdGte = createdGte; + return this; + } + + /** Filter for events created before the specified timestamp. */ + public Builder setCreatedLt(Instant createdLt) { + this.createdLt = createdLt; + return this; + } + + /** Filter for events created at or before the specified timestamp. */ + public Builder setCreatedLte(Instant createdLte) { + this.createdLte = createdLte; + return this; + } + + /** + * Filter events based on whether they were successfully delivered to all subscribed event + * destinations. If false, events which are still pending or have failed all delivery attempts + * to a event destination will be returned. + */ + public Builder setDeliverySuccess(Boolean deliverySuccess) { + this.deliverySuccess = deliverySuccess; + return this; } /** @@ -88,7 +179,7 @@ public Builder setLimit(Integer limit) { return this; } - /** Required. Primary object ID used to retrieve related events. */ + /** Primary object ID used to retrieve related events. */ public Builder setObjectId(String objectId) { this.objectId = objectId; return this; diff --git a/src/main/java/com/stripe/service/v2/core/EventService.java b/src/main/java/com/stripe/service/v2/core/EventService.java index 5732a916f2f..639ff05be6c 100644 --- a/src/main/java/com/stripe/service/v2/core/EventService.java +++ b/src/main/java/com/stripe/service/v2/core/EventService.java @@ -24,6 +24,14 @@ public StripeCollection list(EventListParams params) throws StripeExcepti return list(params, (RequestOptions) null); } /** List events, going back up to 30 days. */ + public StripeCollection list(RequestOptions options) throws StripeException { + return list((EventListParams) null, options); + } + /** List events, going back up to 30 days. */ + public StripeCollection list() throws StripeException { + return list((EventListParams) null, (RequestOptions) null); + } + /** List events, going back up to 30 days. */ public StripeCollection list(EventListParams params, RequestOptions options) throws StripeException { String path = "/v2/core/events";