From fe0e3e28decf812e3489fc0107e716208ce361de Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Thu, 12 Jun 2025 14:15:38 +0200 Subject: [PATCH 1/6] feature(api): added new param sortBy for the get acts/, apify-core: #20997 --- src/apify_client/clients/resource_clients/actor_collection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 7fc2559d..1a977f11 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -26,6 +26,7 @@ def list( limit: int | None = None, offset: int | None = None, desc: bool | None = None, + sort_by: str | None = None, ) -> ListPage[dict]: """List the Actors the user has created or used. @@ -40,7 +41,7 @@ def list( Returns: The list of available Actors matching the specified filters. """ - return self._list(my=my, limit=limit, offset=offset, desc=desc) + return self._list(my=my, limit=limit, offset=offset, desc=desc, sortBy=sort_by) def create( self, From e7051f9cefcb95247d27b896a290d1260cff44f3 Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Fri, 13 Jun 2025 12:54:32 +0200 Subject: [PATCH 2/6] better types --- .../clients/resource_clients/actor_collection.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 1a977f11..a73349f5 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Literal from apify_shared.utils import filter_out_none_values_recursively, ignore_docs @@ -26,7 +26,7 @@ def list( limit: int | None = None, offset: int | None = None, desc: bool | None = None, - sort_by: str | None = None, + sort_by: Literal["createdAt", "lastRunStartedAt"] | None = "createdAt", ) -> ListPage[dict]: """List the Actors the user has created or used. @@ -37,6 +37,7 @@ def list( limit: How many Actors to list. offset: What Actor to include as first when retrieving the list. desc: Whether to sort the Actors in descending order based on their creation date. + sort_by: Field to sort the results by. Allowed values are "createdAt" and "lastRunStartedAt". Returns: The list of available Actors matching the specified filters. From 946d0d6bca7ee07110c4923a56c195454f2c4418 Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Mon, 16 Jun 2025 15:00:45 +0200 Subject: [PATCH 3/6] async list sortBy --- src/apify_client/clients/resource_clients/actor_collection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index a73349f5..0bf408ff 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -152,6 +152,7 @@ async def list( limit: int | None = None, offset: int | None = None, desc: bool | None = None, + sort_by: Literal["createdAt", "lastRunStartedAt"] | None = "createdAt", ) -> ListPage[dict]: """List the Actors the user has created or used. @@ -166,7 +167,7 @@ async def list( Returns: The list of available Actors matching the specified filters. """ - return await self._list(my=my, limit=limit, offset=offset, desc=desc) + return await self._list(my=my, limit=limit, offset=offset, desc=desc, sortBy=sort_by) async def create( self, From ae42bbe1ef468194fc2adc6460fb20f5f23e03de Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Mon, 16 Jun 2025 15:07:30 +0200 Subject: [PATCH 4/6] added docs for async list Actors function --- src/apify_client/clients/resource_clients/actor_collection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 0bf408ff..102e4796 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -163,6 +163,7 @@ async def list( limit: How many Actors to list. offset: What Actor to include as first when retrieving the list. desc: Whether to sort the Actors in descending order based on their creation date. + sort_by: Field to sort the results by. Allowed values are "createdAt" and "lastRunStartedAt". Returns: The list of available Actors matching the specified filters. From c2ed51ede397d27d15827677b40448fdd14c9fec Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Mon, 16 Jun 2025 15:27:49 +0200 Subject: [PATCH 5/6] Pipeline: formatting fixes --- src/apify_client/clients/resource_clients/actor_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 102e4796..91e08e64 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -26,7 +26,7 @@ def list( limit: int | None = None, offset: int | None = None, desc: bool | None = None, - sort_by: Literal["createdAt", "lastRunStartedAt"] | None = "createdAt", + sort_by: Literal['createdAt', 'lastRunStartedAt'] | None = 'createdAt', ) -> ListPage[dict]: """List the Actors the user has created or used. @@ -152,7 +152,7 @@ async def list( limit: int | None = None, offset: int | None = None, desc: bool | None = None, - sort_by: Literal["createdAt", "lastRunStartedAt"] | None = "createdAt", + sort_by: Literal['createdAt', 'lastRunStartedAt'] | None = 'createdAt', ) -> ListPage[dict]: """List the Actors the user has created or used. From bad509a02d35a74357644e228e047ee9658e8b37 Mon Sep 17 00:00:00 2001 From: Gokdeniz Kaymak Date: Tue, 17 Jun 2025 11:22:41 +0200 Subject: [PATCH 6/6] Code Review: Removed redundant docs --- src/apify_client/clients/resource_clients/actor_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 91e08e64..accd0d24 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -37,7 +37,7 @@ def list( limit: How many Actors to list. offset: What Actor to include as first when retrieving the list. desc: Whether to sort the Actors in descending order based on their creation date. - sort_by: Field to sort the results by. Allowed values are "createdAt" and "lastRunStartedAt". + sort_by: Field to sort the results by. Returns: The list of available Actors matching the specified filters. @@ -163,7 +163,7 @@ async def list( limit: How many Actors to list. offset: What Actor to include as first when retrieving the list. desc: Whether to sort the Actors in descending order based on their creation date. - sort_by: Field to sort the results by. Allowed values are "createdAt" and "lastRunStartedAt". + sort_by: Field to sort the results by. Returns: The list of available Actors matching the specified filters.