Skip to content

Commit cc2dfa0

Browse files
committed
reverting flat args for functions
1 parent 6a47c1b commit cc2dfa0

2 files changed

Lines changed: 150 additions & 53 deletions

File tree

src/runloop_api_client/resources/blueprints.py

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,30 @@ def is_done_building(blueprint: BlueprintView) -> bool:
230230
def create_and_await_build_complete(
231231
self,
232232
*,
233-
create_args: blueprint_create_params.BlueprintCreateParams,
234-
request_args: BlueprintRequestArgs | None = None,
233+
name: str,
234+
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
235+
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
236+
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
237+
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
238+
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
239+
services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
240+
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
241+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
242+
# The extra values given here take precedence over values defined on the client or passed to this method.
243+
extra_headers: Headers | None = None,
244+
extra_query: Query | None = None,
245+
extra_body: Body | None = None,
246+
polling_config: PollingConfig | None = None,
247+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
248+
idempotency_key: str | None = None,
235249
) -> BlueprintView:
236250
"""Create a new Blueprint and wait for it to finish building.
237251
238252
This is a wrapper around the `create` method that waits for the blueprint to finish building.
239253
240254
Args:
241-
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
242-
request_args: Optional request arguments including polling configuration and additional request options
255+
See the `create` method for detailed documentation.
256+
polling_config: Optional polling configuration
243257
244258
Returns:
245259
The built blueprint
@@ -249,18 +263,25 @@ def create_and_await_build_complete(
249263
RunloopError: If blueprint enters a non-built terminal state
250264
"""
251265
# Pass all create_args to the underlying create method
252-
blueprint = self.create(**create_args)
253-
254-
if request_args is None:
255-
request_args = {}
266+
blueprint = self.create(
267+
name=name,
268+
base_blueprint_id=base_blueprint_id,
269+
code_mounts=code_mounts,
270+
dockerfile=dockerfile,
271+
file_mounts=file_mounts,
272+
launch_parameters=launch_parameters,
273+
services=services,
274+
system_setup_commands=system_setup_commands,
275+
extra_headers=extra_headers,
276+
extra_query=extra_query,
277+
extra_body=extra_body,
278+
timeout=timeout,
279+
idempotency_key=idempotency_key,
280+
)
256281

257282
return self.await_build_complete(
258283
blueprint.id,
259-
polling_config=request_args.get("polling_config", None),
260-
extra_headers=request_args.get("extra_headers", None),
261-
extra_query=request_args.get("extra_query", None),
262-
extra_body=request_args.get("extra_body", None),
263-
timeout=request_args.get("timeout", None),
284+
polling_config=polling_config,
264285
)
265286

