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
8 changes: 8 additions & 0 deletions .hark/changes/2026-09-30_stripe-openapi_ff2f82f3.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Update generated code
pr_url: https://github.com/stripe/stripe-python/pull/1932
semver_level: minor
is_stripe_api_change: true
---

* Release specs are identical.
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
adad04916772f880317eac10d8c026b401863f1d
588801ef34f7b5f7d6a784d3354f5f93d2a26ffb
90 changes: 3 additions & 87 deletions stripe/events/_v1_invoice_upcoming_event.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from stripe._util import get_api_mode
from stripe.v2.core._event import Event, EventNotification, RelatedObject
from typing import Any, Dict, cast
from typing_extensions import Literal, TYPE_CHECKING, override

if TYPE_CHECKING:
from stripe._invoice import Invoice
from stripe._stripe_client import StripeClient
from stripe.v2.core._event import Event, EventNotification
from typing import cast
from typing_extensions import Literal, override


class V1InvoiceUpcomingEventNotification(EventNotification):
LOOKUP_TYPE = "v1.invoice.upcoming"
type: Literal["v1.invoice.upcoming"]
related_object: RelatedObject

def __init__(
self, parsed_body: Dict[str, Any], client: "StripeClient"
) -> None:
super().__init__(
parsed_body,
client,
)
self.related_object = RelatedObject(parsed_body["related_object"])

@override
def fetch_event(self) -> "V1InvoiceUpcomingEvent":
Expand All @@ -32,82 +16,14 @@ def fetch_event(self) -> "V1InvoiceUpcomingEvent":
super().fetch_event(),
)

def fetch_related_object(self) -> "Invoice":
response = self._client.raw_request(
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
"Invoice",
self._client.deserialize(
response,
api_mode=get_api_mode(self.related_object.url),
),
)

@override
async def fetch_event_async(self) -> "V1InvoiceUpcomingEvent":
return cast(
"V1InvoiceUpcomingEvent",
await super().fetch_event_async(),
)

async def fetch_related_object_async(self) -> "Invoice":
response = await self._client.raw_request_async(
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
"Invoice",
self._client.deserialize(
response,
api_mode=get_api_mode(self.related_object.url),
),
)


class V1InvoiceUpcomingEvent(Event):
LOOKUP_TYPE = "v1.invoice.upcoming"
type: Literal["v1.invoice.upcoming"]

class RelatedObject(StripeObject):
id: str
"""
Unique identifier for the object relevant to the event.
"""
type: str
"""
Type of the object relevant to the event.
"""
url: str
"""
URL to retrieve the resource.
"""

related_object: RelatedObject
"""
Object containing the reference to API resource relevant to the event
"""

def fetch_related_object(self) -> "Invoice":
"""
Retrieves the related object from the API. Makes an API request on every call.
"""
return cast(
"Invoice",
self._requestor.request(
"get",
self.related_object.url,
base_address="api",
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Loading