Skip to content

Commit

Permalink
Method docstrings (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe authored Oct 26, 2023
1 parent dc2f2c5 commit 9198671
Show file tree
Hide file tree
Showing 89 changed files with 2,988 additions and 0 deletions.
117 changes: 117 additions & 0 deletions stripe/api_resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3506,6 +3506,14 @@ def create(
stripe_account: Optional[str] = None,
**params: Unpack["Account.CreateParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
You can prefill any information on the account.
"""
return cast(
"Account",
cls._static_request(
Expand All @@ -3523,6 +3531,13 @@ def create(
def _cls_delete(
cls, sid: str, **params: Unpack["Account.DeleteParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
"""
url = "%s/%s" % (cls.class_url(), quote_plus(sid))
return cast(
"Account",
Expand All @@ -3534,16 +3549,37 @@ def _cls_delete(
def delete(
cls, sid: str, **params: Unpack["Account.DeleteParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
"""
...

@overload
def delete(self, **params: Unpack["Account.DeleteParams"]) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
"""
...

@class_method_variant("_cls_delete")
def delete( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.DeleteParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
"""
return self._request_and_refresh(
"delete",
self.instance_url(),
Expand All @@ -3558,6 +3594,9 @@ def list(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ListParams"]
) -> ListObject["Account"]:
"""
Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
"""
result = cls._static_request(
"get",
cls.class_url(),
Expand All @@ -3584,6 +3623,9 @@ def _cls_persons(
stripe_account: Optional[str] = None,
**params: Unpack["Account.PersonsParams"]
) -> ListObject["Person"]:
"""
Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
"""
return cast(
ListObject["Person"],
cls._static_request(
Expand All @@ -3608,6 +3650,9 @@ def persons(
stripe_account: Optional[str] = None,
**params: Unpack["Account.PersonsParams"]
) -> ListObject["Person"]:
"""
Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
"""
...

@overload
Expand All @@ -3616,6 +3661,9 @@ def persons(
idempotency_key: Optional[str] = None,
**params: Unpack["Account.PersonsParams"]
) -> ListObject["Person"]:
"""
Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
"""
...

@class_method_variant("_cls_persons")
Expand All @@ -3624,6 +3672,9 @@ def persons( # pyright: ignore[reportGeneralTypeIssues]
idempotency_key: Optional[str] = None,
**params: Unpack["Account.PersonsParams"]
) -> ListObject["Person"]:
"""
Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
"""
return cast(
ListObject["Person"],
self._request(
Expand All @@ -3645,6 +3696,11 @@ def _cls_reject(
stripe_account: Optional[str] = None,
**params: Unpack["Account.RejectParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
"""
return cast(
"Account",
cls._static_request(
Expand All @@ -3669,6 +3725,11 @@ def reject(
stripe_account: Optional[str] = None,
**params: Unpack["Account.RejectParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
"""
...

@overload
Expand All @@ -3677,6 +3738,11 @@ def reject(
idempotency_key: Optional[str] = None,
**params: Unpack["Account.RejectParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
"""
...

@class_method_variant("_cls_reject")
Expand All @@ -3685,6 +3751,11 @@ def reject( # pyright: ignore[reportGeneralTypeIssues]
idempotency_key: Optional[str] = None,
**params: Unpack["Account.RejectParams"]
) -> "Account":
"""
With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
"""
return cast(
"Account",
self._request(
Expand Down Expand Up @@ -3750,6 +3821,9 @@ def retrieve_capability(
stripe_account: Optional[str] = None,
**params: Unpack["Account.RetrieveCapabilityParams"]
) -> "Capability":
"""
Retrieves information about the specified Account Capability.
"""
return cast(
"Capability",
cls._static_request(
Expand All @@ -3775,6 +3849,9 @@ def modify_capability(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ModifyCapabilityParams"]
) -> "Capability":
"""
Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
"""
return cast(
"Capability",
cls._static_request(
Expand All @@ -3799,6 +3876,9 @@ def list_capabilities(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ListCapabilitiesParams"]
) -> ListObject["Capability"]:
"""
Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first.
"""
return cast(
ListObject["Capability"],
cls._static_request(
Expand All @@ -3822,6 +3902,9 @@ def create_external_account(
stripe_account: Optional[str] = None,
**params: Unpack["Account.CreateExternalAccountParams"]
) -> Union["BankAccount", "Card"]:
"""
Create an external account for a given account.
"""
return cast(
Union["BankAccount", "Card"],
cls._static_request(
Expand All @@ -3846,6 +3929,9 @@ def retrieve_external_account(
stripe_account: Optional[str] = None,
**params: Unpack["Account.RetrieveExternalAccountParams"]
) -> Union["BankAccount", "Card"]:
"""
Retrieve a specified external account for a given account.
"""
return cast(
Union["BankAccount", "Card"],
cls._static_request(
Expand All @@ -3870,6 +3956,11 @@ def modify_external_account(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ModifyExternalAccountParams"]
) -> Union["BankAccount", "Card"]:
"""
Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. Other bank account details are not editable by design.
You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.
"""
return cast(
Union["BankAccount", "Card"],
cls._static_request(
Expand All @@ -3894,6 +3985,9 @@ def delete_external_account(
stripe_account: Optional[str] = None,
**params: Unpack["Account.DeleteExternalAccountParams"]
) -> Union["BankAccount", "Card"]:
"""
Delete a specified external account for a given account.
"""
return cast(
Union["BankAccount", "Card"],
cls._static_request(
Expand All @@ -3917,6 +4011,9 @@ def list_external_accounts(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ListExternalAccountsParams"]
) -> ListObject[Union["BankAccount", "Card"]]:
"""
List external accounts for an account.
"""
return cast(
ListObject[Union["BankAccount", "Card"]],
cls._static_request(
Expand All @@ -3940,6 +4037,11 @@ def create_login_link(
stripe_account: Optional[str] = None,
**params: Unpack["Account.CreateLoginLinkParams"]
) -> "LoginLink":
"""
Creates a single-use login link for an Express account to access their Stripe dashboard.
You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform.
"""
return cast(
"LoginLink",
cls._static_request(
Expand All @@ -3963,6 +4065,9 @@ def create_person(
stripe_account: Optional[str] = None,
**params: Unpack["Account.CreatePersonParams"]
) -> "Person":
"""
Creates a new person.
"""
return cast(
"Person",
cls._static_request(
Expand All @@ -3987,6 +4092,9 @@ def retrieve_person(
stripe_account: Optional[str] = None,
**params: Unpack["Account.RetrievePersonParams"]
) -> "Person":
"""
Retrieves an existing person.
"""
return cast(
"Person",
cls._static_request(
Expand All @@ -4012,6 +4120,9 @@ def modify_person(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ModifyPersonParams"]
) -> "Person":
"""
Updates an existing person.
"""
return cast(
"Person",
cls._static_request(
Expand All @@ -4037,6 +4148,9 @@ def delete_person(
stripe_account: Optional[str] = None,
**params: Unpack["Account.DeletePersonParams"]
) -> "Person":
"""
Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
"""
return cast(
"Person",
cls._static_request(
Expand All @@ -4061,6 +4175,9 @@ def list_persons(
stripe_account: Optional[str] = None,
**params: Unpack["Account.ListPersonsParams"]
) -> ListObject["Person"]:
"""
Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
"""
return cast(
ListObject["Person"],
cls._static_request(
Expand Down
3 changes: 3 additions & 0 deletions stripe/api_resources/account_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def create(
stripe_account: Optional[str] = None,
**params: Unpack["AccountLink.CreateParams"]
) -> "AccountLink":
"""
Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
"""
return cast(
"AccountLink",
cls._static_request(
Expand Down
3 changes: 3 additions & 0 deletions stripe/api_resources/account_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def create(
stripe_account: Optional[str] = None,
**params: Unpack["AccountSession.CreateParams"]
) -> "AccountSession":
"""
Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
"""
return cast(
"AccountSession",
cls._static_request(
Expand Down
21 changes: 21 additions & 0 deletions stripe/api_resources/apple_pay_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def create(
stripe_account: Optional[str] = None,
**params: Unpack["ApplePayDomain.CreateParams"]
) -> "ApplePayDomain":
"""
Create an apple pay domain.
"""
return cast(
"ApplePayDomain",
cls._static_request(
Expand All @@ -104,6 +107,9 @@ def create(
def _cls_delete(
cls, sid: str, **params: Unpack["ApplePayDomain.DeleteParams"]
) -> "ApplePayDomain":
"""
Delete an apple pay domain.
"""
url = "%s/%s" % (cls.class_url(), quote_plus(sid))
return cast(
"ApplePayDomain",
Expand All @@ -115,18 +121,27 @@ def _cls_delete(
def delete(
cls, sid: str, **params: Unpack["ApplePayDomain.DeleteParams"]
) -> "ApplePayDomain":
"""
Delete an apple pay domain.
"""
...

@overload
def delete(
self, **params: Unpack["ApplePayDomain.DeleteParams"]
) -> "ApplePayDomain":
"""
Delete an apple pay domain.
"""
...

@class_method_variant("_cls_delete")
def delete( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["ApplePayDomain.DeleteParams"]
) -> "ApplePayDomain":
"""
Delete an apple pay domain.
"""
return self._request_and_refresh(
"delete",
self.instance_url(),
Expand All @@ -141,6 +156,9 @@ def list(
stripe_account: Optional[str] = None,
**params: Unpack["ApplePayDomain.ListParams"]
) -> ListObject["ApplePayDomain"]:
"""
List apple pay domains.
"""
result = cls._static_request(
"get",
cls.class_url(),
Expand All @@ -162,6 +180,9 @@ def list(
def retrieve(
cls, id: str, **params: Unpack["ApplePayDomain.RetrieveParams"]
) -> "ApplePayDomain":
"""
Retrieve an apple pay domain.
"""
instance = cls(id, **params)
instance.refresh()
return instance
Expand Down
Loading

0 comments on commit 9198671

Please # to comment.