Skip to content

Commit

Permalink
fix: modify methods
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Sep 8, 2023
1 parent ef87efd commit 09b4781
Show file tree
Hide file tree
Showing 42 changed files with 154 additions and 1,177 deletions.
34 changes: 4 additions & 30 deletions stripe/api_resources/billing_portal/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function

from stripe import util
from stripe.api_resources.abstract import (
CreateableAPIResource,
ListableAPIResource,
Expand All @@ -13,6 +12,7 @@
from stripe.stripe_object import StripeObject
from typing import Any, Dict, Optional, cast
from typing_extensions import Literal
from urllib.parse import quote_plus


class Configuration(
Expand Down Expand Up @@ -83,35 +83,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
configuration,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/billing_portal/configurations/{configuration}".format(
configuration=util.sanitize_id(configuration)
),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/billing_portal/configurations/{configuration}".format(
configuration=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "Configuration":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> "Configuration":
Expand Down
31 changes: 4 additions & 27 deletions stripe/api_resources/charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from stripe.stripe_object import StripeObject
from typing import Any, Dict, Optional, cast
from typing_extensions import Literal
from urllib.parse import quote_plus

from typing_extensions import TYPE_CHECKING

Expand Down Expand Up @@ -169,33 +170,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
charge,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/charges/{charge}".format(charge=util.sanitize_id(charge)),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/charges/{charge}".format(
charge=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "Charge":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> "Charge":
Expand Down
30 changes: 3 additions & 27 deletions stripe/api_resources/coupon.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
coupon,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/coupons/{coupon}".format(coupon=util.sanitize_id(coupon)),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/coupons/{coupon}".format(
coupon=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "Coupon":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> "Coupon":
Expand Down
31 changes: 4 additions & 27 deletions stripe/api_resources/credit_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from stripe.stripe_object import StripeObject
from typing import Any, Dict, List, Optional, cast
from typing_extensions import Literal
from urllib.parse import quote_plus

from typing_extensions import TYPE_CHECKING

Expand Down Expand Up @@ -119,33 +120,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
id,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/credit_notes/{id}".format(id=util.sanitize_id(id)),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/credit_notes/{id}".format(
id=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "CreditNote":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def preview(
Expand Down
32 changes: 3 additions & 29 deletions stripe/api_resources/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,35 +241,9 @@ def list_payment_methods(self, idempotency_key=None, **params):
)

@classmethod
def _cls_modify(
cls,
customer,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/customers/{customer}".format(
customer=util.sanitize_id(customer)
),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/customers/{customer}".format(
customer=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "Customer":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> Any:
Expand Down
31 changes: 4 additions & 27 deletions stripe/api_resources/dispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from stripe.stripe_object import StripeObject
from typing import Dict, List, Optional
from typing_extensions import Literal
from urllib.parse import quote_plus

from typing_extensions import TYPE_CHECKING

Expand Down Expand Up @@ -106,33 +107,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
dispute,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/disputes/{dispute}".format(dispute=util.sanitize_id(dispute)),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/disputes/{dispute}".format(
dispute=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "Dispute":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> "Dispute":
Expand Down
32 changes: 4 additions & 28 deletions stripe/api_resources/file_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function

from stripe import util
from stripe.api_resources.abstract import (
CreateableAPIResource,
ListableAPIResource,
Expand All @@ -12,6 +11,7 @@
from stripe.api_resources.list_object import ListObject
from typing import Dict, Optional, cast
from typing_extensions import Literal
from urllib.parse import quote_plus

from typing_extensions import TYPE_CHECKING

Expand Down Expand Up @@ -85,33 +85,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
link,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/file_links/{link}".format(link=util.sanitize_id(link)),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/file_links/{link}".format(
link=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "FileLink":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def retrieve(cls, id, api_key=None, **params) -> "FileLink":
Expand Down
33 changes: 4 additions & 29 deletions stripe/api_resources/identity/verification_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from stripe.stripe_object import StripeObject
from typing import Dict, Optional, cast
from typing_extensions import Literal
from urllib.parse import quote_plus

from typing_extensions import TYPE_CHECKING

Expand Down Expand Up @@ -132,35 +133,9 @@ def list(
return result

@classmethod
def _cls_modify(
cls,
session,
api_key=None,
stripe_version=None,
stripe_account=None,
**params
):
return cls._static_request(
"post",
"/v1/identity/verification_sessions/{session}".format(
session=util.sanitize_id(session)
),
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
params=params,
)

@util.class_method_variant("_cls_modify")
def modify(self, idempotency_key=None, **params):
return self._request(
"post",
"/v1/identity/verification_sessions/{session}".format(
session=util.sanitize_id(self.get("id"))
),
idempotency_key=idempotency_key,
params=params,
)
def modify(cls, id, **params) -> "VerificationSession":
url = "%s/%s" % (cls.class_url(), quote_plus(id))
return cls._static_request("post", url, params=params)

@classmethod
def _cls_redact(
Expand Down
Loading

0 comments on commit 09b4781

Please sign in to comment.