2
2
3
3
from __future__ import annotations
4
4
5
+ from typing import Type , cast
6
+ from typing_extensions import Literal
7
+
5
8
import httpx
6
9
7
10
from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
17
20
async_to_raw_response_wrapper ,
18
21
async_to_streamed_response_wrapper ,
19
22
)
23
+ from .._wrappers import ResultWrapper
20
24
from .._base_client import make_request_options
21
25
from ..types .url_normalization import url_normalization_update_params
22
26
from ..types .url_normalization .url_normalization_get_response import URLNormalizationGetResponse
@@ -49,8 +53,8 @@ def update(
49
53
self ,
50
54
* ,
51
55
zone_id : str ,
52
- scope : str | NotGiven = NOT_GIVEN ,
53
- type : str | NotGiven = NOT_GIVEN ,
56
+ scope : Literal [ "incoming" , "both" ] ,
57
+ type : Literal [ "cloudflare" , "rfc3986" ] ,
54
58
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
59
# The extra values given here take precedence over values defined on the client or passed to this method.
56
60
extra_headers : Headers | None = None ,
@@ -59,10 +63,10 @@ def update(
59
63
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
60
64
) -> URLNormalizationUpdateResponse :
61
65
"""
62
- Updates the URL normalization settings.
66
+ Updates the URL Normalization settings.
63
67
64
68
Args:
65
- zone_id: Identifier
69
+ zone_id: The unique ID of the zone.
66
70
67
71
scope: The scope of the URL normalization.
68
72
@@ -88,9 +92,13 @@ def update(
88
92
url_normalization_update_params .URLNormalizationUpdateParams ,
89
93
),
90
94
options = make_request_options (
91
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
95
+ extra_headers = extra_headers ,
96
+ extra_query = extra_query ,
97
+ extra_body = extra_body ,
98
+ timeout = timeout ,
99
+ post_parser = ResultWrapper [URLNormalizationUpdateResponse ]._unwrapper ,
92
100
),
93
- cast_to = URLNormalizationUpdateResponse ,
101
+ cast_to = cast ( Type [ URLNormalizationUpdateResponse ], ResultWrapper [ URLNormalizationUpdateResponse ]) ,
94
102
)
95
103
96
104
def get (
@@ -105,10 +113,10 @@ def get(
105
113
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
106
114
) -> URLNormalizationGetResponse :
107
115
"""
108
- Fetches the current URL normalization settings.
116
+ Fetches the current URL Normalization settings.
109
117
110
118
Args:
111
- zone_id: Identifier
119
+ zone_id: The unique ID of the zone.
112
120
113
121
extra_headers: Send extra headers
114
122
@@ -123,9 +131,13 @@ def get(
123
131
return self ._get (
124
132
f"/zones/{ zone_id } /url_normalization" ,
125
133
options = make_request_options (
126
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
134
+ extra_headers = extra_headers ,
135
+ extra_query = extra_query ,
136
+ extra_body = extra_body ,
137
+ timeout = timeout ,
138
+ post_parser = ResultWrapper [URLNormalizationGetResponse ]._unwrapper ,
127
139
),
128
- cast_to = URLNormalizationGetResponse ,
140
+ cast_to = cast ( Type [ URLNormalizationGetResponse ], ResultWrapper [ URLNormalizationGetResponse ]) ,
129
141
)
130
142
131
143
@@ -153,8 +165,8 @@ async def update(
153
165
self ,
154
166
* ,
155
167
zone_id : str ,
156
- scope : str | NotGiven = NOT_GIVEN ,
157
- type : str | NotGiven = NOT_GIVEN ,
168
+ scope : Literal [ "incoming" , "both" ] ,
169
+ type : Literal [ "cloudflare" , "rfc3986" ] ,
158
170
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
159
171
# The extra values given here take precedence over values defined on the client or passed to this method.
160
172
extra_headers : Headers | None = None ,
@@ -163,10 +175,10 @@ async def update(
163
175
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
164
176
) -> URLNormalizationUpdateResponse :
165
177
"""
166
- Updates the URL normalization settings.
178
+ Updates the URL Normalization settings.
167
179
168
180
Args:
169
- zone_id: Identifier
181
+ zone_id: The unique ID of the zone.
170
182
171
183
scope: The scope of the URL normalization.
172
184
@@ -192,9 +204,13 @@ async def update(
192
204
url_normalization_update_params .URLNormalizationUpdateParams ,
193
205
),
194
206
options = make_request_options (
195
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
207
+ extra_headers = extra_headers ,
208
+ extra_query = extra_query ,
209
+ extra_body = extra_body ,
210
+ timeout = timeout ,
211
+ post_parser = ResultWrapper [URLNormalizationUpdateResponse ]._unwrapper ,
196
212
),
197
- cast_to = URLNormalizationUpdateResponse ,
213
+ cast_to = cast ( Type [ URLNormalizationUpdateResponse ], ResultWrapper [ URLNormalizationUpdateResponse ]) ,
198
214
)
199
215
200
216
async def get (
@@ -209,10 +225,10 @@ async def get(
209
225
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
210
226
) -> URLNormalizationGetResponse :
211
227
"""
212
- Fetches the current URL normalization settings.
228
+ Fetches the current URL Normalization settings.
213
229
214
230
Args:
215
- zone_id: Identifier
231
+ zone_id: The unique ID of the zone.
216
232
217
233
extra_headers: Send extra headers
218
234
@@ -227,9 +243,13 @@ async def get(
227
243
return await self ._get (
228
244
f"/zones/{ zone_id } /url_normalization" ,
229
245
options = make_request_options (
230
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
246
+ extra_headers = extra_headers ,
247
+ extra_query = extra_query ,
248
+ extra_body = extra_body ,
249
+ timeout = timeout ,
250
+ post_parser = ResultWrapper [URLNormalizationGetResponse ]._unwrapper ,
231
251
),
232
- cast_to = URLNormalizationGetResponse ,
252
+ cast_to = cast ( Type [ URLNormalizationGetResponse ], ResultWrapper [ URLNormalizationGetResponse ]) ,
233
253
)
234
254
235
255
0 commit comments