8000 build SDK w/ new spec by xavdid-stripe · Pull Request #1518 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

build SDK w/ new spec #1518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix semantics mismatches
  • Loading branch information
xavdid-stripe committed May 21, 2025
commit df8241cc00961f1dfb442435be148b8618d0018a
5 changes: 1 addition & 4 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,7 @@ def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data):
)
# switchCases: The beginning of the section generated from our OpenAPI spec
elif type == "temporary_session_expired":
return error.TemporarySessionExpiredError(
**error_args,
error=error_data.get("error"),
)
return error.TemporarySessionExpiredError(**error_args)
# switchCases: The end of the section generated from our OpenAPI spec

return self.specific_v1_api_error(
Expand Down
20 changes: 1 addition & 19 deletions stripe/_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,7 @@ def __init__(self, message, sig_header, http_body=None):

# classDefinitions: The beginning of the section generated from our OpenAPI spec
class TemporarySessionExpiredError(StripeError):
def __init__(
self,
message=None,
http_body=None,
http_status=None,
json_body=None,
headers=None,
code=None,
error=None,
):
super().__init__(
message,
http_body,
http_status,
json_body,
headers,
code,
)
self.error = error
pass


# classDefinitions: The end of the section generated from our OpenAPI spec
4 changes: 2 additions & 2 deletions stripe/_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class File(CreateableAPIResource["File"], ListableAPIResource["File"]):
This object represents files hosted on Stripe's servers. You can upload
files with the [create file](https://stripe.com/docs/api#create_file) request
(for example, when uploading dispute evidence). Stripe also
creates files independently (for example, the results of a [Sigma scheduled
query](https://stripe.com/docs/api#scheduled_queries)).
creates files independently (for example, the results of a [scheduled_queries)](https://stripe.com/docs/api#Sigma scheduled
query).

Related guide: [File upload guide](https://stripe.com/docs/file-upload)
"""
Expand Down
27 changes: 2 additions & 25 deletions stripe/v2/_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,11 @@ class Request(StripeObject):
"""
_inner_class_types = {"request": Request}

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

context: Optional[str]
"""
Authentication context needed to fetch the event or related object.
"""
created: int
created: str
"""
Time at which the object was created.
"""
Expand All @@ -74,10 +60,6 @@ class RelatedObject(StripeObject):
"""
Reason for the event.
"""
related_object: Optional[RelatedObject]
"""
Object containing the reference to API resource relevant to the event.
"""
type: str
"""
The type of the event.
Expand All @@ -86,12 +68,7 @@ class RelatedObject(StripeObject):
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""

@classmethod
def class_url(cls):
return "/v2/core/events"

_inner_class_types = {"reason": Reason, "related_object": RelatedObject}
_inner_class_types = {"reason": Reason}


# The end of the section generated from our OpenAPI spec
Expand Down
9 changes: 2 additions & 7 deletions stripe/v2/_event_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class WebhookEndpoint(StripeObject):
The URL of the webhook endpoint, includable.
"""

created: int
created: str
"""
Time at which the object was created.
"""
Expand Down Expand Up @@ -105,7 +105,7 @@ class WebhookEndpoint(StripeObject):
"""
Event destination type.
"""
updated: int
updated: str
"""
Time at which the object was last updated.
"""
Expand All @@ -121,11 +121,6 @@ class WebhookEndpoint(StripeObject):
"""
Webhook endpoint configuration.
"""

@classmethod
def class_url(cls):
return "/v2/core/event_destinations"

_inner_class_types = {
"status_details": StatusDetails,
"amazon_eventbridge": AmazonEventbridge,
Expand Down
8 changes: 2 additions & 6 deletions stripe/v2/billing/_meter_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MeterEvent(StripeObject):
OBJECT_NAME: ClassVar[Literal["v2.billing.meter_event"]] = (
"v2.billing.meter_event"
)
created: int
created: str
"""
The creation time of this meter event.
"""
Expand All @@ -35,7 +35,7 @@ class MeterEvent(StripeObject):
`customer_mapping.event_payload_key` (default is `stripe_customer_id`) and
`value_settings.event_payload_key` (default is `value`). Read more about the payload.
"""
timestamp: int
timestamp: str
"""
The time of the event. Must be within the past 35 calendar days or up to
5 minutes in the future. Defaults to current timestamp if not specified.
Expand All @@ -44,7 +44,3 @@ class MeterEvent(StripeObject):
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""

@classmethod
def class_url(cls):
return "/v2/billing/meter_events"
7 changes: 1 addition & 6 deletions stripe/v2/billing/_meter_event_adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Cancel(StripeObject):
"""
Specifies which event to cancel.
"""
created: int
created: str
"""
The time the adjustment was created.
"""
Expand Down Expand Up @@ -48,9 +48,4 @@ class Cancel(StripeObject):
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""

@classmethod
def class_url(cls):
return "/v2/billing/meter_event_adjustments"

_inner_class_types = {"cancel": Cancel}
4 changes: 2 additions & 2 deletions stripe/v2/billing/_meter_event_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class MeterEventSession(StripeObject):
The authentication token for this session. Use this token when calling the
high-throughput meter event API.
"""
created: int
created: str
"""
The creation time of this session.
"""
expires_at: int
expires_at: str
"""
The time at which this session will expire.
"""
Expand Down
4 changes: 2 additions & 2 deletions stripe/v2/billing/_meter_event_stream_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create(
self._request(
"post",
"/v2/billing/meter_event_stream",
base_address="api",
base_address="meter_events",
params=params,
options=options,
)
Expand All @@ -65,7 +65,7 @@ async def create_async(
await self._request_async(
"post",
"/v2/billing/meter_event_stream",
base_address="api",
base_address="meter_events",
params=params,
options=options,
)
4 changes: 2 additions & 2 deletions tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -33095,7 +33095,7 @@ def test_v2_billing_meter_event_stream_post_service(
"post",
path="/v2/billing/meter_event_stream",
query_string="",
api_base="https://api.stripe.com",
api_base="https://meter-events.stripe.com",
post_data='{"events":[{"event_name":"event_name","identifier":"identifier","payload":{"undefined":"payload"},"timestamp":"1970-01-01T15:18:46.294Z"}]}',
is_json=True,
)
Expand Down Expand Up @@ -33349,7 +33349,7 @@ def test_temporary_session_expired_error_service(
"post",
path="/v2/billing/meter_event_stream",
query_string="",
api_base="https://api.stripe.com",
api_base="https://meter-events.stripe.com",
post_data='{"events":[{"event_name":"event_name","payload":{"undefined":"payload"}}]}',
is_json=True,
)
Loading
0