88import httpx
99
1010from ..._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
11- from ..._utils import maybe_transform , async_maybe_transform
11+ from ..._utils import path_template , maybe_transform , async_maybe_transform
1212from ..._compat import cached_property
1313from ..._resource import SyncAPIResource , AsyncAPIResource
1414from ..._response import (
@@ -53,7 +53,7 @@ def update(
5353 self ,
5454 domain_name : str ,
5555 * ,
56- account_id : str ,
56+ account_id : str | None = None ,
5757 auto_renew : bool | Omit = omit ,
5858 locked : bool | Omit = omit ,
5959 privacy : bool | Omit = omit ,
@@ -90,12 +90,16 @@ def update(
9090
9191 timeout: Override the client-level default timeout for this request, in seconds
9292 """
93+ if account_id is None :
94+ account_id = self ._client ._get_account_id_path_param ()
9395 if not account_id :
9496 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
9597 if not domain_name :
9698 raise ValueError (f"Expected a non-empty value for `domain_name` but received { domain_name !r} " )
9799 return self ._put (
98- f"/accounts/{ account_id } /registrar/domains/{ domain_name } " ,
100+ path_template (
101+ "/accounts/{account_id}/registrar/domains/{domain_name}" , account_id = account_id , domain_name = domain_name
102+ ),
99103 body = maybe_transform (
100104 {
101105 "auto_renew" : auto_renew ,
@@ -120,7 +124,7 @@ def update(
120124 def list (
121125 self ,
122126 * ,
123- account_id : str ,
127+ account_id : str | None = None ,
124128 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125129 # The extra values given here take precedence over values defined on the client or passed to this method.
126130 extra_headers : Headers | None = None ,
@@ -142,10 +146,12 @@ def list(
142146
143147 timeout: Override the client-level default timeout for this request, in seconds
144148 """
149+ if account_id is None :
150+ account_id = self ._client ._get_account_id_path_param ()
145151 if not account_id :
146152 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
147153 return self ._get_api_list (
148- f "/accounts/{ account_id } /registrar/domains" ,
154+ path_template ( "/accounts/{account_id}/registrar/domains" , account_id = account_id ) ,
149155 page = SyncSinglePage [Domain ],
150156 options = make_request_options (
151157 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
@@ -160,7 +166,7 @@ def get(
160166 self ,
161167 domain_name : str ,
162168 * ,
163- account_id : str ,
169+ account_id : str | None = None ,
164170 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
165171 # The extra values given here take precedence over values defined on the client or passed to this method.
166172 extra_headers : Headers | None = None ,
@@ -187,12 +193,16 @@ def get(
187193
188194 timeout: Override the client-level default timeout for this request, in seconds
189195 """
196+ if account_id is None :
197+ account_id = self ._client ._get_account_id_path_param ()
190198 if not account_id :
191199 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
192200 if not domain_name :
193201 raise ValueError (f"Expected a non-empty value for `domain_name` but received { domain_name !r} " )
194202 return self ._get (
195- f"/accounts/{ account_id } /registrar/domains/{ domain_name } " ,
203+ path_template (
204+ "/accounts/{account_id}/registrar/domains/{domain_name}" , account_id = account_id , domain_name = domain_name
205+ ),
196206 options = make_request_options (
197207 extra_headers = extra_headers ,
198208 extra_query = extra_query ,
@@ -231,7 +241,7 @@ async def update(
231241 self ,
232242 domain_name : str ,
233243 * ,
234- account_id : str ,
244+ account_id : str | None = None ,
235245 auto_renew : bool | Omit = omit ,
236246 locked : bool | Omit = omit ,
237247 privacy : bool | Omit = omit ,
@@ -268,12 +278,16 @@ async def update(
268278
269279 timeout: Override the client-level default timeout for this request, in seconds
270280 """
281+ if account_id is None :
282+ account_id = self ._client ._get_account_id_path_param ()
271283 if not account_id :
272284 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
273285 if not domain_name :
274286 raise ValueError (f"Expected a non-empty value for `domain_name` but received { domain_name !r} " )
275287 return await self ._put (
276- f"/accounts/{ account_id } /registrar/domains/{ domain_name } " ,
288+ path_template (
289+ "/accounts/{account_id}/registrar/domains/{domain_name}" , account_id = account_id , domain_name = domain_name
290+ ),
277291 body = await async_maybe_transform (
278292 {
279293 "auto_renew" : auto_renew ,
@@ -298,7 +312,7 @@ async def update(
298312 def list (
299313 self ,
300314 * ,
301- account_id : str ,
315+ account_id : str | None = None ,
302316 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
303317 # The extra values given here take precedence over values defined on the client or passed to this method.
304318 extra_headers : Headers | None = None ,
@@ -320,10 +334,12 @@ def list(
320334
321335 timeout: Override the client-level default timeout for this request, in seconds
322336 """
337+ if account_id is None :
338+ account_id = self ._client ._get_account_id_path_param ()
323339 if not account_id :
324340 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
325341 return self ._get_api_list (
326- f "/accounts/{ account_id } /registrar/domains" ,
342+ path_template ( "/accounts/{account_id}/registrar/domains" , account_id = account_id ) ,
327343 page = AsyncSinglePage [Domain ],
328344 options = make_request_options (
329345 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
@@ -338,7 +354,7 @@ async def get(
338354 self ,
339355 domain_name : str ,
340356 * ,
341- account_id : str ,
357+ account_id : str | None = None ,
342358 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
343359 # The extra values given here take precedence over values defined on the client or passed to this method.
344360 extra_headers : Headers | None = None ,
@@ -365,12 +381,16 @@ async def get(
365381
366382 timeout: Override the client-level default timeout for this request, in seconds
367383 """
384+ if account_id is None :
385+ account_id = self ._client ._get_account_id_path_param ()
368386 if not account_id :
369387 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
370388 if not domain_name :
371389 raise ValueError (f"Expected a non-empty value for `domain_name` but received { domain_name !r} " )
372390 return await self ._get (
373- f"/accounts/{ account_id } /registrar/domains/{ domain_name } " ,
391+ path_template (
392+ "/accounts/{account_id}/registrar/domains/{domain_name}" , account_id = account_id , domain_name = domain_name
393+ ),
374394 options = make_request_options (
375395 extra_headers = extra_headers ,
376396 extra_query = extra_query ,
0 commit comments