Skip to content

Commit f818b95

Browse files
authored
feat: add get default build method (#385)
This PR adds `default_build()` method to Actor client
1 parent 3059a17 commit f818b95

File tree

1 file changed

+52
-0
lines changed
  • src/apify_client/clients/resource_clients

1 file changed

+52
-0
lines changed

src/apify_client/clients/resource_clients/actor.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,30 @@ def runs(self) -> RunCollectionClient:
381381
"""Retrieve a client for the runs of this Actor."""
382382
return RunCollectionClient(**self._sub_resource_init_options(resource_path='runs'))
383383

384+
async def default_build(
385+
self,
386+
*,
387+
wait_for_finish: int | None = None,
388+
) -> dict:
389+
"""Retrieve Actor's default build.
390+
391+
https://docs.apify.com/api/v2/act-build-default-get
392+
393+
Args:
394+
wait_for_finish: The maximum number of seconds the server waits for the build to finish before returning.
395+
By default it is 0, the maximum value is 60.
396+
397+
Returns:
398+
The build object.
399+
"""
400+
request_params = self._params(
401+
waitForFinish=wait_for_finish,
402+
)
403+
404+
response = self.http_client.call(url=self._url('builds/default'), method='GET', params=request_params)
405+
406+
return parse_date_fields(pluck_data(response.json()))
407+
384408
def last_run(
385409
self,
386410
*,
@@ -718,6 +742,34 @@ def runs(self) -> RunCollectionClientAsync:
718742
"""Retrieve a client for the runs of this Actor."""
719743
return RunCollectionClientAsync(**self._sub_resource_init_options(resource_path='runs'))
720744

745+
async def default_build(
746+
self,
747+
*,
748+
wait_for_finish: int | None = None,
749+
) -> dict:
750+
"""Retrieve Actor's default build.
751+
752+
https://docs.apify.com/api/v2/act-build-default-get
753+
754+
Args:
755+
wait_for_finish: The maximum number of seconds the server waits for the build to finish before returning.
756+
By default it is 0, the maximum value is 60.
757+
758+
Returns:
759+
The build object.
760+
"""
761+
request_params = self._params(
762+
waitForFinish=wait_for_finish,
763+
)
764+
765+
response = await self.http_client.call(
766+
url=self._url('builds/default'),
767+
method='GET',
768+
params=request_params,
769+
)
770+
771+
return parse_date_fields(pluck_data(response.json()))
772+
721773
def last_run(
722774
self,
723775
*,

0 commit comments

Comments
 (0)