diff --git a/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java index 0d70dcb7f5a..bab476098a3 100644 --- a/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java +++ b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java @@ -35,7 +35,7 @@ public static final class EventData { public static final class Reason { /** The total error count within this window. */ @SerializedName("error_count") - Integer errorCount; + Long errorCount; /** The error details. */ @SerializedName("error_types") List errorTypes; @@ -53,7 +53,7 @@ public static final class ErrorType { String code; /** The number of errors of this type. */ @SerializedName("error_count") - Integer errorCount; + Long errorCount; /** A list of sample errors of this type. */ @SerializedName("sample_errors") List diff --git a/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEvent.java b/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEvent.java index e896ebe7687..97b26534230 100644 --- a/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEvent.java +++ b/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEvent.java @@ -33,7 +33,7 @@ public static final class EventData { public static final class Reason { /** The total error count within this window. */ @SerializedName("error_count") - Integer errorCount; + Long errorCount; /** The error details. */ @SerializedName("error_types") List errorTypes; @@ -51,7 +51,7 @@ public static final class ErrorType { String code; /** The number of errors of this type. */ @SerializedName("error_count") - Integer errorCount; + Long errorCount; /** A list of sample errors of this type. */ @SerializedName("sample_errors") List sampleErrors; diff --git a/src/main/java/com/stripe/exception/TemporarySessionExpiredException.java b/src/main/java/com/stripe/exception/TemporarySessionExpiredException.java index 376c73a885b..9a9977b273e 100644 --- a/src/main/java/com/stripe/exception/TemporarySessionExpiredException.java +++ b/src/main/java/com/stripe/exception/TemporarySessionExpiredException.java @@ -6,7 +6,7 @@ import com.stripe.model.StripeObject; import com.stripe.net.StripeResponseGetter; -/** The temporary session token has expired. */ +/** Information about the error that occurred. */ public final class TemporarySessionExpiredException extends ApiException { private static final long serialVersionUID = 2L; diff --git a/src/main/java/com/stripe/model/v2/DeletedObject.java b/src/main/java/com/stripe/model/v2/DeletedObject.java new file mode 100644 index 00000000000..11c7fb566f3 --- /dev/null +++ b/src/main/java/com/stripe/model/v2/DeletedObject.java @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec +package com.stripe.model.v2; + +import com.google.gson.annotations.SerializedName; +import com.stripe.model.HasId; +import com.stripe.model.StripeObject; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class DeletedObject extends StripeObject implements HasId { + /** The ID of the object that's being deleted. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * String representing the type of the object that has been deleted. Objects of the same type + * share the same value of the object field. + */ + @SerializedName("object") + String object; +} diff --git a/src/main/java/com/stripe/model/v2/Event.java b/src/main/java/com/stripe/model/v2/Event.java index 85586a20a09..140e8855029 100644 --- a/src/main/java/com/stripe/model/v2/Event.java +++ b/src/main/java/com/stripe/model/v2/Event.java @@ -17,6 +17,18 @@ import lombok.Getter; import lombok.Setter; +/** + * Events are generated to keep you informed of activity in your business account. APIs in the /v2 + * namespace generate thin events which + * have small, unversioned payloads that include a reference to the ID of the object that has + * changed. The Events v2 API returns these new thin events. Retrieve the event object for + * additional data about the event. Use the related object ID in the event payload to fetch + * the API resource of the object associated with the event. Comparatively, events generated by + * most API v1 include a versioned snapshot of an API object in their payload. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -121,10 +133,7 @@ public static class RelatedObject extends StripeObject implements HasId { String url; } - /** - * For more details about Reason, please refer to the API - * Reference. - */ + /** Reason for the event. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -141,10 +150,7 @@ public static class Reason extends StripeObject { @SerializedName("type") String type; - /** - * For more details about Request, please refer to the API - * Reference. - */ + /** Information on the API request that instigated the event. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/v2/EventDestination.java b/src/main/java/com/stripe/model/v2/EventDestination.java index 401cf4666c0..6da9435ba81 100644 --- a/src/main/java/com/stripe/model/v2/EventDestination.java +++ b/src/main/java/com/stripe/model/v2/EventDestination.java @@ -11,6 +11,13 @@ import lombok.Getter; import lombok.Setter; +/** + * Set up an event destination to receive events from Stripe across multiple destination types, + * including webhook endpoints and Amazon EventBridge. Event + * destinations support receiving thin events + * and snapshot events. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -104,10 +111,7 @@ public class EventDestination extends StripeObject implements HasId { @SerializedName("webhook_endpoint") WebhookEndpoint webhookEndpoint; - /** - * For more details about AmazonEventbridge, please refer to the API Reference. - */ + /** Amazon EventBridge configuration. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -129,10 +133,7 @@ public static class AmazonEventbridge extends StripeObject { String awsEventSourceStatus; } - /** - * For more details about StatusDetails, please refer to the API Reference. - */ + /** Additional information about event destination status. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -141,10 +142,7 @@ public static class StatusDetails extends StripeObject { @SerializedName("disabled") Disabled disabled; - /** - * For more details about Disabled, please refer to the API Reference. - */ + /** Details about why the event destination has been disabled. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -159,10 +157,7 @@ public static class Disabled extends StripeObject { } } - /** - * For more details about WebhookEndpoint, please refer to the API Reference. - */ + /** Webhook endpoint configuration. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/v2/billing/MeterEvent.java b/src/main/java/com/stripe/model/v2/billing/MeterEvent.java index 854478014d2..698c1693576 100644 --- a/src/main/java/com/stripe/model/v2/billing/MeterEvent.java +++ b/src/main/java/com/stripe/model/v2/billing/MeterEvent.java @@ -9,6 +9,7 @@ import lombok.Getter; import lombok.Setter; +/** Fix me empty_doc_string. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/v2/billing/MeterEventAdjustment.java b/src/main/java/com/stripe/model/v2/billing/MeterEventAdjustment.java index 6fbad825d02..a81435ddf07 100644 --- a/src/main/java/com/stripe/model/v2/billing/MeterEventAdjustment.java +++ b/src/main/java/com/stripe/model/v2/billing/MeterEventAdjustment.java @@ -63,10 +63,7 @@ public class MeterEventAdjustment extends StripeObject implements HasId { @SerializedName("type") String type; - /** - * For more details about Cancel, please refer to the API - * Reference. - */ + /** Specifies which event to cancel. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/param/v2/core/EventDestinationListParams.java b/src/main/java/com/stripe/param/v2/core/EventDestinationListParams.java index 1c36684abab..c13bf0cf2ff 100644 --- a/src/main/java/com/stripe/param/v2/core/EventDestinationListParams.java +++ b/src/main/java/com/stripe/param/v2/core/EventDestinationListParams.java @@ -30,12 +30,12 @@ public class EventDestinationListParams extends ApiRequestParams { /** The page size. */ @SerializedName("limit") - Integer limit; + Long limit; private EventDestinationListParams( Map extraParams, List include, - Integer limit) { + Long limit) { this.extraParams = extraParams; this.include = include; this.limit = limit; @@ -50,7 +50,7 @@ public static class Builder { private List include; - private Integer limit; + private Long limit; /** Finalize and obtain parameter instance from this builder. */ public EventDestinationListParams build() { @@ -110,7 +110,7 @@ public Builder addAllInclude(List elements) } /** The page size. */ - public Builder setLimit(Integer limit) { + public Builder setLimit(Long limit) { this.limit = limit; return this; } 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 735cb6c2b09..b80d95056b9 100644 --- a/src/main/java/com/stripe/param/v2/core/EventListParams.java +++ b/src/main/java/com/stripe/param/v2/core/EventListParams.java @@ -22,13 +22,13 @@ public class EventListParams extends ApiRequestParams { /** The page size. */ @SerializedName("limit") - Integer limit; + Long limit; /** Required. Primary object ID used to retrieve related events. */ @SerializedName("object_id") String objectId; - private EventListParams(Map extraParams, Integer limit, String objectId) { + private EventListParams(Map extraParams, Long limit, String objectId) { this.extraParams = extraParams; this.limit = limit; this.objectId = objectId; @@ -41,7 +41,7 @@ public static Builder builder() { public static class Builder { private Map extraParams; - private Integer limit; + private Long limit; private String objectId; @@ -77,7 +77,7 @@ public Builder putAllExtraParam(Map map) { } /** The page size. */ - public Builder setLimit(Integer limit) { + public Builder setLimit(Long limit) { this.limit = limit; return this; } diff --git a/src/main/java/com/stripe/service/v2/core/EventDestinationService.java b/src/main/java/com/stripe/service/v2/core/EventDestinationService.java index 8553d0ac58e..39593093d9b 100644 --- a/src/main/java/com/stripe/service/v2/core/EventDestinationService.java +++ b/src/main/java/com/stripe/service/v2/core/EventDestinationService.java @@ -3,6 +3,7 @@ import com.google.gson.reflect.TypeToken; import com.stripe.exception.StripeException; +import com.stripe.model.v2.DeletedObject; import com.stripe.model.v2.Event; import com.stripe.model.v2.EventDestination; import com.stripe.model.v2.StripeCollection; @@ -67,15 +68,15 @@ public EventDestination create(EventDestinationCreateParams params, RequestOptio return this.request(request, EventDestination.class); } /** Delete an event destination. */ - public EventDestination delete(String id) throws StripeException { + public DeletedObject delete(String id) throws StripeException { return delete(id, (RequestOptions) null); } /** Delete an event destination. */ - public EventDestination delete(String id, RequestOptions options) throws StripeException { + public DeletedObject delete(String id, RequestOptions options) throws StripeException { String path = String.format("/v2/core/event_destinations/%s", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.DELETE, path, null, options); - return this.request(request, EventDestination.class); + return this.request(request, DeletedObject.class); } /** Retrieves the details of an event destination. */ public EventDestination retrieve(String id, EventDestinationRetrieveParams params) diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index dd1bdc86832..128a573530c 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -24488,7 +24488,7 @@ public void testV2CoreEventGetServices() throws StripeException { null, new TypeToken< com.stripe.model.v2.StripeCollection>() {}.getType(), - "{\"data\":[{\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"reason\":null,\"type\":\"type\",\"livemode\":true}],\"next_page_url\":null,\"previous_page_url\":null}"); + "{\"data\":[{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}],\"next_page_url\":null,\"previous_page_url\":null}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventListParams params = @@ -24510,7 +24510,7 @@ public void testV2CoreEventGet2Services() throws StripeException { null, null, com.stripe.model.v2.Event.class, - "{\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"reason\":null,\"type\":\"type\",\"livemode\":true}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.Event event = client.v2().core().events().retrieve("id_123"); @@ -24530,7 +24530,7 @@ public void testV2CoreEventDestinationGetServices() throws StripeException { new TypeToken< com.stripe.model.v2.StripeCollection< com.stripe.model.v2.EventDestination>>() {}.getType(), - "{\"data\":[{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}],\"next_page_url\":null,\"previous_page_url\":null}"); + "{\"data\":[{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}],\"next_page_url\":null,\"previous_page_url\":null}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventDestinationListParams params = @@ -24556,7 +24556,7 @@ public void testV2CoreEventDestinationPostServices() throws StripeException { null, null, com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventDestinationCreateParams params = @@ -24587,13 +24587,13 @@ public void testV2CoreEventDestinationDeleteServices() throws StripeException { "/v2/core/event_destinations/id_123", null, null, - com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + com.stripe.model.v2.DeletedObject.class, + "{\"id\":\"abc_123\",\"object\":\"some.object.tag\",\"deleted\":true}"); StripeClient client = new StripeClient(networkSpy); - com.stripe.model.v2.EventDestination eventDestination = + com.stripe.model.v2.DeletedObject deletedObject = client.v2().core().eventDestinations().delete("id_123"); - assertNotNull(eventDestination); + assertNotNull(deletedObject); verifyRequest( BaseAddress.API, ApiResource.RequestMethod.DELETE, @@ -24611,7 +24611,7 @@ public void testV2CoreEventDestinationGet2Services() throws StripeException { null, null, com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventDestinationRetrieveParams params = @@ -24637,7 +24637,7 @@ public void testV2CoreEventDestinationPost2Services() throws StripeException { null, null, com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventDestinationUpdateParams params = @@ -24663,7 +24663,7 @@ public void testV2CoreEventDestinationPost3Services() throws StripeException { null, null, com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.EventDestination eventDestination = @@ -24686,7 +24686,7 @@ public void testV2CoreEventDestinationPost4Services() throws StripeException { null, null, com.stripe.model.v2.EventDestination.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"id\":\"obj_123\",\"metadata\":null,\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true,\"amazon_eventbridge\":null,\"webhook_endpoint\":null}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.core.event_destination\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.EventDestination eventDestination = @@ -24709,7 +24709,7 @@ public void testV2CoreEventDestinationPost5Services() throws StripeException { null, null, com.stripe.model.v2.Event.class, - "{\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"reason\":null,\"type\":\"type\",\"livemode\":true}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.Event event = client.v2().core().eventDestinations().ping("id_123");