From 9b49ee983bef6a5277ce1e384c187dd1096e66fc Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:17:24 +0000 Subject: [PATCH] Update generated code for v1318 --- init.php | 2 + lib/Service/V2/Core/CoreServiceFactory.php | 2 + .../V2/Core/EventDestinationService.php | 138 ++++++++++++++++++ lib/Util/ObjectTypes.php | 1 + lib/V2/EventDestination.php | 38 +++++ 5 files changed, 181 insertions(+) create mode 100644 lib/Service/V2/Core/EventDestinationService.php create mode 100644 lib/V2/EventDestination.php diff --git a/init.php b/init.php index 20e13b049..01238f6de 100644 --- a/init.php +++ b/init.php @@ -332,6 +332,7 @@ require __DIR__ . '/lib/Service/V2/Billing/MeterEventSessionService.php'; require __DIR__ . '/lib/Service/V2/Billing/MeterEventStreamService.php'; require __DIR__ . '/lib/Service/V2/Core/CoreServiceFactory.php'; +require __DIR__ . '/lib/Service/V2/Core/EventDestinationService.php'; require __DIR__ . '/lib/Service/V2/Core/EventService.php'; require __DIR__ . '/lib/Service/V2/V2ServiceFactory.php'; require __DIR__ . '/lib/Service/WebhookEndpointService.php'; @@ -380,6 +381,7 @@ require __DIR__ . '/lib/V2/Billing/MeterEvent.php'; require __DIR__ . '/lib/V2/Billing/MeterEventAdjustment.php'; require __DIR__ . '/lib/V2/Billing/MeterEventSession.php'; +require __DIR__ . '/lib/V2/EventDestination.php'; require __DIR__ . '/lib/WebhookEndpoint.php'; // The end of the section generated from our OpenAPI spec diff --git a/lib/Service/V2/Core/CoreServiceFactory.php b/lib/Service/V2/Core/CoreServiceFactory.php index 7387b1203..c26389711 100644 --- a/lib/Service/V2/Core/CoreServiceFactory.php +++ b/lib/Service/V2/Core/CoreServiceFactory.php @@ -6,6 +6,7 @@ * Service factory class for API resources in the root namespace. * // Doc: The beginning of the section generated from our OpenAPI spec. * + * @property EventDestinationService $eventDestinations * @property EventService $events * // Doc: The end of the section generated from our OpenAPI spec */ @@ -16,6 +17,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory */ private static $classMap = [ // Class Map: The beginning of the section generated from our OpenAPI spec + 'eventDestinations' => EventDestinationService::class, 'events' => EventService::class, // Class Map: The end of the section generated from our OpenAPI spec ]; diff --git a/lib/Service/V2/Core/EventDestinationService.php b/lib/Service/V2/Core/EventDestinationService.php new file mode 100644 index 000000000..b633967dc --- /dev/null +++ b/lib/Service/V2/Core/EventDestinationService.php @@ -0,0 +1,138 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v2/core/event_destinations', $params, $opts); + } + + /** + * Create a new event destination. + * + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v2/core/event_destinations', $params, $opts); + } + + /** + * Delete an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v2/core/event_destinations/%s', $id), $params, $opts); + } + + /** + * Disable an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function disable($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v2/core/event_destinations/%s/disable', $id), $params, $opts); + } + + /** + * Enable an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function enable($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v2/core/event_destinations/%s/enable', $id), $params, $opts); + } + + /** + * Send a `ping` event to an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\Event + */ + public function ping($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v2/core/event_destinations/%s/ping', $id), $params, $opts); + } + + /** + * Retrieves the details of an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v2/core/event_destinations/%s', $id), $params, $opts); + } + + /** + * Update the details of an event destination. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\V2\EventDestination + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v2/core/event_destinations/%s', $id), $params, $opts); + } +} diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 3bb337f6f..c9356c859 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -168,6 +168,7 @@ class ObjectTypes \Stripe\V2\Billing\MeterEventAdjustment::OBJECT_NAME => \Stripe\V2\Billing\MeterEventAdjustment::class, \Stripe\V2\Billing\MeterEventSession::OBJECT_NAME => \Stripe\V2\Billing\MeterEventSession::class, \Stripe\V2\Event::OBJECT_NAME => \Stripe\V2\Event::class, + \Stripe\V2\EventDestination::OBJECT_NAME => \Stripe\V2\EventDestination::class, // v2 object classes: The end of the section generated from our OpenAPI spec ]; } diff --git a/lib/V2/EventDestination.php b/lib/V2/EventDestination.php new file mode 100644 index 000000000..39da95ff9 --- /dev/null +++ b/lib/V2/EventDestination.php @@ -0,0 +1,38 @@ +true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Metadata. + * @property string $name Event destination name. + * @property null|string $snapshot_api_version If using the snapshot event payload, the API version events are rendered as. + * @property string $status Status. It can be set to either enabled or disabled. + * @property null|\Stripe\StripeObject $status_details Additional information about event destination status. + * @property string $type Event destination type. + * @property int $updated Time at which the object was last updated. + * @property null|\Stripe\StripeObject $webhook_endpoint Webhook endpoint configuration. + */ +class EventDestination extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'v2.core.event_destination'; + + const EVENT_PAYLOAD_SNAPSHOT = 'snapshot'; + const EVENT_PAYLOAD_THIN = 'thin'; + + const STATUS_DISABLED = 'disabled'; + const STATUS_ENABLED = 'enabled'; + + const TYPE_AMAZON_EVENTBRIDGE = 'amazon_eventbridge'; + const TYPE_WEBHOOK_ENDPOINT = 'webhook_endpoint'; +}