2525 AsyncStatusResourceWithStreamingResponse ,
2626)
2727from ...._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
28- from ...._utils import maybe_transform , async_maybe_transform
28+ from ...._utils import path_template , maybe_transform , async_maybe_transform
2929from ...._compat import cached_property
3030from ...._resource import SyncAPIResource , AsyncAPIResource
3131from ...._response import (
@@ -78,7 +78,7 @@ def create(
7878 self ,
7979 workflow_name : str ,
8080 * ,
81- account_id : str ,
81+ account_id : str | None = None ,
8282 instance_id : str | Omit = omit ,
8383 instance_retention : instance_create_params .InstanceRetention | Omit = omit ,
8484 params : object | Omit = omit ,
@@ -101,12 +101,18 @@ def create(
101101
102102 timeout: Override the client-level default timeout for this request, in seconds
103103 """
104+ if account_id is None :
105+ account_id = self ._client ._get_account_id_path_param ()
104106 if not account_id :
105107 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
106108 if not workflow_name :
107109 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
108110 return self ._post (
109- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances" ,
111+ path_template (
112+ "/accounts/{account_id}/workflows/{workflow_name}/instances" ,
113+ account_id = account_id ,
114+ workflow_name = workflow_name ,
115+ ),
110116 body = maybe_transform (
111117 {
112118 "instance_id" : instance_id ,
@@ -129,7 +135,7 @@ def list(
129135 self ,
130136 workflow_name : str ,
131137 * ,
132- account_id : str ,
138+ account_id : str | None = None ,
133139 cursor : str | Omit = omit ,
134140 date_end : Union [str , datetime ] | Omit = omit ,
135141 date_start : Union [str , datetime ] | Omit = omit ,
@@ -169,12 +175,18 @@ def list(
169175
170176 timeout: Override the client-level default timeout for this request, in seconds
171177 """
178+ if account_id is None :
179+ account_id = self ._client ._get_account_id_path_param ()
172180 if not account_id :
173181 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
174182 if not workflow_name :
175183 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
176184 return self ._get_api_list (
177- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances" ,
185+ path_template (
186+ "/accounts/{account_id}/workflows/{workflow_name}/instances" ,
187+ account_id = account_id ,
188+ workflow_name = workflow_name ,
189+ ),
178190 page = SyncV4PagePaginationArray [InstanceListResponse ],
179191 options = make_request_options (
180192 extra_headers = extra_headers ,
@@ -201,7 +213,7 @@ def bulk(
201213 self ,
202214 workflow_name : str ,
203215 * ,
204- account_id : str ,
216+ account_id : str | None = None ,
205217 body : Iterable [instance_bulk_params .Body ] | Omit = omit ,
206218 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
207219 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -222,12 +234,18 @@ def bulk(
222234
223235 timeout: Override the client-level default timeout for this request, in seconds
224236 """
237+ if account_id is None :
238+ account_id = self ._client ._get_account_id_path_param ()
225239 if not account_id :
226240 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
227241 if not workflow_name :
228242 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
229243 return self ._get_api_list (
230- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/batch" ,
244+ path_template (
245+ "/accounts/{account_id}/workflows/{workflow_name}/instances/batch" ,
246+ account_id = account_id ,
247+ workflow_name = workflow_name ,
248+ ),
231249 page = SyncSinglePage [InstanceBulkResponse ],
232250 body = maybe_transform (body , Iterable [instance_bulk_params .Body ]),
233251 options = make_request_options (
@@ -241,7 +259,7 @@ def get(
241259 self ,
242260 instance_id : str ,
243261 * ,
244- account_id : str ,
262+ account_id : str | None = None ,
245263 workflow_name : str ,
246264 order : Literal ["asc" , "desc" ] | Omit = omit ,
247265 simple : Literal ["true" , "false" ] | Omit = omit ,
@@ -268,14 +286,21 @@ def get(
268286
269287 timeout: Override the client-level default timeout for this request, in seconds
270288 """
289+ if account_id is None :
290+ account_id = self ._client ._get_account_id_path_param ()
271291 if not account_id :
272292 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
273293 if not workflow_name :
274294 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
275295 if not instance_id :
276296 raise ValueError (f"Expected a non-empty value for `instance_id` but received { instance_id !r} " )
277297 return self ._get (
278- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/{ instance_id } " ,
298+ path_template (
299+ "/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}" ,
300+ account_id = account_id ,
301+ workflow_name = workflow_name ,
302+ instance_id = instance_id ,
303+ ),
279304 options = make_request_options (
280305 extra_headers = extra_headers ,
281306 extra_query = extra_query ,
@@ -326,7 +351,7 @@ async def create(
326351 self ,
327352 workflow_name : str ,
328353 * ,
329- account_id : str ,
354+ account_id : str | None = None ,
330355 instance_id : str | Omit = omit ,
331356 instance_retention : instance_create_params .InstanceRetention | Omit = omit ,
332357 params : object | Omit = omit ,
@@ -349,12 +374,18 @@ async def create(
349374
350375 timeout: Override the client-level default timeout for this request, in seconds
351376 """
377+ if account_id is None :
378+ account_id = self ._client ._get_account_id_path_param ()
352379 if not account_id :
353380 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
354381 if not workflow_name :
355382 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
356383 return await self ._post (
357- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances" ,
384+ path_template (
385+ "/accounts/{account_id}/workflows/{workflow_name}/instances" ,
386+ account_id = account_id ,
387+ workflow_name = workflow_name ,
388+ ),
358389 body = await async_maybe_transform (
359390 {
360391 "instance_id" : instance_id ,
@@ -377,7 +408,7 @@ def list(
377408 self ,
378409 workflow_name : str ,
379410 * ,
380- account_id : str ,
411+ account_id : str | None = None ,
381412 cursor : str | Omit = omit ,
382413 date_end : Union [str , datetime ] | Omit = omit ,
383414 date_start : Union [str , datetime ] | Omit = omit ,
@@ -417,12 +448,18 @@ def list(
417448
418449 timeout: Override the client-level default timeout for this request, in seconds
419450 """
451+ if account_id is None :
452+ account_id = self ._client ._get_account_id_path_param ()
420453 if not account_id :
421454 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
422455 if not workflow_name :
423456 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
424457 return self ._get_api_list (
425- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances" ,
458+ path_template (
459+ "/accounts/{account_id}/workflows/{workflow_name}/instances" ,
460+ account_id = account_id ,
461+ workflow_name = workflow_name ,
462+ ),
426463 page = AsyncV4PagePaginationArray [InstanceListResponse ],
427464 options = make_request_options (
428465 extra_headers = extra_headers ,
@@ -449,7 +486,7 @@ def bulk(
449486 self ,
450487 workflow_name : str ,
451488 * ,
452- account_id : str ,
489+ account_id : str | None = None ,
453490 body : Iterable [instance_bulk_params .Body ] | Omit = omit ,
454491 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
455492 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -470,12 +507,18 @@ def bulk(
470507
471508 timeout: Override the client-level default timeout for this request, in seconds
472509 """
510+ if account_id is None :
511+ account_id = self ._client ._get_account_id_path_param ()
473512 if not account_id :
474513 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
475514 if not workflow_name :
476515 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
477516 return self ._get_api_list (
478- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/batch" ,
517+ path_template (
518+ "/accounts/{account_id}/workflows/{workflow_name}/instances/batch" ,
519+ account_id = account_id ,
520+ workflow_name = workflow_name ,
521+ ),
479522 page = AsyncSinglePage [InstanceBulkResponse ],
480523 body = maybe_transform (body , Iterable [instance_bulk_params .Body ]),
481524 options = make_request_options (
@@ -489,7 +532,7 @@ async def get(
489532 self ,
490533 instance_id : str ,
491534 * ,
492- account_id : str ,
535+ account_id : str | None = None ,
493536 workflow_name : str ,
494537 order : Literal ["asc" , "desc" ] | Omit = omit ,
495538 simple : Literal ["true" , "false" ] | Omit = omit ,
@@ -516,14 +559,21 @@ async def get(
516559
517560 timeout: Override the client-level default timeout for this request, in seconds
518561 """
562+ if account_id is None :
563+ account_id = self ._client ._get_account_id_path_param ()
519564 if not account_id :
520565 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
521566 if not workflow_name :
522567 raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
523568 if not instance_id :
524569 raise ValueError (f"Expected a non-empty value for `instance_id` but received { instance_id !r} " )
525570 return await self ._get (
526- f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/{ instance_id } " ,
571+ path_template (
572+ "/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}" ,
573+ account_id = account_id ,
574+ workflow_name = workflow_name ,
575+ instance_id = instance_id ,
576+ ),
527577 options = make_request_options (
528578 extra_headers = extra_headers ,
529579 extra_query = extra_query ,
0 commit comments