Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/apify_client/clients/resource_clients/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
ActorVersionCollectionClient,
ActorVersionCollectionClientAsync,
)
from apify_client.clients.resource_clients.build import BuildClient, BuildClientAsync
from apify_client.clients.resource_clients.build_collection import BuildCollectionClient, BuildCollectionClientAsync
from apify_client.clients.resource_clients.run import RunClient, RunClientAsync
from apify_client.clients.resource_clients.run_collection import RunCollectionClient, RunCollectionClientAsync
Expand Down Expand Up @@ -385,7 +386,7 @@ async def default_build(
self,
*,
wait_for_finish: int | None = None,
) -> dict:
) -> BuildClient:
"""Retrieve Actor's default build.

https://docs.apify.com/api/v2/act-build-default-get
Expand All @@ -395,15 +396,21 @@ async def default_build(
By default it is 0, the maximum value is 60.

Returns:
The build object.
The resource client for the default build of this Actor.
"""
request_params = self._params(
waitForFinish=wait_for_finish,
)

response = self.http_client.call(url=self._url('builds/default'), method='GET', params=request_params)
data = pluck_data(response.json())

return parse_date_fields(pluck_data(response.json()))
return BuildClient(
base_url=self.base_url,
http_client=self.http_client,
root_client=self.root_client,
resource_id=data['id'],
)

def last_run(
self,
Expand Down Expand Up @@ -746,7 +753,7 @@ async def default_build(
self,
*,
wait_for_finish: int | None = None,
) -> dict:
) -> BuildClientAsync:
"""Retrieve Actor's default build.

https://docs.apify.com/api/v2/act-build-default-get
Expand All @@ -756,7 +763,7 @@ async def default_build(
By default it is 0, the maximum value is 60.

Returns:
The build object.
The resource client for the default build of this Actor.
"""
request_params = self._params(
waitForFinish=wait_for_finish,
Expand All @@ -767,8 +774,14 @@ async def default_build(
method='GET',
params=request_params,
)
data = pluck_data(response.json())

return parse_date_fields(pluck_data(response.json()))
return BuildClientAsync(
base_url=self.base_url,
http_client=self.http_client,
root_client=self.root_client,
resource_id=data['id'],
)

def last_run(
self,
Expand Down