Debian Codegraph @

stripe/treasury/_inbound_transfer_service.py

raw
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.treasury._inbound_transfer_cancel_params import (
12 InboundTransferCancelParams,
13 )
14 from stripe.params.treasury._inbound_transfer_create_params import (
15 InboundTransferCreateParams,
16 )
17 from stripe.params.treasury._inbound_transfer_list_params import (
18 InboundTransferListParams,
19 )
20 from stripe.params.treasury._inbound_transfer_retrieve_params import (
21 InboundTransferRetrieveParams,
22 )
23 from stripe.treasury._inbound_transfer import InboundTransfer
24
25
26 class InboundTransferService(StripeService):
27 def list(
28 self,
29 params: "InboundTransferListParams",
30 options: Optional["RequestOptions"] = None,
31 ) -> "ListObject[InboundTransfer]":
32 """
33 Returns a list of InboundTransfers sent from the specified FinancialAccount.
34 """
35 return cast(
36 "ListObject[InboundTransfer]",
37 self._request(
38 "get",
39 "/v1/treasury/inbound_transfers",
40 base_address="api",
41 params=params,
42 options=options,
43 ),
44 )
45
46 async def list_async(
47 self,
48 params: "InboundTransferListParams",
49 options: Optional["RequestOptions"] = None,
50 ) -> "ListObject[InboundTransfer]":
51 """
52 Returns a list of InboundTransfers sent from the specified FinancialAccount.
53 """
54 return cast(
55 "ListObject[InboundTransfer]",
56 await self._request_async(
57 "get",
58 "/v1/treasury/inbound_transfers",
59 base_address="api",
60 params=params,
61 options=options,
62 ),
63 )
64
65 def create(
66 self,
67 params: "InboundTransferCreateParams",
68 options: Optional["RequestOptions"] = None,
69 ) -> "InboundTransfer":
70 """
71 Creates an InboundTransfer.
72 """
73 return cast(
74 "InboundTransfer",
75 self._request(
76 "post",
77 "/v1/treasury/inbound_transfers",
78 base_address="api",
79 params=params,
80 options=options,
81 ),
82 )
83
84 async def create_async(
85 self,
86 params: "InboundTransferCreateParams",
87 options: Optional["RequestOptions"] = None,
88 ) -> "InboundTransfer":
89 """
90 Creates an InboundTransfer.
91 """
92 return cast(
93 "InboundTransfer",
94 await self._request_async(
95 "post",
96 "/v1/treasury/inbound_transfers",
97 base_address="api",
98 params=params,
99 options=options,
100 ),
101 )
102
103 def retrieve(
104 self,
105 id: str,
106 params: Optional["InboundTransferRetrieveParams"] = None,
107 options: Optional["RequestOptions"] = None,
108 ) -> "InboundTransfer":
109 """
110 Retrieves the details of an existing InboundTransfer.
111 """
112 return cast(
113 "InboundTransfer",
114 self._request(
115 "get",
116 "/v1/treasury/inbound_transfers/{id}".format(
117 id=sanitize_id(id),
118 ),
119 base_address="api",
120 params=params,
121 options=options,
122 ),
123 )
124
125 async def retrieve_async(
126 self,
127 id: str,
128 params: Optional["InboundTransferRetrieveParams"] = None,
129 options: Optional["RequestOptions"] = None,
130 ) -> "InboundTransfer":
131 """
132 Retrieves the details of an existing InboundTransfer.
133 """
134 return cast(
135 "InboundTransfer",
136 await self._request_async(
137 "get",
138 "/v1/treasury/inbound_transfers/{id}".format(
139 id=sanitize_id(id),
140 ),
141 base_address="api",
142 params=params,
143 options=options,
144 ),
145 )
146
147 def cancel(
148 self,
149 inbound_transfer: str,
150 params: Optional["InboundTransferCancelParams"] = None,
151 options: Optional["RequestOptions"] = None,
152 ) -> "InboundTransfer":
153 """
154 Cancels an InboundTransfer.
155 """
156 return cast(
157 "InboundTransfer",
158 self._request(
159 "post",
160 "/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
161 inbound_transfer=sanitize_id(inbound_transfer),
162 ),
163 base_address="api",
164 params=params,
165 options=options,
166 ),
167 )
168
169 async def cancel_async(
170 self,
171 inbound_transfer: str,
172 params: Optional["InboundTransferCancelParams"] = None,
173 options: Optional["RequestOptions"] = None,
174 ) -> "InboundTransfer":
175 """
176 Cancels an InboundTransfer.
177 """
178 return cast(
179 "InboundTransfer",
180 await self._request_async(
181 "post",
182 "/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
183 inbound_transfer=sanitize_id(inbound_transfer),
184 ),
185 base_address="api",
186 params=params,
187 options=options,
188 ),
189 )