22
33from __future__ import annotations
44
5- from typing import Type , Optional , cast
5+ from typing import Optional
66
77import httpx
88
99from ..._types import Body , Query , Headers , NotGiven , not_given
10- from ..._utils import maybe_transform , async_maybe_transform
1110from ..._compat import cached_property
1211from ..._resource import SyncAPIResource , AsyncAPIResource
1312from ..._response import (
1413 BinaryAPIResponse ,
1514 AsyncBinaryAPIResponse ,
1615 StreamedBinaryAPIResponse ,
1716 AsyncStreamedBinaryAPIResponse ,
18- to_raw_response_wrapper ,
19- to_streamed_response_wrapper ,
20- async_to_raw_response_wrapper ,
2117 to_custom_raw_response_wrapper ,
22- async_to_streamed_response_wrapper ,
2318 to_custom_streamed_response_wrapper ,
2419 async_to_custom_raw_response_wrapper ,
2520 async_to_custom_streamed_response_wrapper ,
2621)
27- from ..._wrappers import ResultWrapper
2822from ..._base_client import make_request_options
29- from ...types .addressing import loa_document_create_params
30- from ...types .addressing .loa_document_create_response import LOADocumentCreateResponse
3123
3224__all__ = ["LOADocumentsResource" , "AsyncLOADocumentsResource" ]
3325
@@ -52,53 +44,6 @@ def with_streaming_response(self) -> LOADocumentsResourceWithStreamingResponse:
5244 """
5345 return LOADocumentsResourceWithStreamingResponse (self )
5446
55- def create (
56- self ,
57- * ,
58- account_id : str ,
59- loa_document : str ,
60- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61- # The extra values given here take precedence over values defined on the client or passed to this method.
62- extra_headers : Headers | None = None ,
63- extra_query : Query | None = None ,
64- extra_body : Body | None = None ,
65- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
66- ) -> Optional [LOADocumentCreateResponse ]:
67- """
68- Submit LOA document (pdf format) under the account.
69-
70- Args:
71- account_id: Identifier of a Cloudflare account.
72-
73- loa_document: LOA document to upload.
74-
75- extra_headers: Send extra headers
76-
77- extra_query: Add additional query parameters to the request
78-
79- extra_body: Add additional JSON properties to the request
80-
81- timeout: Override the client-level default timeout for this request, in seconds
82- """
83- if not account_id :
84- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
85- # It should be noted that the actual Content-Type header that will be
86- # sent to the server will contain a `boundary` parameter, e.g.
87- # multipart/form-data; boundary=---abc--
88- extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
89- return self ._post (
90- f"/accounts/{ account_id } /addressing/loa_documents" ,
91- body = maybe_transform ({"loa_document" : loa_document }, loa_document_create_params .LOADocumentCreateParams ),
92- options = make_request_options (
93- extra_headers = extra_headers ,
94- extra_query = extra_query ,
95- extra_body = extra_body ,
96- timeout = timeout ,
97- post_parser = ResultWrapper [Optional [LOADocumentCreateResponse ]]._unwrapper ,
98- ),
99- cast_to = cast (Type [Optional [LOADocumentCreateResponse ]], ResultWrapper [LOADocumentCreateResponse ]),
100- )
101-
10247 def get (
10348 self ,
10449 loa_document_id : Optional [str ],
@@ -161,55 +106,6 @@ def with_streaming_response(self) -> AsyncLOADocumentsResourceWithStreamingRespo
161106 """
162107 return AsyncLOADocumentsResourceWithStreamingResponse (self )
163108
164- async def create (
165- self ,
166- * ,
167- account_id : str ,
168- loa_document : str ,
169- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
170- # The extra values given here take precedence over values defined on the client or passed to this method.
171- extra_headers : Headers | None = None ,
172- extra_query : Query | None = None ,
173- extra_body : Body | None = None ,
174- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
175- ) -> Optional [LOADocumentCreateResponse ]:
176- """
177- Submit LOA document (pdf format) under the account.
178-
179- Args:
180- account_id: Identifier of a Cloudflare account.
181-
182- loa_document: LOA document to upload.
183-
184- extra_headers: Send extra headers
185-
186- extra_query: Add additional query parameters to the request
187-
188- extra_body: Add additional JSON properties to the request
189-
190- timeout: Override the client-level default timeout for this request, in seconds
191- """
192- if not account_id :
193- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
194- # It should be noted that the actual Content-Type header that will be
195- # sent to the server will contain a `boundary` parameter, e.g.
196- # multipart/form-data; boundary=---abc--
197- extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
198- return await self ._post (
199- f"/accounts/{ account_id } /addressing/loa_documents" ,
200- body = await async_maybe_transform (
201- {"loa_document" : loa_document }, loa_document_create_params .LOADocumentCreateParams
202- ),
203- options = make_request_options (
204- extra_headers = extra_headers ,
205- extra_query = extra_query ,
206- extra_body = extra_body ,
207- timeout = timeout ,
208- post_parser = ResultWrapper [Optional [LOADocumentCreateResponse ]]._unwrapper ,
209- ),
210- cast_to = cast (Type [Optional [LOADocumentCreateResponse ]], ResultWrapper [LOADocumentCreateResponse ]),
211- )
212-
213109 async def get (
214110 self ,
215111 loa_document_id : Optional [str ],
@@ -256,9 +152,6 @@ class LOADocumentsResourceWithRawResponse:
256152 def __init__ (self , loa_documents : LOADocumentsResource ) -> None :
257153 self ._loa_documents = loa_documents
258154
259- self .create = to_raw_response_wrapper (
260- loa_documents .create ,
261- )
262155 self .get = to_custom_raw_response_wrapper (
263156 loa_documents .get ,
264157 BinaryAPIResponse ,
@@ -269,9 +162,6 @@ class AsyncLOADocumentsResourceWithRawResponse:
269162 def __init__ (self , loa_documents : AsyncLOADocumentsResource ) -> None :
270163 self ._loa_documents = loa_documents
271164
272- self .create = async_to_raw_response_wrapper (
273- loa_documents .create ,
274- )
275165 self .get = async_to_custom_raw_response_wrapper (
276166 loa_documents .get ,
277167 AsyncBinaryAPIResponse ,
@@ -282,9 +172,6 @@ class LOADocumentsResourceWithStreamingResponse:
282172 def __init__ (self , loa_documents : LOADocumentsResource ) -> None :
283173 self ._loa_documents = loa_documents
284174
285- self .create = to_streamed_response_wrapper (
286- loa_documents .create ,
287- )
288175 self .get = to_custom_streamed_response_wrapper (
289176 loa_documents .get ,
290177 StreamedBinaryAPIResponse ,
@@ -295,9 +182,6 @@ class AsyncLOADocumentsResourceWithStreamingResponse:
295182 def __init__ (self , loa_documents : AsyncLOADocumentsResource ) -> None :
296183 self ._loa_documents = loa_documents
297184
298- self .create = async_to_streamed_response_wrapper (
299- loa_documents .create ,
300- )
301185 self .get = async_to_custom_streamed_response_wrapper (
302186 loa_documents .get ,
303187 AsyncStreamedBinaryAPIResponse ,
0 commit comments