Skip to content

Commit

Permalink
Remove broken child methods (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
anniel-stripe authored Feb 15, 2024
1 parent 6b0d81e commit 68a8d66
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 124 deletions.
47 changes: 2 additions & 45 deletions stripe/_credit_note_line_item.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional
from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING
from typing_extensions import Literal, TYPE_CHECKING

if TYPE_CHECKING:
from stripe._discount import Discount
from stripe._tax_rate import TaxRate


class CreditNoteLineItem(ListableAPIResource["CreditNoteLineItem"]):
class CreditNoteLineItem(StripeObject):
"""
The credit note line item object
"""
Expand Down Expand Up @@ -72,24 +69,6 @@ class TaxAmount(StripeObject):
The amount on which tax is calculated, in cents (or local equivalent).
"""

class ListParams(RequestOptions):
ending_before: NotRequired["str"]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired["int"]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired["str"]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""

amount: int
"""
The integer amount in cents (or local equivalent) representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
Expand Down Expand Up @@ -154,28 +133,6 @@ class ListParams(RequestOptions):
"""
The amount in cents (or local equivalent) representing the unit amount being credited for this line item, excluding all tax and discounts.
"""

@classmethod
def list(
cls, **params: Unpack["CreditNoteLineItem.ListParams"]
) -> ListObject["CreditNoteLineItem"]:
"""
When retrieving a credit note, you'll get a lines property containing the the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)

return result

_inner_class_types = {
"discount_amounts": DiscountAmount,
"tax_amounts": TaxAmount,
Expand Down
16 changes: 8 additions & 8 deletions stripe/_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,18 +2061,18 @@ def list_tax_ids(
)

@classmethod
def modify_cash_balance(
def retrieve_cash_balance(
cls,
customer: str,
**params: Unpack["Customer.ModifyCashBalanceParams"]
**params: Unpack["Customer.RetrieveCashBalanceParams"]
) -> "CashBalance":
"""
Changes the settings on a customer's cash balance.
Retrieves a customer's cash balance.
"""
return cast(
"CashBalance",
cls._static_request(
"post",
"get",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer)
),
Expand All @@ -2081,18 +2081,18 @@ def modify_cash_balance(
)

@classmethod
def retrieve_cash_balance(
def modify_cash_balance(
cls,
customer: str,
**params: Unpack["Customer.RetrieveCashBalanceParams"]
**params: Unpack["Customer.ModifyCashBalanceParams"]
) -> "CashBalance":
"""
Retrieves a customer's cash balance.
Changes the settings on a customer's cash balance.
"""
return cast(
"CashBalance",
cls._static_request(
"get",
"post",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer)
),
Expand Down
70 changes: 3 additions & 67 deletions stripe/_customer_cash_balance_transaction.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional
from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING
from typing import ClassVar, Optional
from typing_extensions import Literal, TYPE_CHECKING

if TYPE_CHECKING:
from stripe._balance_transaction import BalanceTransaction
Expand All @@ -15,9 +12,7 @@
from stripe._refund import Refund


class CustomerCashBalanceTransaction(
ListableAPIResource["CustomerCashBalanceTransaction"],
):
class CustomerCashBalanceTransaction(StripeObject):
"""
Customers with certain payments enabled have a cash balance, representing funds that were paid
by the customer to a merchant, but have not yet been allocated to a payment. Cash Balance Transactions
Expand Down Expand Up @@ -145,30 +140,6 @@ class UnappliedFromPayment(StripeObject):
The [Payment Intent](https://stripe.com/docs/api/payment_intents/object) that funds were unapplied from.
"""

class ListParams(RequestOptions):
ending_before: NotRequired["str"]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired["int"]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired["str"]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""

class RetrieveParams(RequestOptions):
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""

adjusted_for_overdraft: Optional[AdjustedForOverdraft]
applied_to_payment: Optional[AppliedToPayment]
created: int
Expand Down Expand Up @@ -221,41 +192,6 @@ class RetrieveParams(RequestOptions):
The type of the cash balance transaction. New types may be added in future. See [Customer Balance](https://stripe.com/docs/payments/customer-balance#types) to learn more about these types.
"""
unapplied_from_payment: Optional[UnappliedFromPayment]

@classmethod
def list(
cls, **params: Unpack["CustomerCashBalanceTransaction.ListParams"]
) -> ListObject["CustomerCashBalanceTransaction"]:
"""
Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance).
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)

return result

@classmethod
def retrieve(
cls,
id: str,
**params: Unpack["CustomerCashBalanceTransaction.RetrieveParams"]
) -> "CustomerCashBalanceTransaction":
"""
Retrieves a specific cash balance transaction, which updated the customer's [cash balance](https://stripe.com/docs/payments/customer-balance).
"""
instance = cls(id, **params)
instance.refresh()
return instance

_inner_class_types = {
"adjusted_for_overdraft": AdjustedForOverdraft,
"applied_to_payment": AppliedToPayment,
Expand Down
6 changes: 5 additions & 1 deletion stripe/_ephemeral_key.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._createable_api_resource import CreateableAPIResource
from stripe._deletable_api_resource import DeletableAPIResource
from stripe._request_options import RequestOptions
from stripe._util import class_method_variant, sanitize_id
from typing import ClassVar, List, Optional, cast, overload
from typing_extensions import Literal, NotRequired, Unpack


class EphemeralKey(DeletableAPIResource["EphemeralKey"]):
class EphemeralKey(
CreateableAPIResource["EphemeralKey"],
DeletableAPIResource["EphemeralKey"],
):
OBJECT_NAME: ClassVar[Literal["ephemeral_key"]] = "ephemeral_key"

class DeleteParams(RequestOptions):
Expand Down
4 changes: 2 additions & 2 deletions stripe/_usage_record.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._api_resource import APIResource
from stripe._createable_api_resource import CreateableAPIResource
from typing import ClassVar
from typing_extensions import Literal


class UsageRecord(APIResource["UsageRecord"]):
class UsageRecord(CreateableAPIResource["UsageRecord"]):
"""
Usage records allow you to report customer usage and metrics to Stripe for
metered billing of subscription prices.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def test_accounts_persons_delete_service(
def test_accounts_persons_get(
self, http_client_mock: HTTPClientMock
) -> None:
stripe.Account.list_persons(
stripe.Account.persons(
"acct_xxxxxxxxxxxxx",
limit=3,
)
Expand Down

0 comments on commit 68a8d66

Please sign in to comment.