| 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.test_helpers._test_clock_advance_params import ( |
| 12 |
TestClockAdvanceParams, |
| 13 |
) |
| 14 |
from stripe.params.test_helpers._test_clock_create_params import ( |
| 15 |
TestClockCreateParams, |
| 16 |
) |
| 17 |
from stripe.params.test_helpers._test_clock_delete_params import ( |
| 18 |
TestClockDeleteParams, |
| 19 |
) |
| 20 |
from stripe.params.test_helpers._test_clock_list_params import ( |
| 21 |
TestClockListParams, |
| 22 |
) |
| 23 |
from stripe.params.test_helpers._test_clock_retrieve_params import ( |
| 24 |
TestClockRetrieveParams, |
| 25 |
) |
| 26 |
from stripe.test_helpers._test_clock import TestClock |
| 27 |
|
| 28 |
|
| 29 |
class TestClockService(StripeService): |
| 30 |
def delete( |
| 31 |
self, |
| 32 |
test_clock: str, |
| 33 |
params: Optional["TestClockDeleteParams"] = None, |
| 34 |
options: Optional["RequestOptions"] = None, |
| 35 |
) -> "TestClock": |
| 36 |
""" |
| 37 |
Deletes a test clock. |
| 38 |
""" |
| 39 |
return cast( |
| 40 |
"TestClock", |
| 41 |
self._request( |
| 42 |
"delete", |
| 43 |
"/v1/test_helpers/test_clocks/{test_clock}".format( |
| 44 |
test_clock=sanitize_id(test_clock), |
| 45 |
), |
| 46 |
base_address="api", |
| 47 |
params=params, |
| 48 |
options=options, |
| 49 |
), |
| 50 |
) |
| 51 |
|
| 52 |
async def delete_async( |
| 53 |
self, |
| 54 |
test_clock: str, |
| 55 |
params: Optional["TestClockDeleteParams"] = None, |
| 56 |
options: Optional["RequestOptions"] = None, |
| 57 |
) -> "TestClock": |
| 58 |
""" |
| 59 |
Deletes a test clock. |
| 60 |
""" |
| 61 |
return cast( |
| 62 |
"TestClock", |
| 63 |
await self._request_async( |
| 64 |
"delete", |
| 65 |
"/v1/test_helpers/test_clocks/{test_clock}".format( |
| 66 |
test_clock=sanitize_id(test_clock), |
| 67 |
), |
| 68 |
base_address="api", |
| 69 |
params=params, |
| 70 |
options=options, |
| 71 |
), |
| 72 |
) |
| 73 |
|
| 74 |
def retrieve( |
| 75 |
self, |
| 76 |
test_clock: str, |
| 77 |
params: Optional["TestClockRetrieveParams"] = None, |
| 78 |
options: Optional["RequestOptions"] = None, |
| 79 |
) -> "TestClock": |
| 80 |
""" |
| 81 |
Retrieves a test clock. |
| 82 |
""" |
| 83 |
return cast( |
| 84 |
"TestClock", |
| 85 |
self._request( |
| 86 |
"get", |
| 87 |
"/v1/test_helpers/test_clocks/{test_clock}".format( |
| 88 |
test_clock=sanitize_id(test_clock), |
| 89 |
), |
| 90 |
base_address="api", |
| 91 |
params=params, |
| 92 |
options=options, |
| 93 |
), |
| 94 |
) |
| 95 |
|
| 96 |
async def retrieve_async( |
| 97 |
self, |
| 98 |
test_clock: str, |
| 99 |
params: Optional["TestClockRetrieveParams"] = None, |
| 100 |
options: Optional["RequestOptions"] = None, |
| 101 |
) -> "TestClock": |
| 102 |
""" |
| 103 |
Retrieves a test clock. |
| 104 |
""" |
| 105 |
return cast( |
| 106 |
"TestClock", |
| 107 |
await self._request_async( |
| 108 |
"get", |
| 109 |
"/v1/test_helpers/test_clocks/{test_clock}".format( |
| 110 |
test_clock=sanitize_id(test_clock), |
| 111 |
), |
| 112 |
base_address="api", |
| 113 |
params=params, |
| 114 |
options=options, |
| 115 |
), |
| 116 |
) |
| 117 |
|
| 118 |
def list( |
| 119 |
self, |
| 120 |
params: Optional["TestClockListParams"] = None, |
| 121 |
options: Optional["RequestOptions"] = None, |
| 122 |
) -> "ListObject[TestClock]": |
| 123 |
""" |
| 124 |
Returns a list of your test clocks. |
| 125 |
""" |
| 126 |
return cast( |
| 127 |
"ListObject[TestClock]", |
| 128 |
self._request( |
| 129 |
"get", |
| 130 |
"/v1/test_helpers/test_clocks", |
| 131 |
base_address="api", |
| 132 |
params=params, |
| 133 |
options=options, |
| 134 |
), |
| 135 |
) |
| 136 |
|
| 137 |
async def list_async( |
| 138 |
self, |
| 139 |
params: Optional["TestClockListParams"] = None, |
| 140 |
options: Optional["RequestOptions"] = None, |
| 141 |
) -> "ListObject[TestClock]": |
| 142 |
""" |
| 143 |
Returns a list of your test clocks. |
| 144 |
""" |
| 145 |
return cast( |
| 146 |
"ListObject[TestClock]", |
| 147 |
await self._request_async( |
| 148 |
"get", |
| 149 |
"/v1/test_helpers/test_clocks", |
| 150 |
base_address="api", |
| 151 |
params=params, |
| 152 |
options=options, |
| 153 |
), |
| 154 |
) |
| 155 |
|
| 156 |
def create( |
| 157 |
self, |
| 158 |
params: "TestClockCreateParams", |
| 159 |
options: Optional["RequestOptions"] = None, |
| 160 |
) -> "TestClock": |
| 161 |
""" |
| 162 |
Creates a new test clock that can be attached to new customers and quotes. |
| 163 |
""" |
| 164 |
return cast( |
| 165 |
"TestClock", |
| 166 |
self._request( |
| 167 |
"post", |
| 168 |
"/v1/test_helpers/test_clocks", |
| 169 |
base_address="api", |
| 170 |
params=params, |
| 171 |
options=options, |
| 172 |
), |
| 173 |
) |
| 174 |
|
| 175 |
async def create_async( |
| 176 |
self, |
| 177 |
params: "TestClockCreateParams", |
| 178 |
options: Optional["RequestOptions"] = None, |
| 179 |
) -> "TestClock": |
| 180 |
""" |
| 181 |
Creates a new test clock that can be attached to new customers and quotes. |
| 182 |
""" |
| 183 |
return cast( |
| 184 |
"TestClock", |
| 185 |
await self._request_async( |
| 186 |
"post", |
| 187 |
"/v1/test_helpers/test_clocks", |
| 188 |
base_address="api", |
| 189 |
params=params, |
| 190 |
options=options, |
| 191 |
), |
| 192 |
) |
| 193 |
|
| 194 |
def advance( |
| 195 |
self, |
| 196 |
test_clock: str, |
| 197 |
params: "TestClockAdvanceParams", |
| 198 |
options: Optional["RequestOptions"] = None, |
| 199 |
) -> "TestClock": |
| 200 |
""" |
| 201 |
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready. |
| 202 |
""" |
| 203 |
return cast( |
| 204 |
"TestClock", |
| 205 |
self._request( |
| 206 |
"post", |
| 207 |
"/v1/test_helpers/test_clocks/{test_clock}/advance".format( |
| 208 |
test_clock=sanitize_id(test_clock), |
| 209 |
), |
| 210 |
base_address="api", |
| 211 |
params=params, |
| 212 |
options=options, |
| 213 |
), |
| 214 |
) |
| 215 |
|
| 216 |
async def advance_async( |
| 217 |
self, |
| 218 |
test_clock: str, |
| 219 |
params: "TestClockAdvanceParams", |
| 220 |
options: Optional["RequestOptions"] = None, |
| 221 |
) -> "TestClock": |
| 222 |
""" |
| 223 |
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready. |
| 224 |
""" |
| 225 |
return cast( |
| 226 |
"TestClock", |
| 227 |
await self._request_async( |
| 228 |
"post", |
| 229 |
"/v1/test_helpers/test_clocks/{test_clock}/advance".format( |
| 230 |
test_clock=sanitize_id(test_clock), |
| 231 |
), |
| 232 |
base_address="api", |
| 233 |
params=params, |
| 234 |
options=options, |
| 235 |
), |
| 236 |
) |