-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path_client_registry.py
More file actions
136 lines (126 loc) · 5.31 KB
/
_client_registry.py
File metadata and controls
136 lines (126 loc) · 5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from apify_client._resource_clients import (
ActorClient,
ActorClientAsync,
ActorCollectionClient,
ActorCollectionClientAsync,
ActorEnvVarClient,
ActorEnvVarClientAsync,
ActorEnvVarCollectionClient,
ActorEnvVarCollectionClientAsync,
ActorVersionClient,
ActorVersionClientAsync,
ActorVersionCollectionClient,
ActorVersionCollectionClientAsync,
BuildClient,
BuildClientAsync,
BuildCollectionClient,
BuildCollectionClientAsync,
DatasetClient,
DatasetClientAsync,
DatasetCollectionClient,
DatasetCollectionClientAsync,
KeyValueStoreClient,
KeyValueStoreClientAsync,
KeyValueStoreCollectionClient,
KeyValueStoreCollectionClientAsync,
LogClient,
LogClientAsync,
RequestQueueClient,
RequestQueueClientAsync,
RequestQueueCollectionClient,
RequestQueueCollectionClientAsync,
RunClient,
RunClientAsync,
RunCollectionClient,
RunCollectionClientAsync,
ScheduleClient,
ScheduleClientAsync,
ScheduleCollectionClient,
ScheduleCollectionClientAsync,
StoreCollectionClient,
StoreCollectionClientAsync,
TaskClient,
TaskClientAsync,
TaskCollectionClient,
TaskCollectionClientAsync,
UserClient,
UserClientAsync,
WebhookClient,
WebhookClientAsync,
WebhookCollectionClient,
WebhookCollectionClientAsync,
WebhookDispatchClient,
WebhookDispatchClientAsync,
WebhookDispatchCollectionClient,
WebhookDispatchCollectionClientAsync,
)
@dataclass
class ClientRegistry:
"""Bundle of all sync client classes for dependency injection.
This config object is passed to the resource clients to avoid circular dependencies. Each resource client
receives this config and can instantiate other clients as needed.
"""
actor_client: type[ActorClient]
actor_collection_client: type[ActorCollectionClient]
actor_env_var_client: type[ActorEnvVarClient]
actor_env_var_collection_client: type[ActorEnvVarCollectionClient]
actor_version_client: type[ActorVersionClient]
actor_version_collection_client: type[ActorVersionCollectionClient]
build_client: type[BuildClient]
build_collection_client: type[BuildCollectionClient]
dataset_client: type[DatasetClient]
dataset_collection_client: type[DatasetCollectionClient]
key_value_store_client: type[KeyValueStoreClient]
key_value_store_collection_client: type[KeyValueStoreCollectionClient]
log_client: type[LogClient]
request_queue_client: type[RequestQueueClient]
request_queue_collection_client: type[RequestQueueCollectionClient]
run_client: type[RunClient]
run_collection_client: type[RunCollectionClient]
schedule_client: type[ScheduleClient]
schedule_collection_client: type[ScheduleCollectionClient]
store_collection_client: type[StoreCollectionClient]
task_client: type[TaskClient]
task_collection_client: type[TaskCollectionClient]
user_client: type[UserClient]
webhook_client: type[WebhookClient]
webhook_collection_client: type[WebhookCollectionClient]
webhook_dispatch_client: type[WebhookDispatchClient]
webhook_dispatch_collection_client: type[WebhookDispatchCollectionClient]
@dataclass
class ClientRegistryAsync:
"""Bundle of all async client classes for dependency injection.
This config object is passed to the resource clients to avoid circular dependencies. Each resource client
receives this config and can instantiate other clients as needed.
"""
actor_client: type[ActorClientAsync]
actor_collection_client: type[ActorCollectionClientAsync]
actor_env_var_client: type[ActorEnvVarClientAsync]
actor_env_var_collection_client: type[ActorEnvVarCollectionClientAsync]
actor_version_client: type[ActorVersionClientAsync]
actor_version_collection_client: type[ActorVersionCollectionClientAsync]
build_client: type[BuildClientAsync]
build_collection_client: type[BuildCollectionClientAsync]
dataset_client: type[DatasetClientAsync]
dataset_collection_client: type[DatasetCollectionClientAsync]
key_value_store_client: type[KeyValueStoreClientAsync]
key_value_store_collection_client: type[KeyValueStoreCollectionClientAsync]
log_client: type[LogClientAsync]
request_queue_client: type[RequestQueueClientAsync]
request_queue_collection_client: type[RequestQueueCollectionClientAsync]
run_client: type[RunClientAsync]
run_collection_client: type[RunCollectionClientAsync]
schedule_client: type[ScheduleClientAsync]
schedule_collection_client: type[ScheduleCollectionClientAsync]
store_collection_client: type[StoreCollectionClientAsync]
task_client: type[TaskClientAsync]
task_collection_client: type[TaskCollectionClientAsync]
user_client: type[UserClientAsync]
webhook_client: type[WebhookClientAsync]
webhook_collection_client: type[WebhookCollectionClientAsync]
webhook_dispatch_client: type[WebhookDispatchClientAsync]
webhook_dispatch_collection_client: type[WebhookDispatchCollectionClientAsync]