266287
def list(
@@ -700,16 +721,30 @@ def is_done_building(blueprint: BlueprintView) -> bool:
700721
async def create_and_await_build_complete(
701722
self,
702723
*,
703-
create_args: blueprint_create_params.BlueprintCreateParams,
704-
request_args: BlueprintRequestArgs | None = None,
724+
name: str,
725+
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
726+
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
727+
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
728+
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
729+
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
730+
services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
731+
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
732+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
733+
# The extra values given here take precedence over values defined on the client or passed to this method.
734+
extra_headers: Headers | None = None,
735+
extra_query: Query | None = None,
736+
extra_body: Body | None = None,
737+
polling_config: PollingConfig | None = None,
738+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
739+
idempotency_key: str | None = None,
705740
) -> BlueprintView:
706741
"""Create a new Blueprint and wait for it to finish building.
707742
708743
This is a wrapper around the `create` method that waits for the blueprint to finish building.
709744
710745
Args:
711-
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
712-
request_args: Optional request arguments including polling configuration and additional request options
746+
See the `create` method for detailed documentation.
747+
polling_config: Optional polling configuration
713748
714749
Returns:
715750
The built blueprint
@@ -719,19 +754,29 @@ async def create_and_await_build_complete(
719754
RunloopError: If blueprint enters a non-built terminal state
720755
"""
721756
# Pass all create_args to the underlying create method
722-
blueprint = await self.create(**create_args)
723-
724-
# Extract polling config and other request args
725-
if request_args is None:
726-
request_args = {}
757+
blueprint = await self.create(
758+
name=name,
759+
base_blueprint_id=base_blueprint_id,
760+
code_mounts=code_mounts,
761+
dockerfile=dockerfile,
762+
file_mounts=file_mounts,
763+
launch_parameters=launch_parameters,
764+
services=services,
765+
system_setup_commands=system_setup_commands,
766+
extra_headers=extra_headers,
767+
extra_query=extra_query,
768+
extra_body=extra_body,
769+
timeout=timeout,
770+
idempotency_key=idempotency_key,
771+
)
727772

728773
return await self.await_build_complete(
729774
blueprint.id,
730-
polling_config=request_args.get("polling_config", None),
731-
extra_headers=request_args.get("extra_headers", None),
732-
extra_query=request_args.get("extra_query", None),
733-
extra_body=request_args.get("extra_body", None),
734-
timeout=request_args.get("timeout", None),
775+
polling_config=polling_config,
776+
extra_headers=extra_headers,
777+
extra_query=extra_query,
778+
extra_body=extra_body,
779+
timeout=timeout,
735780
)
736781

737782
def list(

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 78 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,26 @@ def is_done_booting(devbox: DevboxView) -> bool:
430430
def create_and_await_running(
431431
self,
432432
*,
433-
create_args: devbox_create_params.DevboxCreateParams | None = None,
434-
request_args: DevboxRequestArgs | None = None,
433+
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
434+
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
435+
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
436+
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
437+
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
438+
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
439+
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
440+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
441+
name: Optional[str] | NotGiven = NOT_GIVEN,
442+
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
443+
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
444+
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
445+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
446+
# The extra values given here take precedence over values defined on the client or passed to this method.
447+
extra_headers: Headers | None = None,
448+
extra_query: Query | None = None,
449+
extra_body: Body | None = None,
450+
polling_config: PollingConfig | None = None,
451+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
452+
idempotency_key: str | None = None,
435453
) -> DevboxView:
436454
"""Create a new devbox and wait for it to be in running state.
437455
@@ -448,22 +466,30 @@ def create_and_await_running(
448466
PollingTimeout: If polling times out before devbox is running
449467
RunloopError: If devbox enters a non-running terminal state
450468
"""
451-
# Extract polling config and other request args
452-
if request_args is None:
453-
request_args = {}
454-
455469
# Pass all create_args to the underlying create method
456470
devbox = self.create(
457-
**(create_args or {}),
458-
extra_headers=request_args.get("extra_headers", None),
459-
extra_query=request_args.get("extra_query", None),
460-
extra_body=request_args.get("extra_body", None),
461-
timeout=request_args.get("timeout", None),
471+
blueprint_id=blueprint_id,
472+
blueprint_name=blueprint_name,
473+
code_mounts=code_mounts,
474+
entrypoint=entrypoint,
475+
environment_variables=environment_variables,
476+
file_mounts=file_mounts,
477+
launch_parameters=launch_parameters,
478+
metadata=metadata,
479+
name=name,
480+
repo_connection_id=repo_connection_id,
481+
secrets=secrets,
482+
snapshot_id=snapshot_id,
483+
extra_headers=extra_headers,
484+
extra_query=extra_query,
485+
extra_body=extra_body,
486+
timeout=timeout,
487+
idempotency_key=idempotency_key,
462488
)
463489

464490
return self.await_running(
465491
devbox.id,
466-
polling_config=request_args.get("polling_config", None),
492+
polling_config=polling_config,
467493
)
468494

469495
def list(
@@ -1558,16 +1584,34 @@ async def retrieve(
15581584
async def create_and_await_running(
15591585
self,
15601586
*,
1561-
create_args: devbox_create_params.DevboxCreateParams | None = None,
1562-
request_args: DevboxRequestArgs | None = None,
1587+
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
1588+
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
1589+
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
1590+
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
1591+
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1592+
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1593+
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
1594+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1595+
name: Optional[str] | NotGiven = NOT_GIVEN,
1596+
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
1597+
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1598+
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
1599+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1600+
# The extra values given here take precedence over values defined on the client or passed to this method.
1601+
extra_headers: Headers | None = None,
1602+
extra_query: Query | None = None,
1603+
extra_body: Body | None = None,
1604+
polling_config: PollingConfig | None = None,
1605+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1606+
idempotency_key: str | None = None,
15631607
) -> DevboxView:
15641608
"""Create a devbox and wait for it to be in running state.
15651609
15661610
This is a wrapper around the `create` method that waits for the devbox to reach running state.
15671611
15681612
Args:
1569-
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
1570-
request_args: Optional request arguments including polling configuration and additional request options
1613+
See the `create` method for detailed documentation.
1614+
polling_config: Optional polling configuration
15711615
15721616
Returns:
15731617
The devbox in running state
@@ -1577,22 +1621,30 @@ async def create_and_await_running(
15771621
RunloopError: If devbox enters a non-running terminal state
15781622
"""
15791623

1580-
# Extract polling config and other request args
1581-
if request_args is None:
1582-
request_args = {}
1583-
15841624
# Pass all create_args, relevant request args to the underlying create method
15851625
devbox = await self.create(
1586-
**(create_args or {}),
1587-
extra_headers=request_args.get("extra_headers", None),
1588-
extra_query=request_args.get("extra_query", None),
1589-
extra_body=request_args.get("extra_body", None),
1590-
timeout=request_args.get("timeout", None),
1626+
blueprint_id=blueprint_id,
1627+
blueprint_name=blueprint_name,
1628+
code_mounts=code_mounts,
1629+
entrypoint=entrypoint,
1630+
environment_variables=environment_variables,
1631+
file_mounts=file_mounts,
1632+
launch_parameters=launch_parameters,
1633+
metadata=metadata,
1634+
name=name,
1635+
repo_connection_id=repo_connection_id,
1636+
secrets=secrets,
1637+
snapshot_id=snapshot_id,
1638+
extra_headers=extra_headers,
1639+
extra_query=extra_query,
1640+
extra_body=extra_body,
1641+
timeout=timeout,
1642+
idempotency_key=idempotency_key,
15911643
)
15921644

15931645
return await self.await_running(
15941646
devbox.id,
1595-
polling_config=request_args.get("polling_config", None),
1647+
polling_config=polling_config,
15961648
)
15971649

15981650
async def await_running(

0 commit comments

Comments
 (0)