|
7 | 7 | from apify_client._resource_clients import ( |
8 | 8 | ActorClient, |
9 | 9 | ActorClientAsync, |
| 10 | + ActorCollectionClient, |
| 11 | + ActorCollectionClientAsync, |
10 | 12 | ActorEnvVarClient, |
11 | 13 | ActorEnvVarClientAsync, |
12 | 14 | ActorEnvVarCollectionClient, |
|
21 | 23 | BuildCollectionClientAsync, |
22 | 24 | DatasetClient, |
23 | 25 | DatasetClientAsync, |
| 26 | + DatasetCollectionClient, |
| 27 | + DatasetCollectionClientAsync, |
24 | 28 | KeyValueStoreClient, |
25 | 29 | KeyValueStoreClientAsync, |
| 30 | + KeyValueStoreCollectionClient, |
| 31 | + KeyValueStoreCollectionClientAsync, |
26 | 32 | LogClient, |
27 | 33 | LogClientAsync, |
28 | 34 | RequestQueueClient, |
29 | 35 | RequestQueueClientAsync, |
| 36 | + RequestQueueCollectionClient, |
| 37 | + RequestQueueCollectionClientAsync, |
30 | 38 | RunClient, |
31 | 39 | RunClientAsync, |
32 | 40 | RunCollectionClient, |
33 | 41 | RunCollectionClientAsync, |
| 42 | + ScheduleClient, |
| 43 | + ScheduleClientAsync, |
| 44 | + ScheduleCollectionClient, |
| 45 | + ScheduleCollectionClientAsync, |
| 46 | + StatusMessageWatcherAsync, |
| 47 | + StatusMessageWatcherSync, |
| 48 | + StoreCollectionClient, |
| 49 | + StoreCollectionClientAsync, |
| 50 | + StreamedLogAsync, |
| 51 | + StreamedLogSync, |
| 52 | + TaskClient, |
| 53 | + TaskClientAsync, |
| 54 | + TaskCollectionClient, |
| 55 | + TaskCollectionClientAsync, |
| 56 | + UserClient, |
| 57 | + UserClientAsync, |
34 | 58 | WebhookClient, |
35 | 59 | WebhookClientAsync, |
36 | 60 | WebhookCollectionClient, |
37 | 61 | WebhookCollectionClientAsync, |
| 62 | + WebhookDispatchClient, |
| 63 | + WebhookDispatchClientAsync, |
38 | 64 | WebhookDispatchCollectionClient, |
39 | 65 | WebhookDispatchCollectionClientAsync, |
40 | 66 | ) |
|
44 | 70 | class ClientRegistry: |
45 | 71 | """Bundle of all sync client classes for dependency injection. |
46 | 72 |
|
47 | | - This config object is passed through the client hierarchy to avoid |
48 | | - parameter explosion when clients need to create other clients. |
49 | | - Each resource client receives this config and can instantiate other |
50 | | - clients as needed without knowing about transitive dependencies. |
| 73 | + This config object is passed to the resource clients to avoid circular dependencies. Each resource client |
| 74 | + receives this config and can instantiate other clients as needed. |
51 | 75 | """ |
52 | 76 |
|
53 | | - # Actor-related |
54 | 77 | actor_client: type[ActorClient] |
55 | | - actor_version_client: type[ActorVersionClient] |
56 | | - actor_version_collection_client: type[ActorVersionCollectionClient] |
| 78 | + actor_collection_client: type[ActorCollectionClient] |
57 | 79 | actor_env_var_client: type[ActorEnvVarClient] |
58 | 80 | actor_env_var_collection_client: type[ActorEnvVarCollectionClient] |
59 | | - |
60 | | - # Build-related |
| 81 | + actor_version_client: type[ActorVersionClient] |
| 82 | + actor_version_collection_client: type[ActorVersionCollectionClient] |
61 | 83 | build_client: type[BuildClient] |
62 | 84 | build_collection_client: type[BuildCollectionClient] |
63 | | - |
64 | | - # Run-related |
65 | | - run_client: type[RunClient] |
66 | | - run_collection_client: type[RunCollectionClient] |
67 | | - |
68 | | - # Storage-related |
69 | 85 | dataset_client: type[DatasetClient] |
| 86 | + dataset_collection_client: type[DatasetCollectionClient] |
70 | 87 | key_value_store_client: type[KeyValueStoreClient] |
| 88 | + key_value_store_collection_client: type[KeyValueStoreCollectionClient] |
| 89 | + log_client: type[LogClient] |
| 90 | + status_message_watcher: type[StatusMessageWatcherSync] |
| 91 | + streamed_log: type[StreamedLogSync] |
71 | 92 | request_queue_client: type[RequestQueueClient] |
72 | | - |
73 | | - # Webhook-related |
| 93 | + request_queue_collection_client: type[RequestQueueCollectionClient] |
| 94 | + run_client: type[RunClient] |
| 95 | + run_collection_client: type[RunCollectionClient] |
| 96 | + schedule_client: type[ScheduleClient] |
| 97 | + schedule_collection_client: type[ScheduleCollectionClient] |
| 98 | + store_collection_client: type[StoreCollectionClient] |
| 99 | + task_client: type[TaskClient] |
| 100 | + task_collection_client: type[TaskCollectionClient] |
| 101 | + user_client: type[UserClient] |
74 | 102 | webhook_client: type[WebhookClient] |
75 | 103 | webhook_collection_client: type[WebhookCollectionClient] |
| 104 | + webhook_dispatch_client: type[WebhookDispatchClient] |
76 | 105 | webhook_dispatch_collection_client: type[WebhookDispatchCollectionClient] |
77 | 106 |
|
78 | | - # Utilities |
79 | | - log_client: type[LogClient] |
80 | | - |
81 | 107 |
|
82 | 108 | @dataclass |
83 | 109 | class ClientRegistryAsync: |
84 | 110 | """Bundle of all async client classes for dependency injection. |
85 | 111 |
|
86 | | - Async version of ClientRegistry for use with ApifyClientAsync. |
| 112 | + This config object is passed to the resource clients to avoid circular dependencies. Each resource client |
| 113 | + receives this config and can instantiate other clients as needed. |
87 | 114 | """ |
88 | 115 |
|
89 | | - # Actor-related |
90 | 116 | actor_client: type[ActorClientAsync] |
91 | | - actor_version_client: type[ActorVersionClientAsync] |
92 | | - actor_version_collection_client: type[ActorVersionCollectionClientAsync] |
| 117 | + actor_collection_client: type[ActorCollectionClientAsync] |
93 | 118 | actor_env_var_client: type[ActorEnvVarClientAsync] |
94 | 119 | actor_env_var_collection_client: type[ActorEnvVarCollectionClientAsync] |
95 | | - |
96 | | - # Build-related |
| 120 | + actor_version_client: type[ActorVersionClientAsync] |
| 121 | + actor_version_collection_client: type[ActorVersionCollectionClientAsync] |
97 | 122 | build_client: type[BuildClientAsync] |
98 | 123 | build_collection_client: type[BuildCollectionClientAsync] |
99 | | - |
100 | | - # Run-related |
101 | | - run_client: type[RunClientAsync] |
102 | | - run_collection_client: type[RunCollectionClientAsync] |
103 | | - |
104 | | - # Storage-related |
105 | 124 | dataset_client: type[DatasetClientAsync] |
| 125 | + dataset_collection_client: type[DatasetCollectionClientAsync] |
106 | 126 | key_value_store_client: type[KeyValueStoreClientAsync] |
| 127 | + key_value_store_collection_client: type[KeyValueStoreCollectionClientAsync] |
| 128 | + log_client: type[LogClientAsync] |
| 129 | + status_message_watcher: type[StatusMessageWatcherAsync] |
| 130 | + streamed_log: type[StreamedLogAsync] |
107 | 131 | request_queue_client: type[RequestQueueClientAsync] |
108 | | - |
109 | | - # Webhook-related |
| 132 | + request_queue_collection_client: type[RequestQueueCollectionClientAsync] |
| 133 | + run_client: type[RunClientAsync] |
| 134 | + run_collection_client: type[RunCollectionClientAsync] |
| 135 | + schedule_client: type[ScheduleClientAsync] |
| 136 | + schedule_collection_client: type[ScheduleCollectionClientAsync] |
| 137 | + store_collection_client: type[StoreCollectionClientAsync] |
| 138 | + task_client: type[TaskClientAsync] |
| 139 | + task_collection_client: type[TaskCollectionClientAsync] |
| 140 | + user_client: type[UserClientAsync] |
110 | 141 | webhook_client: type[WebhookClientAsync] |
111 | 142 | webhook_collection_client: type[WebhookCollectionClientAsync] |
| 143 | + webhook_dispatch_client: type[WebhookDispatchClientAsync] |
112 | 144 | webhook_dispatch_collection_client: type[WebhookDispatchCollectionClientAsync] |
113 | | - |
114 | | - # Utilities |
115 | | - log_client: type[LogClientAsync] |
|
0 commit comments