| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._stripe_service import StripeService |
| 4 |
from stripe._util import sanitize_id |
| 5 |
from typing import Optional, cast |
| 6 |
from typing_extensions import TYPE_CHECKING |
| 7 |
|
| 8 |
if TYPE_CHECKING: |
| 9 |
from stripe._request_options import RequestOptions |
| 10 |
from stripe.params.v2.core.accounts._person_create_params import ( |
| 11 |
PersonCreateParams, |
| 12 |
) |
| 13 |
from stripe.params.v2.core.accounts._person_delete_params import ( |
| 14 |
PersonDeleteParams, |
| 15 |
) |
| 16 |
from stripe.params.v2.core.accounts._person_list_params import ( |
| 17 |
PersonListParams, |
| 18 |
) |
| 19 |
from stripe.params.v2.core.accounts._person_retrieve_params import ( |
| 20 |
PersonRetrieveParams, |
| 21 |
) |
| 22 |
from stripe.params.v2.core.accounts._person_update_params import ( |
| 23 |
PersonUpdateParams, |
| 24 |
) |
| 25 |
from stripe.v2._deleted_object import DeletedObject |
| 26 |
from stripe.v2._list_object import ListObject |
| 27 |
from stripe.v2.core._account_person import AccountPerson |
| 28 |
|
| 29 |
|
| 30 |
class PersonService(StripeService): |
| 31 |
def list( |
| 32 |
self, |
| 33 |
account_id: str, |
| 34 |
params: Optional["PersonListParams"] = None, |
| 35 |
options: Optional["RequestOptions"] = None, |
| 36 |
) -> "ListObject[AccountPerson]": |
| 37 |
""" |
| 38 |
Returns a paginated list of Persons associated with an Account. |
| 39 |
""" |
| 40 |
return cast( |
| 41 |
"ListObject[AccountPerson]", |
| 42 |
self._request( |
| 43 |
"get", |
| 44 |
"/v2/core/accounts/{account_id}/persons".format( |
| 45 |
account_id=sanitize_id(account_id), |
| 46 |
), |
| 47 |
base_address="api", |
| 48 |
params=params, |
| 49 |
options=options, |
| 50 |
), |
| 51 |
) |
| 52 |
|
| 53 |
async def list_async( |
| 54 |
self, |
| 55 |
account_id: str, |
| 56 |
params: Optional["PersonListParams"] = None, |
| 57 |
options: Optional["RequestOptions"] = None, |
| 58 |
) -> "ListObject[AccountPerson]": |
| 59 |
""" |
| 60 |
Returns a paginated list of Persons associated with an Account. |
| 61 |
""" |
| 62 |
return cast( |
| 63 |
"ListObject[AccountPerson]", |
| 64 |
await self._request_async( |
| 65 |
"get", |
| 66 |
"/v2/core/accounts/{account_id}/persons".format( |
| 67 |
account_id=sanitize_id(account_id), |
| 68 |
), |
| 69 |
base_address="api", |
| 70 |
params=params, |
| 71 |
options=options, |
| 72 |
), |
| 73 |
) |
| 74 |
|
| 75 |
def create( |
| 76 |
self, |
| 77 |
account_id: str, |
| 78 |
params: Optional["PersonCreateParams"] = None, |
| 79 |
options: Optional["RequestOptions"] = None, |
| 80 |
) -> "AccountPerson": |
| 81 |
""" |
| 82 |
Create a Person. Adds an individual to an Account's identity. You can set relationship attributes and identity information at creation. |
| 83 |
""" |
| 84 |
return cast( |
| 85 |
"AccountPerson", |
| 86 |
self._request( |
| 87 |
"post", |
| 88 |
"/v2/core/accounts/{account_id}/persons".format( |
| 89 |
account_id=sanitize_id(account_id), |
| 90 |
), |
| 91 |
base_address="api", |
| 92 |
params=params, |
| 93 |
options=options, |
| 94 |
), |
| 95 |
) |
| 96 |
|
| 97 |
async def create_async( |
| 98 |
self, |
| 99 |
account_id: str, |
| 100 |
params: Optional["PersonCreateParams"] = None, |
| 101 |
options: Optional["RequestOptions"] = None, |
| 102 |
) -> "AccountPerson": |
| 103 |
""" |
| 104 |
Create a Person. Adds an individual to an Account's identity. You can set relationship attributes and identity information at creation. |
| 105 |
""" |
| 106 |
return cast( |
| 107 |
"AccountPerson", |
| 108 |
await self._request_async( |
| 109 |
"post", |
| 110 |
"/v2/core/accounts/{account_id}/persons".format( |
| 111 |
account_id=sanitize_id(account_id), |
| 112 |
), |
| 113 |
base_address="api", |
| 114 |
params=params, |
| 115 |
options=options, |
| 116 |
), |
| 117 |
) |
| 118 |
|
| 119 |
def delete( |
| 120 |
self, |
| 121 |
account_id: str, |
| 122 |
id: str, |
| 123 |
params: Optional["PersonDeleteParams"] = None, |
| 124 |
options: Optional["RequestOptions"] = None, |
| 125 |
) -> "DeletedObject": |
| 126 |
""" |
| 127 |
Delete a Person associated with an Account. |
| 128 |
""" |
| 129 |
return cast( |
| 130 |
"DeletedObject", |
| 131 |
self._request( |
| 132 |
"delete", |
| 133 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 134 |
account_id=sanitize_id(account_id), |
| 135 |
id=sanitize_id(id), |
| 136 |
), |
| 137 |
base_address="api", |
| 138 |
params=params, |
| 139 |
options=options, |
| 140 |
), |
| 141 |
) |
| 142 |
|
| 143 |
async def delete_async( |
| 144 |
self, |
| 145 |
account_id: str, |
| 146 |
id: str, |
| 147 |
params: Optional["PersonDeleteParams"] = None, |
| 148 |
options: Optional["RequestOptions"] = None, |
| 149 |
) -> "DeletedObject": |
| 150 |
""" |
| 151 |
Delete a Person associated with an Account. |
| 152 |
""" |
| 153 |
return cast( |
| 154 |
"DeletedObject", |
| 155 |
await self._request_async( |
| 156 |
"delete", |
| 157 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 158 |
account_id=sanitize_id(account_id), |
| 159 |
id=sanitize_id(id), |
| 160 |
), |
| 161 |
base_address="api", |
| 162 |
params=params, |
| 163 |
options=options, |
| 164 |
), |
| 165 |
) |
| 166 |
|
| 167 |
def retrieve( |
| 168 |
self, |
| 169 |
account_id: str, |
| 170 |
id: str, |
| 171 |
params: Optional["PersonRetrieveParams"] = None, |
| 172 |
options: Optional["RequestOptions"] = None, |
| 173 |
) -> "AccountPerson": |
| 174 |
""" |
| 175 |
Retrieves a Person associated with an Account. |
| 176 |
""" |
| 177 |
return cast( |
| 178 |
"AccountPerson", |
| 179 |
self._request( |
| 180 |
"get", |
| 181 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 182 |
account_id=sanitize_id(account_id), |
| 183 |
id=sanitize_id(id), |
| 184 |
), |
| 185 |
base_address="api", |
| 186 |
params=params, |
| 187 |
options=options, |
| 188 |
), |
| 189 |
) |
| 190 |
|
| 191 |
async def retrieve_async( |
| 192 |
self, |
| 193 |
account_id: str, |
| 194 |
id: str, |
| 195 |
params: Optional["PersonRetrieveParams"] = None, |
| 196 |
options: Optional["RequestOptions"] = None, |
| 197 |
) -> "AccountPerson": |
| 198 |
""" |
| 199 |
Retrieves a Person associated with an Account. |
| 200 |
""" |
| 201 |
return cast( |
| 202 |
"AccountPerson", |
| 203 |
await self._request_async( |
| 204 |
"get", |
| 205 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 206 |
account_id=sanitize_id(account_id), |
| 207 |
id=sanitize_id(id), |
| 208 |
), |
| 209 |
base_address="api", |
| 210 |
params=params, |
| 211 |
options=options, |
| 212 |
), |
| 213 |
) |
| 214 |
|
| 215 |
def update( |
| 216 |
self, |
| 217 |
account_id: str, |
| 218 |
id: str, |
| 219 |
params: Optional["PersonUpdateParams"] = None, |
| 220 |
options: Optional["RequestOptions"] = None, |
| 221 |
) -> "AccountPerson": |
| 222 |
""" |
| 223 |
Updates a Person associated with an Account. |
| 224 |
""" |
| 225 |
return cast( |
| 226 |
"AccountPerson", |
| 227 |
self._request( |
| 228 |
"post", |
| 229 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 230 |
account_id=sanitize_id(account_id), |
| 231 |
id=sanitize_id(id), |
| 232 |
), |
| 233 |
base_address="api", |
| 234 |
params=params, |
| 235 |
options=options, |
| 236 |
), |
| 237 |
) |
| 238 |
|
| 239 |
async def update_async( |
| 240 |
self, |
| 241 |
account_id: str, |
| 242 |
id: str, |
| 243 |
params: Optional["PersonUpdateParams"] = None, |
| 244 |
options: Optional["RequestOptions"] = None, |
| 245 |
) -> "AccountPerson": |
| 246 |
""" |
| 247 |
Updates a Person associated with an Account. |
| 248 |
""" |
| 249 |
return cast( |
| 250 |
"AccountPerson", |
| 251 |
await self._request_async( |
| 252 |
"post", |
| 253 |
"/v2/core/accounts/{account_id}/persons/{id}".format( |
| 254 |
account_id=sanitize_id(account_id), |
| 255 |
id=sanitize_id(id), |
| 256 |
), |
| 257 |
base_address="api", |
| 258 |
params=params, |
| 259 |
options=options, |
| 260 |
), |
| 261 |
) |