| 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._list_object import ListObject |
| 10 |
from stripe._request_options import RequestOptions |
| 11 |
from stripe.params.terminal._location_create_params import ( |
| 12 |
LocationCreateParams, |
| 13 |
) |
| 14 |
from stripe.params.terminal._location_delete_params import ( |
| 15 |
LocationDeleteParams, |
| 16 |
) |
| 17 |
from stripe.params.terminal._location_list_params import LocationListParams |
| 18 |
from stripe.params.terminal._location_retrieve_params import ( |
| 19 |
LocationRetrieveParams, |
| 20 |
) |
| 21 |
from stripe.params.terminal._location_update_params import ( |
| 22 |
LocationUpdateParams, |
| 23 |
) |
| 24 |
from stripe.terminal._location import Location |
| 25 |
|
| 26 |
|
| 27 |
class LocationService(StripeService): |
| 28 |
def delete( |
| 29 |
self, |
| 30 |
location: str, |
| 31 |
params: Optional["LocationDeleteParams"] = None, |
| 32 |
options: Optional["RequestOptions"] = None, |
| 33 |
) -> "Location": |
| 34 |
""" |
| 35 |
Deletes a Location object. |
| 36 |
""" |
| 37 |
return cast( |
| 38 |
"Location", |
| 39 |
self._request( |
| 40 |
"delete", |
| 41 |
"/v1/terminal/locations/{location}".format( |
| 42 |
location=sanitize_id(location), |
| 43 |
), |
| 44 |
base_address="api", |
| 45 |
params=params, |
| 46 |
options=options, |
| 47 |
), |
| 48 |
) |
| 49 |
|
| 50 |
async def delete_async( |
| 51 |
self, |
| 52 |
location: str, |
| 53 |
params: Optional["LocationDeleteParams"] = None, |
| 54 |
options: Optional["RequestOptions"] = None, |
| 55 |
) -> "Location": |
| 56 |
""" |
| 57 |
Deletes a Location object. |
| 58 |
""" |
| 59 |
return cast( |
| 60 |
"Location", |
| 61 |
await self._request_async( |
| 62 |
"delete", |
| 63 |
"/v1/terminal/locations/{location}".format( |
| 64 |
location=sanitize_id(location), |
| 65 |
), |
| 66 |
base_address="api", |
| 67 |
params=params, |
| 68 |
options=options, |
| 69 |
), |
| 70 |
) |
| 71 |
|
| 72 |
def retrieve( |
| 73 |
self, |
| 74 |
location: str, |
| 75 |
params: Optional["LocationRetrieveParams"] = None, |
| 76 |
options: Optional["RequestOptions"] = None, |
| 77 |
) -> "Location": |
| 78 |
""" |
| 79 |
Retrieves a Location object. |
| 80 |
""" |
| 81 |
return cast( |
| 82 |
"Location", |
| 83 |
self._request( |
| 84 |
"get", |
| 85 |
"/v1/terminal/locations/{location}".format( |
| 86 |
location=sanitize_id(location), |
| 87 |
), |
| 88 |
base_address="api", |
| 89 |
params=params, |
| 90 |
options=options, |
| 91 |
), |
| 92 |
) |
| 93 |
|
| 94 |
async def retrieve_async( |
| 95 |
self, |
| 96 |
location: str, |
| 97 |
params: Optional["LocationRetrieveParams"] = None, |
| 98 |
options: Optional["RequestOptions"] = None, |
| 99 |
) -> "Location": |
| 100 |
""" |
| 101 |
Retrieves a Location object. |
| 102 |
""" |
| 103 |
return cast( |
| 104 |
"Location", |
| 105 |
await self._request_async( |
| 106 |
"get", |
| 107 |
"/v1/terminal/locations/{location}".format( |
| 108 |
location=sanitize_id(location), |
| 109 |
), |
| 110 |
base_address="api", |
| 111 |
params=params, |
| 112 |
options=options, |
| 113 |
), |
| 114 |
) |
| 115 |
|
| 116 |
def update( |
| 117 |
self, |
| 118 |
location: str, |
| 119 |
params: Optional["LocationUpdateParams"] = None, |
| 120 |
options: Optional["RequestOptions"] = None, |
| 121 |
) -> "Location": |
| 122 |
""" |
| 123 |
Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. |
| 124 |
""" |
| 125 |
return cast( |
| 126 |
"Location", |
| 127 |
self._request( |
| 128 |
"post", |
| 129 |
"/v1/terminal/locations/{location}".format( |
| 130 |
location=sanitize_id(location), |
| 131 |
), |
| 132 |
base_address="api", |
| 133 |
params=params, |
| 134 |
options=options, |
| 135 |
), |
| 136 |
) |
| 137 |
|
| 138 |
async def update_async( |
| 139 |
self, |
| 140 |
location: str, |
| 141 |
params: Optional["LocationUpdateParams"] = None, |
| 142 |
options: Optional["RequestOptions"] = None, |
| 143 |
) -> "Location": |
| 144 |
""" |
| 145 |
Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. |
| 146 |
""" |
| 147 |
return cast( |
| 148 |
"Location", |
| 149 |
await self._request_async( |
| 150 |
"post", |
| 151 |
"/v1/terminal/locations/{location}".format( |
| 152 |
location=sanitize_id(location), |
| 153 |
), |
| 154 |
base_address="api", |
| 155 |
params=params, |
| 156 |
options=options, |
| 157 |
), |
| 158 |
) |
| 159 |
|
| 160 |
def list( |
| 161 |
self, |
| 162 |
params: Optional["LocationListParams"] = None, |
| 163 |
options: Optional["RequestOptions"] = None, |
| 164 |
) -> "ListObject[Location]": |
| 165 |
""" |
| 166 |
Returns a list of Location objects. |
| 167 |
""" |
| 168 |
return cast( |
| 169 |
"ListObject[Location]", |
| 170 |
self._request( |
| 171 |
"get", |
| 172 |
"/v1/terminal/locations", |
| 173 |
base_address="api", |
| 174 |
params=params, |
| 175 |
options=options, |
| 176 |
), |
| 177 |
) |
| 178 |
|
| 179 |
async def list_async( |
| 180 |
self, |
| 181 |
params: Optional["LocationListParams"] = None, |
| 182 |
options: Optional["RequestOptions"] = None, |
| 183 |
) -> "ListObject[Location]": |
| 184 |
""" |
| 185 |
Returns a list of Location objects. |
| 186 |
""" |
| 187 |
return cast( |
| 188 |
"ListObject[Location]", |
| 189 |
await self._request_async( |
| 190 |
"get", |
| 191 |
"/v1/terminal/locations", |
| 192 |
base_address="api", |
| 193 |
params=params, |
| 194 |
options=options, |
| 195 |
), |
| 196 |
) |
| 197 |
|
| 198 |
def create( |
| 199 |
self, |
| 200 |
params: Optional["LocationCreateParams"] = None, |
| 201 |
options: Optional["RequestOptions"] = None, |
| 202 |
) -> "Location": |
| 203 |
""" |
| 204 |
Creates a new Location object. |
| 205 |
For further details, including which address fields are required in each country, see the [Manage locations](https://docs.stripe.com/docs/terminal/fleet/locations) guide. |
| 206 |
""" |
| 207 |
return cast( |
| 208 |
"Location", |
| 209 |
self._request( |
| 210 |
"post", |
| 211 |
"/v1/terminal/locations", |
| 212 |
base_address="api", |
| 213 |
params=params, |
| 214 |
options=options, |
| 215 |
), |
| 216 |
) |
| 217 |
|
| 218 |
async def create_async( |
| 219 |
self, |
| 220 |
params: Optional["LocationCreateParams"] = None, |
| 221 |
options: Optional["RequestOptions"] = None, |
| 222 |
) -> "Location": |
| 223 |
""" |
| 224 |
Creates a new Location object. |
| 225 |
For further details, including which address fields are required in each country, see the [Manage locations](https://docs.stripe.com/docs/terminal/fleet/locations) guide. |
| 226 |
""" |
| 227 |
return cast( |
| 228 |
"Location", |
| 229 |
await self._request_async( |
| 230 |
"post", |
| 231 |
"/v1/terminal/locations", |
| 232 |
base_address="api", |
| 233 |
params=params, |
| 234 |
options=options, |
| 235 |
), |
| 236 |
) |