Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/apify_client/_resource_clients/dataset_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from typing import TYPE_CHECKING, Any

from apify_client._docs import docs_group
from apify_client._models import Dataset, DatasetResponse, ListOfDatasets, ListOfDatasetsResponse
from apify_client._models import Dataset, DatasetResponse, ListOfDatasets, ListOfDatasetsResponse, StorageOwnership
from apify_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
from apify_client._types import StorageOwnership, Timeout
from apify_client._types import Timeout


@docs_group('Resource clients')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
KeyValueStoreResponse,
ListOfKeyValueStores,
ListOfKeyValueStoresResponse,
StorageOwnership,
)
from apify_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
from apify_client._types import StorageOwnership, Timeout
from apify_client._types import Timeout


@docs_group('Resource clients')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
ListOfRequestQueuesResponse,
RequestQueue,
RequestQueueResponse,
StorageOwnership,
)
from apify_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
from apify_client._types import StorageOwnership, Timeout
from apify_client._types import Timeout


@docs_group('Resource clients')
Expand Down
3 changes: 0 additions & 3 deletions src/apify_client/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

from apify_client._models import ActorJobStatus, WebhookCreate # noqa: TC001

StorageOwnership = Literal['ownedByMe', 'sharedWithMe']
"""Filter for storage listing methods to return only storages owned by the user or shared with the user."""

Timeout = timedelta | Literal['no_timeout', 'short', 'medium', 'long']
"""Type for the `timeout` parameter on resource client methods.

Expand Down
13 changes: 7 additions & 6 deletions tests/unit/test_storage_collection_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from werkzeug.wrappers import Response

from apify_client import ApifyClient, ApifyClientAsync
from apify_client._models import StorageOwnership

if TYPE_CHECKING:
from collections.abc import Callable
Expand Down Expand Up @@ -47,7 +48,7 @@ def test_dataset_collection_list_ownership_sync(httpserver: HTTPServer, client_u
httpserver.expect_oneshot_request('/v2/datasets', method='GET').respond_with_handler(_make_handler(captured))

client = ApifyClient(token='placeholder_token', **client_urls)
result = client.datasets().list(ownership='ownedByMe')
result = client.datasets().list(ownership=StorageOwnership.OWNED_BY_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'ownedByMe'
Expand All @@ -58,7 +59,7 @@ async def test_dataset_collection_list_ownership_async(httpserver: HTTPServer, c
httpserver.expect_oneshot_request('/v2/datasets', method='GET').respond_with_handler(_make_handler(captured))

client = ApifyClientAsync(token='placeholder_token', **client_urls)
result = await client.datasets().list(ownership='sharedWithMe')
result = await client.datasets().list(ownership=StorageOwnership.SHARED_WITH_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'sharedWithMe'
Expand All @@ -71,7 +72,7 @@ def test_key_value_store_collection_list_ownership_sync(httpserver: HTTPServer,
)

client = ApifyClient(token='placeholder_token', **client_urls)
result = client.key_value_stores().list(ownership='ownedByMe')
result = client.key_value_stores().list(ownership=StorageOwnership.OWNED_BY_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'ownedByMe'
Expand All @@ -84,7 +85,7 @@ async def test_key_value_store_collection_list_ownership_async(httpserver: HTTPS
)

client = ApifyClientAsync(token='placeholder_token', **client_urls)
result = await client.key_value_stores().list(ownership='sharedWithMe')
result = await client.key_value_stores().list(ownership=StorageOwnership.SHARED_WITH_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'sharedWithMe'
Expand All @@ -95,7 +96,7 @@ def test_request_queue_collection_list_ownership_sync(httpserver: HTTPServer, cl
httpserver.expect_oneshot_request('/v2/request-queues', method='GET').respond_with_handler(_make_handler(captured))

client = ApifyClient(token='placeholder_token', **client_urls)
result = client.request_queues().list(ownership='ownedByMe')
result = client.request_queues().list(ownership=StorageOwnership.OWNED_BY_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'ownedByMe'
Expand All @@ -106,7 +107,7 @@ async def test_request_queue_collection_list_ownership_async(httpserver: HTTPSer
httpserver.expect_oneshot_request('/v2/request-queues', method='GET').respond_with_handler(_make_handler(captured))

client = ApifyClientAsync(token='placeholder_token', **client_urls)
result = await client.request_queues().list(ownership='sharedWithMe')
result = await client.request_queues().list(ownership=StorageOwnership.SHARED_WITH_ME)

assert result.total == 0
assert captured['args']['ownership'] == 'sharedWithMe'