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 API_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a4d4c803dcbf205368dc65179c7eca4748aadaf7
e62524b587909bee231a15ce0dc618f1d04f69a4
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2123
v2124
5 changes: 0 additions & 5 deletions src/main/java/com/stripe/model/v2/core/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import java.time.Instant;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -35,10 +34,6 @@
@Setter
@EqualsAndHashCode(callSuper = false)
public class Event extends StripeObject implements HasId, StripeActiveObject {
/** Before and after changes for the primary related object. */
@SerializedName("changes")
Map<String, Object> changes;

/** Authentication context needed to fetch the event or related object. */
@SerializedName("context")
String context;
Expand Down
188 changes: 124 additions & 64 deletions src/main/java/com/stripe/param/v2/core/EventListParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
@Getter
@EqualsAndHashCode(callSuper = false)
public class EventListParams extends ApiRequestParams {
/** Set of filters to query events within a range of {@code created} timestamps. */
@SerializedName("created")
Created created;

/**
* 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
Expand All @@ -23,26 +27,10 @@ public class EventListParams extends ApiRequestParams {
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

/** Filter for events created after the specified timestamp. */
@SerializedName("gt")
Instant gt;

/** Filter for events created at or after the specified timestamp. */
@SerializedName("gte")
Instant gte;

/** The page size. */
@SerializedName("limit")
Long limit;

/** Filter for events created before the specified timestamp. */
@SerializedName("lt")
Instant lt;

/** Filter for events created at or before the specified timestamp. */
@SerializedName("lte")
Instant lte;

/** Primary object ID used to retrieve related events. */
@SerializedName("object_id")
String objectId;
Expand All @@ -52,20 +40,14 @@ public class EventListParams extends ApiRequestParams {
List<String> types;

private EventListParams(
Created created,
Map<String, Object> extraParams,
Instant gt,
Instant gte,
Long limit,
Instant lt,
Instant lte,
String objectId,
List<String> types) {
this.created = created;
this.extraParams = extraParams;
this.gt = gt;
this.gte = gte;
this.limit = limit;
this.lt = lt;
this.lte = lte;
this.objectId = objectId;
this.types = types;
}
Expand All @@ -75,33 +57,26 @@ public static Builder builder() {
}

public static class Builder {
private Map<String, Object> extraParams;

private Instant gt;
private Created created;

private Instant gte;
private Map<String, Object> extraParams;

private Long limit;

private Instant lt;

private Instant lte;

private String objectId;

private List<String> types;

/** Finalize and obtain parameter instance from this builder. */
public EventListParams build() {
return new EventListParams(
this.extraParams,
this.gt,
this.gte,
this.limit,
this.lt,
this.lte,
this.objectId,
this.types);
this.created, this.extraParams, this.limit, this.objectId, this.types);
}

/** Set of filters to query events within a range of {@code created} timestamps. */
public Builder setCreated(EventListParams.Created created) {
this.created = created;
return this;
}

/**
Expand Down Expand Up @@ -130,36 +105,12 @@ public Builder putAllExtraParam(Map<String, Object> map) {
return this;
}

/** Filter for events created after the specified timestamp. */
public Builder setGt(Instant gt) {
this.gt = gt;
return this;
}

/** Filter for events created at or after the specified timestamp. */
public Builder setGte(Instant gte) {
this.gte = gte;
return this;
}

/** The page size. */
public Builder setLimit(Long limit) {
this.limit = limit;
return this;
}

/** Filter for events created before the specified timestamp. */
public Builder setLt(Instant lt) {
this.lt = lt;
return this;
}

/** Filter for events created at or before the specified timestamp. */
public Builder setLte(Instant lte) {
this.lte = lte;
return this;
}

/** Primary object ID used to retrieve related events. */
public Builder setObjectId(String objectId) {
this.objectId = objectId;
Expand Down Expand Up @@ -192,4 +143,113 @@ public Builder addAllType(List<String> elements) {
return this;
}
}

@Getter
@EqualsAndHashCode(callSuper = false)
public static class Created {
/**
* 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
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

/** Filter for events created after the specified timestamp. */
@SerializedName("gt")
Instant gt;

/** Filter for events created at or after the specified timestamp. */
@SerializedName("gte")
Instant gte;

/** Filter for events created before the specified timestamp. */
@SerializedName("lt")
Instant lt;

/** Filter for events created at or before the specified timestamp. */
@SerializedName("lte")
Instant lte;

private Created(
Map<String, Object> extraParams, Instant gt, Instant gte, Instant lt, Instant lte) {
this.extraParams = extraParams;
this.gt = gt;
this.gte = gte;
this.lt = lt;
this.lte = lte;
}

public static Builder builder() {
return new Builder();
}

public static class Builder {
private Map<String, Object> extraParams;

private Instant gt;

private Instant gte;

private Instant lt;

private Instant lte;

/** Finalize and obtain parameter instance from this builder. */
public EventListParams.Created build() {
return new EventListParams.Created(this.extraParams, this.gt, this.gte, this.lt, this.lte);
}

/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
* EventListParams.Created#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}

/**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
* See {@link EventListParams.Created#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}

/** Filter for events created after the specified timestamp. */
public Builder setGt(Instant gt) {
this.gt = gt;
return this;
}

/** Filter for events created at or after the specified timestamp. */
public Builder setGte(Instant gte) {
this.gte = gte;
return this;
}

/** Filter for events created before the specified timestamp. */
public Builder setLt(Instant lt) {
this.lt = lt;
return this;
}

/** Filter for events created at or before the specified timestamp. */
public Builder setLte(Instant lte) {
this.lte = lte;
return this;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@ public void testCoreEventsGetServices() throws StripeException {
null,
null,
com.stripe.model.v2.core.Event.class,
"{\"changes\":{\"int_key\":123,\"string_key\":\"value\",\"boolean_key\":true,\"object_key\":{\"object_int_key\":123,\"object_string_key\":\"value\",\"object_boolean_key\":true},\"array_key\":[1,2,3]},\"context\":\"context\",\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"reason\":{\"type\":\"request\",\"request\":{\"id\":\"obj_123\",\"idempotency_key\":\"idempotency_key\"}},\"type\":\"type\"}");
"{\"context\":\"context\",\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"reason\":{\"type\":\"request\",\"request\":{\"id\":\"obj_123\",\"idempotency_key\":\"idempotency_key\"}},\"type\":\"type\"}");
StripeClient client = new StripeClient(networkSpy);

com.stripe.model.v2.core.Event event = client.v2().core().events().retrieve("ll_123");
Expand Down
Loading