77import httpx
88
99from ......_types import Body , Omit , Query , Headers , NotGiven , omit , not_given
10- from ......_utils import maybe_transform , async_maybe_transform
10+ from ......_utils import path_template , maybe_transform , async_maybe_transform
1111from ......_compat import cached_property
1212from ......_resource import SyncAPIResource , AsyncAPIResource
1313from ......_response import (
@@ -52,7 +52,7 @@ def with_streaming_response(self) -> PortalsResourceWithStreamingResponse:
5252 def create (
5353 self ,
5454 * ,
55- account_id : str ,
55+ account_id : str | None = None ,
5656 id : str ,
5757 hostname : str ,
5858 name : str ,
@@ -85,10 +85,12 @@ def create(
8585
8686 timeout: Override the client-level default timeout for this request, in seconds
8787 """
88+ if account_id is None :
89+ account_id = self ._client ._get_account_id_path_param ()
8890 if not account_id :
8991 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
9092 return self ._post (
91- f "/accounts/{ account_id } /access/ai-controls/mcp/portals" ,
93+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals" , account_id = account_id ) ,
9294 body = maybe_transform (
9395 {
9496 "id" : id ,
@@ -115,7 +117,7 @@ def update(
115117 self ,
116118 id : str ,
117119 * ,
118- account_id : str ,
120+ account_id : str | None = None ,
119121 allow_code_mode : bool | Omit = omit ,
120122 description : str | Omit = omit ,
121123 hostname : str | Omit = omit ,
@@ -147,12 +149,14 @@ def update(
147149
148150 timeout: Override the client-level default timeout for this request, in seconds
149151 """
152+ if account_id is None :
153+ account_id = self ._client ._get_account_id_path_param ()
150154 if not account_id :
151155 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
152156 if not id :
153157 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
154158 return self ._put (
155- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
159+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
156160 body = maybe_transform (
157161 {
158162 "allow_code_mode" : allow_code_mode ,
@@ -177,7 +181,7 @@ def update(
177181 def list (
178182 self ,
179183 * ,
180- account_id : str ,
184+ account_id : str | None = None ,
181185 page : int | Omit = omit ,
182186 per_page : int | Omit = omit ,
183187 search : str | Omit = omit ,
@@ -202,10 +206,12 @@ def list(
202206
203207 timeout: Override the client-level default timeout for this request, in seconds
204208 """
209+ if account_id is None :
210+ account_id = self ._client ._get_account_id_path_param ()
205211 if not account_id :
206212 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
207213 return self ._get_api_list (
208- f "/accounts/{ account_id } /access/ai-controls/mcp/portals" ,
214+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals" , account_id = account_id ) ,
209215 page = SyncV4PagePaginationArray [PortalListResponse ],
210216 options = make_request_options (
211217 extra_headers = extra_headers ,
@@ -228,7 +234,7 @@ def delete(
228234 self ,
229235 id : str ,
230236 * ,
231- account_id : str ,
237+ account_id : str | None = None ,
232238 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
233239 # The extra values given here take precedence over values defined on the client or passed to this method.
234240 extra_headers : Headers | None = None ,
@@ -250,12 +256,14 @@ def delete(
250256
251257 timeout: Override the client-level default timeout for this request, in seconds
252258 """
259+ if account_id is None :
260+ account_id = self ._client ._get_account_id_path_param ()
253261 if not account_id :
254262 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
255263 if not id :
256264 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
257265 return self ._delete (
258- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
266+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
259267 options = make_request_options (
260268 extra_headers = extra_headers ,
261269 extra_query = extra_query ,
@@ -270,7 +278,7 @@ def read(
270278 self ,
271279 id : str ,
272280 * ,
273- account_id : str ,
281+ account_id : str | None = None ,
274282 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
275283 # The extra values given here take precedence over values defined on the client or passed to this method.
276284 extra_headers : Headers | None = None ,
@@ -292,12 +300,14 @@ def read(
292300
293301 timeout: Override the client-level default timeout for this request, in seconds
294302 """
303+ if account_id is None :
304+ account_id = self ._client ._get_account_id_path_param ()
295305 if not account_id :
296306 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
297307 if not id :
298308 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
299309 return self ._get (
300- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
310+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
301311 options = make_request_options (
302312 extra_headers = extra_headers ,
303313 extra_query = extra_query ,
@@ -332,7 +342,7 @@ def with_streaming_response(self) -> AsyncPortalsResourceWithStreamingResponse:
332342 async def create (
333343 self ,
334344 * ,
335- account_id : str ,
345+ account_id : str | None = None ,
336346 id : str ,
337347 hostname : str ,
338348 name : str ,
@@ -365,10 +375,12 @@ async def create(
365375
366376 timeout: Override the client-level default timeout for this request, in seconds
367377 """
378+ if account_id is None :
379+ account_id = self ._client ._get_account_id_path_param ()
368380 if not account_id :
369381 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
370382 return await self ._post (
371- f "/accounts/{ account_id } /access/ai-controls/mcp/portals" ,
383+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals" , account_id = account_id ) ,
372384 body = await async_maybe_transform (
373385 {
374386 "id" : id ,
@@ -395,7 +407,7 @@ async def update(
395407 self ,
396408 id : str ,
397409 * ,
398- account_id : str ,
410+ account_id : str | None = None ,
399411 allow_code_mode : bool | Omit = omit ,
400412 description : str | Omit = omit ,
401413 hostname : str | Omit = omit ,
@@ -427,12 +439,14 @@ async def update(
427439
428440 timeout: Override the client-level default timeout for this request, in seconds
429441 """
442+ if account_id is None :
443+ account_id = self ._client ._get_account_id_path_param ()
430444 if not account_id :
431445 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
432446 if not id :
433447 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
434448 return await self ._put (
435- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
449+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
436450 body = await async_maybe_transform (
437451 {
438452 "allow_code_mode" : allow_code_mode ,
@@ -457,7 +471,7 @@ async def update(
457471 def list (
458472 self ,
459473 * ,
460- account_id : str ,
474+ account_id : str | None = None ,
461475 page : int | Omit = omit ,
462476 per_page : int | Omit = omit ,
463477 search : str | Omit = omit ,
@@ -482,10 +496,12 @@ def list(
482496
483497 timeout: Override the client-level default timeout for this request, in seconds
484498 """
499+ if account_id is None :
500+ account_id = self ._client ._get_account_id_path_param ()
485501 if not account_id :
486502 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
487503 return self ._get_api_list (
488- f "/accounts/{ account_id } /access/ai-controls/mcp/portals" ,
504+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals" , account_id = account_id ) ,
489505 page = AsyncV4PagePaginationArray [PortalListResponse ],
490506 options = make_request_options (
491507 extra_headers = extra_headers ,
@@ -508,7 +524,7 @@ async def delete(
508524 self ,
509525 id : str ,
510526 * ,
511- account_id : str ,
527+ account_id : str | None = None ,
512528 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
513529 # The extra values given here take precedence over values defined on the client or passed to this method.
514530 extra_headers : Headers | None = None ,
@@ -530,12 +546,14 @@ async def delete(
530546
531547 timeout: Override the client-level default timeout for this request, in seconds
532548 """
549+ if account_id is None :
550+ account_id = self ._client ._get_account_id_path_param ()
533551 if not account_id :
534552 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
535553 if not id :
536554 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
537555 return await self ._delete (
538- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
556+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
539557 options = make_request_options (
540558 extra_headers = extra_headers ,
541559 extra_query = extra_query ,
@@ -550,7 +568,7 @@ async def read(
550568 self ,
551569 id : str ,
552570 * ,
553- account_id : str ,
571+ account_id : str | None = None ,
554572 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
555573 # The extra values given here take precedence over values defined on the client or passed to this method.
556574 extra_headers : Headers | None = None ,
@@ -572,12 +590,14 @@ async def read(
572590
573591 timeout: Override the client-level default timeout for this request, in seconds
574592 """
593+ if account_id is None :
594+ account_id = self ._client ._get_account_id_path_param ()
575595 if not account_id :
576596 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
577597 if not id :
578598 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
579599 return await self ._get (
580- f "/accounts/{ account_id } /access/ai-controls/mcp/portals/{ id } " ,
600+ path_template ( "/accounts/{account_id}/access/ai-controls/mcp/portals/{id}" , account_id = account_id , id = id ) ,
581601 options = make_request_options (
582602 extra_headers = extra_headers ,
583603 extra_query = extra_query ,
0 commit comments