6
6
7
7
import httpx
8
8
9
- from .... _types import NOT_GIVEN , Body , Query , Headers , NotGiven
10
- from .... _utils import (
9
+ from ..._types import NOT_GIVEN , Body , Query , Headers , NotGiven
10
+ from ..._utils import (
11
11
maybe_transform ,
12
12
async_maybe_transform ,
13
13
)
14
- from .downloads import (
15
- DownloadsResource ,
16
- AsyncDownloadsResource ,
17
- DownloadsResourceWithRawResponse ,
18
- AsyncDownloadsResourceWithRawResponse ,
19
- DownloadsResourceWithStreamingResponse ,
20
- AsyncDownloadsResourceWithStreamingResponse ,
21
- )
22
- from ...._compat import cached_property
23
- from ...._resource import SyncAPIResource , AsyncAPIResource
24
- from ...._response import (
14
+ from ..._compat import cached_property
15
+ from ..._resource import SyncAPIResource , AsyncAPIResource
16
+ from ..._response import (
17
+ BinaryAPIResponse ,
18
+ AsyncBinaryAPIResponse ,
19
+ StreamedBinaryAPIResponse ,
20
+ AsyncStreamedBinaryAPIResponse ,
25
21
to_raw_response_wrapper ,
26
22
to_streamed_response_wrapper ,
27
23
async_to_raw_response_wrapper ,
24
+ to_custom_raw_response_wrapper ,
28
25
async_to_streamed_response_wrapper ,
26
+ to_custom_streamed_response_wrapper ,
27
+ async_to_custom_raw_response_wrapper ,
28
+ async_to_custom_streamed_response_wrapper ,
29
29
)
30
- from .... _wrappers import ResultWrapper
31
- from .... _base_client import make_request_options
32
- from .... types .addressing import loa_document_create_params
33
- from .... types .addressing .loa_document_create_response import LOADocumentCreateResponse
30
+ from ..._wrappers import ResultWrapper
31
+ from ..._base_client import make_request_options
32
+ from ...types .addressing import loa_document_create_params
33
+ from ...types .addressing .loa_document_create_response import LOADocumentCreateResponse
34
34
35
35
__all__ = ["LOADocumentsResource" , "AsyncLOADocumentsResource" ]
36
36
37
37
38
38
class LOADocumentsResource (SyncAPIResource ):
39
- @cached_property
40
- def downloads (self ) -> DownloadsResource :
41
- return DownloadsResource (self ._client )
42
-
43
39
@cached_property
44
40
def with_raw_response (self ) -> LOADocumentsResourceWithRawResponse :
45
41
"""
@@ -106,12 +102,49 @@ def create(
106
102
cast_to = cast (Type [Optional [LOADocumentCreateResponse ]], ResultWrapper [LOADocumentCreateResponse ]),
107
103
)
108
104
105
+ def get (
106
+ self ,
107
+ loa_document_id : Optional [str ],
108
+ * ,
109
+ account_id : str ,
110
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
111
+ # The extra values given here take precedence over values defined on the client or passed to this method.
112
+ extra_headers : Headers | None = None ,
113
+ extra_query : Query | None = None ,
114
+ extra_body : Body | None = None ,
115
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
116
+ ) -> BinaryAPIResponse :
117
+ """
118
+ Download specified LOA document under the account.
109
119
110
- class AsyncLOADocumentsResource (AsyncAPIResource ):
111
- @cached_property
112
- def downloads (self ) -> AsyncDownloadsResource :
113
- return AsyncDownloadsResource (self ._client )
120
+ Args:
121
+ account_id: Identifier
122
+
123
+ loa_document_id: Identifier for the uploaded LOA document.
124
+
125
+ extra_headers: Send extra headers
126
+
127
+ extra_query: Add additional query parameters to the request
128
+
129
+ extra_body: Add additional JSON properties to the request
114
130
131
+ timeout: Override the client-level default timeout for this request, in seconds
132
+ """
133
+ if not account_id :
134
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
135
+ if not loa_document_id :
136
+ raise ValueError (f"Expected a non-empty value for `loa_document_id` but received { loa_document_id !r} " )
137
+ extra_headers = {"Accept" : "application/pdf" , ** (extra_headers or {})}
138
+ return self ._get (
139
+ f"/accounts/{ account_id } /addressing/loa_documents/{ loa_document_id } /download" ,
140
+ options = make_request_options (
141
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
142
+ ),
143
+ cast_to = BinaryAPIResponse ,
144
+ )
145
+
146
+
147
+ class AsyncLOADocumentsResource (AsyncAPIResource ):
115
148
@cached_property
116
149
def with_raw_response (self ) -> AsyncLOADocumentsResourceWithRawResponse :
117
150
"""
@@ -180,6 +213,47 @@ async def create(
180
213
cast_to = cast (Type [Optional [LOADocumentCreateResponse ]], ResultWrapper [LOADocumentCreateResponse ]),
181
214
)
182
215
216
+ async def get (
217
+ self ,
218
+ loa_document_id : Optional [str ],
219
+ * ,
220
+ account_id : str ,
221
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
222
+ # The extra values given here take precedence over values defined on the client or passed to this method.
223
+ extra_headers : Headers | None = None ,
224
+ extra_query : Query | None = None ,
225
+ extra_body : Body | None = None ,
226
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
227
+ ) -> AsyncBinaryAPIResponse :
228
+ """
229
+ Download specified LOA document under the account.
230
+
231
+ Args:
232
+ account_id: Identifier
233
+
234
+ loa_document_id: Identifier for the uploaded LOA document.
235
+
236
+ extra_headers: Send extra headers
237
+
238
+ extra_query: Add additional query parameters to the request
239
+
240
+ extra_body: Add additional JSON properties to the request
241
+
242
+ timeout: Override the client-level default timeout for this request, in seconds
243
+ """
244
+ if not account_id :
245
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
246
+ if not loa_document_id :
247
+ raise ValueError (f"Expected a non-empty value for `loa_document_id` but received { loa_document_id !r} " )
248
+ extra_headers = {"Accept" : "application/pdf" , ** (extra_headers or {})}
249
+ return await self ._get (
250
+ f"/accounts/{ account_id } /addressing/loa_documents/{ loa_document_id } /download" ,
251
+ options = make_request_options (
252
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
253
+ ),
254
+ cast_to = AsyncBinaryAPIResponse ,
255
+ )
256
+
183
257
184
258
class LOADocumentsResourceWithRawResponse :
185
259
def __init__ (self , loa_documents : LOADocumentsResource ) -> None :
@@ -188,10 +262,10 @@ def __init__(self, loa_documents: LOADocumentsResource) -> None:
188
262
self .create = to_raw_response_wrapper (
189
263
loa_documents .create ,
190
264
)
191
-
192
- @ cached_property
193
- def downloads ( self ) -> DownloadsResourceWithRawResponse :
194
- return DownloadsResourceWithRawResponse ( self . _loa_documents . downloads )
265
+ self . get = to_custom_raw_response_wrapper (
266
+ loa_documents . get ,
267
+ BinaryAPIResponse ,
268
+ )
195
269
196
270
197
271
class AsyncLOADocumentsResourceWithRawResponse :
@@ -201,10 +275,10 @@ def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None:
201
275
self .create = async_to_raw_response_wrapper (
202
276
loa_documents .create ,
203
277
)
204
-
205
- @ cached_property
206
- def downloads ( self ) -> AsyncDownloadsResourceWithRawResponse :
207
- return AsyncDownloadsResourceWithRawResponse ( self . _loa_documents . downloads )
278
+ self . get = async_to_custom_raw_response_wrapper (
279
+ loa_documents . get ,
280
+ AsyncBinaryAPIResponse ,
281
+ )
208
282
209
283
210
284
class LOADocumentsResourceWithStreamingResponse :
@@ -214,10 +288,10 @@ def __init__(self, loa_documents: LOADocumentsResource) -> None:
214
288
self .create = to_streamed_response_wrapper (
215
289
loa_documents .create ,
216
290
)
217
-
218
- @ cached_property
219
- def downloads ( self ) -> DownloadsResourceWithStreamingResponse :
220
- return DownloadsResourceWithStreamingResponse ( self . _loa_documents . downloads )
291
+ self . get = to_custom_streamed_response_wrapper (
292
+ loa_documents . get ,
293
+ StreamedBinaryAPIResponse ,
294
+ )
221
295
222
296
223
297
class AsyncLOADocumentsResourceWithStreamingResponse :
@@ -227,7 +301,7 @@ def __init__(self, loa_documents: AsyncLOADocumentsResource) -> None:
227
301
self .create = async_to_streamed_response_wrapper (
228
302
loa_documents .create ,
229
303
)
230
-
231
- @ cached_property
232
- def downloads ( self ) -> AsyncDownloadsResourceWithStreamingResponse :
233
- return AsyncDownloadsResourceWithStreamingResponse ( self . _loa_documents . downloads )
304
+ self . get = async_to_custom_streamed_response_wrapper (
305
+ loa_documents . get ,
306
+ AsyncStreamedBinaryAPIResponse ,
307
+ )
0 commit comments