linkedapi 1.2.0__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {linkedapi-1.2.0 → linkedapi-1.3.0}/PKG-INFO +1 -1
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/__init__.py +3 -1
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/client.py +28 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/__init__.py +2 -0
- linkedapi-1.3.0/linkedapi/mappers/send_message.py +48 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/__init__.py +2 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/send_message.py +2 -2
- linkedapi-1.3.0/linkedapi/operations/sync_network.py +12 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/__init__.py +16 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/message.py +5 -0
- linkedapi-1.3.0/linkedapi/types/network.py +28 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/webhooks.py +25 -1
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/webhooks/parse.py +3 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/pyproject.toml +1 -1
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_operations.py +2 -1
- {linkedapi-1.2.0 → linkedapi-1.3.0}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/.gitignore +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/LICENSE +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/README.md +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/config.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/errors.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/base.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/accept_connection_request.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/ignore_connection_request.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/manage_conversation.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_manage_conversation.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_connection_requests.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/py.typed +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/account.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/accounts.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/subscription.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/base.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/company.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/connection.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/params.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/person.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/post.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/conftest.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_admin.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_direct_methods.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_errors.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_http_client.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_mappers.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_models.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_polling.py +0 -0
- {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_webhooks.py +0 -0
|
@@ -68,13 +68,14 @@ from linkedapi.operations import (
|
|
|
68
68
|
SendMessage,
|
|
69
69
|
SyncConversation,
|
|
70
70
|
SyncInbox,
|
|
71
|
+
SyncNetwork,
|
|
71
72
|
WithdrawConnectionRequest,
|
|
72
73
|
)
|
|
73
74
|
from linkedapi.types import * # noqa: F403
|
|
74
75
|
from linkedapi.types import __all__ as _types_all
|
|
75
76
|
from linkedapi.webhooks import parse_webhook_event
|
|
76
77
|
|
|
77
|
-
__version__ = "1.2.
|
|
78
|
+
__version__ = "1.2.1"
|
|
78
79
|
PredefinedOperation = Operation
|
|
79
80
|
|
|
80
81
|
__all__ = [
|
|
@@ -142,6 +143,7 @@ __all__ = [
|
|
|
142
143
|
"SimpleWorkflowMapper",
|
|
143
144
|
"SyncConversation",
|
|
144
145
|
"SyncInbox",
|
|
146
|
+
"SyncNetwork",
|
|
145
147
|
"ThenWorkflowMapper",
|
|
146
148
|
"VoidWorkflowMapper",
|
|
147
149
|
"WithdrawConnectionRequest",
|
|
@@ -41,6 +41,7 @@ from linkedapi.operations import (
|
|
|
41
41
|
SendMessage,
|
|
42
42
|
SyncConversation,
|
|
43
43
|
SyncInbox,
|
|
44
|
+
SyncNetwork,
|
|
44
45
|
WithdrawConnectionRequest,
|
|
45
46
|
)
|
|
46
47
|
from linkedapi.types import AccountInfo, LinkedApiActionError, serialize_value
|
|
@@ -50,6 +51,7 @@ from linkedapi.types.message import (
|
|
|
50
51
|
InboxMessage,
|
|
51
52
|
InboxPollRequest,
|
|
52
53
|
)
|
|
54
|
+
from linkedapi.types.network import NetworkEvent, NetworkPollRequest
|
|
53
55
|
from linkedapi.types.statistics import ApiUsageAction, ApiUsageParams
|
|
54
56
|
|
|
55
57
|
|
|
@@ -67,6 +69,7 @@ class LinkedApi:
|
|
|
67
69
|
self.send_message = SendMessage(self.http_client)
|
|
68
70
|
self.sync_conversation = SyncConversation(self.http_client)
|
|
69
71
|
self.sync_inbox = SyncInbox(self.http_client)
|
|
72
|
+
self.sync_network = SyncNetwork(self.http_client)
|
|
70
73
|
self.manage_conversation = ManageConversation(self.http_client)
|
|
71
74
|
self.check_connection_status = CheckConnectionStatus(self.http_client)
|
|
72
75
|
self.send_connection_request = SendConnectionRequest(self.http_client)
|
|
@@ -103,6 +106,7 @@ class LinkedApi:
|
|
|
103
106
|
self.send_message,
|
|
104
107
|
self.sync_conversation,
|
|
105
108
|
self.sync_inbox,
|
|
109
|
+
self.sync_network,
|
|
106
110
|
self.manage_conversation,
|
|
107
111
|
self.check_connection_status,
|
|
108
112
|
self.send_connection_request,
|
|
@@ -189,6 +193,30 @@ class LinkedApi:
|
|
|
189
193
|
],
|
|
190
194
|
)
|
|
191
195
|
|
|
196
|
+
def poll_network(
|
|
197
|
+
self,
|
|
198
|
+
request: NetworkPollRequest | None = None,
|
|
199
|
+
) -> MappedResponse[list[NetworkEvent]]:
|
|
200
|
+
"""Read the monitored network connection events, newest events first."""
|
|
201
|
+
|
|
202
|
+
payload = serialize_value(request) if request is not None else {}
|
|
203
|
+
response = self.http_client.post("/network/poll", payload)
|
|
204
|
+
if response.success and response.result is not None:
|
|
205
|
+
events = response.result.get("events", [])
|
|
206
|
+
return MappedResponse(
|
|
207
|
+
data=[NetworkEvent.model_validate(item) for item in events],
|
|
208
|
+
errors=[],
|
|
209
|
+
)
|
|
210
|
+
return MappedResponse(
|
|
211
|
+
data=None,
|
|
212
|
+
errors=[
|
|
213
|
+
LinkedApiActionError(
|
|
214
|
+
type=response.error.type if response.error else "",
|
|
215
|
+
message=response.error.message if response.error else "",
|
|
216
|
+
),
|
|
217
|
+
],
|
|
218
|
+
)
|
|
219
|
+
|
|
192
220
|
def get_account_info(self) -> MappedResponse[AccountInfo]:
|
|
193
221
|
"""Retrieve basic information about the current LinkedIn account."""
|
|
194
222
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from linkedapi.mappers.array import ArrayWorkflowMapper
|
|
2
2
|
from linkedapi.mappers.base import BaseMapper, MappedResponse
|
|
3
|
+
from linkedapi.mappers.send_message import SendMessageMapper
|
|
3
4
|
from linkedapi.mappers.simple import SimpleWorkflowMapper
|
|
4
5
|
from linkedapi.mappers.then import ActionConfig, ResponseMapping, ThenWorkflowMapper
|
|
5
6
|
from linkedapi.mappers.void import VoidWorkflowMapper
|
|
@@ -10,6 +11,7 @@ __all__ = [
|
|
|
10
11
|
"BaseMapper",
|
|
11
12
|
"MappedResponse",
|
|
12
13
|
"ResponseMapping",
|
|
14
|
+
"SendMessageMapper",
|
|
13
15
|
"SimpleWorkflowMapper",
|
|
14
16
|
"ThenWorkflowMapper",
|
|
15
17
|
"VoidWorkflowMapper",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from linkedapi.mappers.base import (
|
|
6
|
+
BaseMapper,
|
|
7
|
+
MappedResponse,
|
|
8
|
+
as_action_dict,
|
|
9
|
+
collect_action_errors,
|
|
10
|
+
)
|
|
11
|
+
from linkedapi.types import WorkflowCompletion, WorkflowDefinition, serialize_model
|
|
12
|
+
from linkedapi.types.message import SendMessageParams
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SendMessageMapper(BaseMapper[SendMessageParams, None]):
|
|
16
|
+
def map_request(self, params: SendMessageParams | None = None) -> WorkflowDefinition:
|
|
17
|
+
serialized = serialize_model(params)
|
|
18
|
+
manage_conversation = serialized.pop("manageConversation", None)
|
|
19
|
+
definition: dict[str, Any] = {"actionType": "st.sendMessage", **serialized}
|
|
20
|
+
# The child st.manageConversation acts on the conversation this message was
|
|
21
|
+
# sent into, so it carries only `operation` (no threadId — Core rejects a
|
|
22
|
+
# threadId on a child manageConversation). Guard on `operation` so an empty
|
|
23
|
+
# passthrough (e.g. Make sending {"operation": ""}) is ignored.
|
|
24
|
+
if manage_conversation and manage_conversation.get("operation"):
|
|
25
|
+
definition["then"] = {
|
|
26
|
+
"actionType": "st.manageConversation",
|
|
27
|
+
"operation": manage_conversation["operation"],
|
|
28
|
+
}
|
|
29
|
+
return definition
|
|
30
|
+
|
|
31
|
+
def map_response(self, completion: WorkflowCompletion) -> MappedResponse[None]:
|
|
32
|
+
if isinstance(completion, list):
|
|
33
|
+
errors = collect_action_errors(
|
|
34
|
+
[as_action_dict(action).get("error") for action in completion]
|
|
35
|
+
)
|
|
36
|
+
return MappedResponse(data=None, errors=errors)
|
|
37
|
+
|
|
38
|
+
action = as_action_dict(completion)
|
|
39
|
+
raw_errors: list[Any] = [action.get("error")]
|
|
40
|
+
|
|
41
|
+
single_data = action.get("data")
|
|
42
|
+
if single_data is not None:
|
|
43
|
+
then_actions = as_action_dict(single_data).get("then")
|
|
44
|
+
if then_actions:
|
|
45
|
+
child_actions = then_actions if isinstance(then_actions, list) else [then_actions]
|
|
46
|
+
raw_errors.extend(as_action_dict(child).get("error") for child in child_actions)
|
|
47
|
+
|
|
48
|
+
return MappedResponse(data=None, errors=collect_action_errors(raw_errors))
|
|
@@ -31,6 +31,7 @@ from linkedapi.operations.send_connection_request import SendConnectionRequest
|
|
|
31
31
|
from linkedapi.operations.send_message import SendMessage
|
|
32
32
|
from linkedapi.operations.sync_conversation import SyncConversation
|
|
33
33
|
from linkedapi.operations.sync_inbox import SyncInbox
|
|
34
|
+
from linkedapi.operations.sync_network import SyncNetwork
|
|
34
35
|
from linkedapi.operations.withdraw_connection_request import WithdrawConnectionRequest
|
|
35
36
|
|
|
36
37
|
__all__ = [
|
|
@@ -73,5 +74,6 @@ __all__ = [
|
|
|
73
74
|
"SendMessage",
|
|
74
75
|
"SyncConversation",
|
|
75
76
|
"SyncInbox",
|
|
77
|
+
"SyncNetwork",
|
|
76
78
|
"WithdrawConnectionRequest",
|
|
77
79
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from linkedapi.core import Operation
|
|
4
|
-
from linkedapi.mappers import
|
|
4
|
+
from linkedapi.mappers import SendMessageMapper
|
|
5
5
|
from linkedapi.types import SendMessageParams
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,4 +9,4 @@ class SendMessage(Operation[SendMessageParams, None]):
|
|
|
9
9
|
"""Send a standard LinkedIn message."""
|
|
10
10
|
|
|
11
11
|
operation_name = "sendMessage"
|
|
12
|
-
mapper =
|
|
12
|
+
mapper = SendMessageMapper()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from linkedapi.core import Operation
|
|
4
|
+
from linkedapi.mappers import VoidWorkflowMapper
|
|
5
|
+
from linkedapi.types import SyncNetworkParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SyncNetwork(Operation[SyncNetworkParams, None]):
|
|
9
|
+
"""Enable whole-network monitoring for standard LinkedIn connections."""
|
|
10
|
+
|
|
11
|
+
operation_name = "syncNetwork"
|
|
12
|
+
mapper = VoidWorkflowMapper[SyncNetworkParams]("st.syncNetwork")
|
|
@@ -113,10 +113,17 @@ from linkedapi.types.message import (
|
|
|
113
113
|
NvSendMessageParams,
|
|
114
114
|
NvSyncConversationParams,
|
|
115
115
|
NvSyncInboxParams,
|
|
116
|
+
SendMessageManageConversation,
|
|
116
117
|
SendMessageParams,
|
|
117
118
|
SyncConversationParams,
|
|
118
119
|
SyncInboxParams,
|
|
119
120
|
)
|
|
121
|
+
from linkedapi.types.network import (
|
|
122
|
+
NetworkEvent,
|
|
123
|
+
NetworkEventType,
|
|
124
|
+
NetworkPollRequest,
|
|
125
|
+
SyncNetworkParams,
|
|
126
|
+
)
|
|
120
127
|
from linkedapi.types.params import BaseActionParams, LimitParams, LimitSinceParams
|
|
121
128
|
from linkedapi.types.person import (
|
|
122
129
|
BaseFetchPersonParams,
|
|
@@ -194,6 +201,8 @@ from linkedapi.types.webhooks import (
|
|
|
194
201
|
DeleteWebhookParams,
|
|
195
202
|
MessageWebhookEvent,
|
|
196
203
|
MessageWebhookEventData,
|
|
204
|
+
NetworkWebhookEvent,
|
|
205
|
+
NetworkWebhookEventData,
|
|
197
206
|
ReplayWebhookDeliveryParams,
|
|
198
207
|
SetWebhookParams,
|
|
199
208
|
SetWebhookPayloadModeParams,
|
|
@@ -312,6 +321,11 @@ __all__ = [
|
|
|
312
321
|
"MessageWebhookEvent",
|
|
313
322
|
"MessageWebhookEventData",
|
|
314
323
|
"MinAnnualRevenue",
|
|
324
|
+
"NetworkEvent",
|
|
325
|
+
"NetworkEventType",
|
|
326
|
+
"NetworkPollRequest",
|
|
327
|
+
"NetworkWebhookEvent",
|
|
328
|
+
"NetworkWebhookEventData",
|
|
315
329
|
"NvBaseFetchCompanyParams",
|
|
316
330
|
"NvBaseFetchCompanyParamsWide",
|
|
317
331
|
"NvCompany",
|
|
@@ -381,6 +395,7 @@ __all__ = [
|
|
|
381
395
|
"SearchPeopleResult",
|
|
382
396
|
"SeatType",
|
|
383
397
|
"SendConnectionRequestParams",
|
|
398
|
+
"SendMessageManageConversation",
|
|
384
399
|
"SendMessageParams",
|
|
385
400
|
"SetLimitEntry",
|
|
386
401
|
"SetLimitsParams",
|
|
@@ -399,6 +414,7 @@ __all__ = [
|
|
|
399
414
|
"SubscriptionStatusValue",
|
|
400
415
|
"SyncConversationParams",
|
|
401
416
|
"SyncInboxParams",
|
|
417
|
+
"SyncNetworkParams",
|
|
402
418
|
"WebhookDelivery",
|
|
403
419
|
"WebhookDeliveryStatus",
|
|
404
420
|
"WebhookEvent",
|
|
@@ -9,10 +9,15 @@ ConversationType = Literal["st", "nv"]
|
|
|
9
9
|
MessageSender = Literal["us", "them"]
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
class SendMessageManageConversation(LinkedApiModel):
|
|
13
|
+
operation: str
|
|
14
|
+
|
|
15
|
+
|
|
12
16
|
class SendMessageParams(BaseActionParams):
|
|
13
17
|
text: str
|
|
14
18
|
person_url: str | None = None
|
|
15
19
|
thread_id: str | None = None
|
|
20
|
+
manage_conversation: SendMessageManageConversation | None = None
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
class SyncConversationParams(BaseActionParams):
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.base import LinkedApiModel
|
|
6
|
+
from linkedapi.types.params import BaseActionParams
|
|
7
|
+
|
|
8
|
+
NetworkEventType = Literal[
|
|
9
|
+
"connectionAccepted",
|
|
10
|
+
"connectionAdded",
|
|
11
|
+
"connectionRequestReceived",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SyncNetworkParams(BaseActionParams):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class NetworkPollRequest(LinkedApiModel):
|
|
20
|
+
since: str | None = None
|
|
21
|
+
type: NetworkEventType | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class NetworkEvent(LinkedApiModel):
|
|
25
|
+
id: str | None = None
|
|
26
|
+
type: NetworkEventType | None = None
|
|
27
|
+
person_url: str | None = None
|
|
28
|
+
detected_at: str | None = None
|
|
@@ -16,6 +16,9 @@ WebhookEventType = Literal[
|
|
|
16
16
|
"account.deleted",
|
|
17
17
|
"inbox.messageReceived",
|
|
18
18
|
"inbox.messageSent",
|
|
19
|
+
"network.connectionAccepted",
|
|
20
|
+
"network.connectionAdded",
|
|
21
|
+
"network.connectionRequestReceived",
|
|
19
22
|
"webhook.test",
|
|
20
23
|
]
|
|
21
24
|
WebhookDeliveryStatus = Literal["pending", "delivering", "success", "failed"]
|
|
@@ -112,6 +115,23 @@ class MessageWebhookEvent(LinkedApiModel):
|
|
|
112
115
|
data: MessageWebhookEventData
|
|
113
116
|
|
|
114
117
|
|
|
118
|
+
class NetworkWebhookEventData(LinkedApiModel):
|
|
119
|
+
account_id: str | None = None
|
|
120
|
+
person_url: str | None = None
|
|
121
|
+
detected_at: str | None = None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class NetworkWebhookEvent(LinkedApiModel):
|
|
125
|
+
id: str
|
|
126
|
+
type: Literal[
|
|
127
|
+
"network.connectionAccepted",
|
|
128
|
+
"network.connectionAdded",
|
|
129
|
+
"network.connectionRequestReceived",
|
|
130
|
+
]
|
|
131
|
+
created_at: str | None = None
|
|
132
|
+
data: NetworkWebhookEventData
|
|
133
|
+
|
|
134
|
+
|
|
115
135
|
class WebhookTestEventData(LinkedApiModel):
|
|
116
136
|
message: str | None = None
|
|
117
137
|
|
|
@@ -124,5 +144,9 @@ class WebhookTestEvent(LinkedApiModel):
|
|
|
124
144
|
|
|
125
145
|
|
|
126
146
|
WebhookEvent = (
|
|
127
|
-
WorkflowWebhookEvent
|
|
147
|
+
WorkflowWebhookEvent
|
|
148
|
+
| AccountWebhookEvent
|
|
149
|
+
| MessageWebhookEvent
|
|
150
|
+
| NetworkWebhookEvent
|
|
151
|
+
| WebhookTestEvent
|
|
128
152
|
)
|
|
@@ -5,6 +5,7 @@ import json
|
|
|
5
5
|
from linkedapi.types.webhooks import (
|
|
6
6
|
AccountWebhookEvent,
|
|
7
7
|
MessageWebhookEvent,
|
|
8
|
+
NetworkWebhookEvent,
|
|
8
9
|
WebhookEvent,
|
|
9
10
|
WebhookTestEvent,
|
|
10
11
|
WorkflowWebhookEvent,
|
|
@@ -44,6 +45,8 @@ def parse_webhook_event(raw_body: str | bytes) -> WebhookEvent:
|
|
|
44
45
|
return AccountWebhookEvent.model_validate(parsed)
|
|
45
46
|
if event_type.startswith("inbox."):
|
|
46
47
|
return MessageWebhookEvent.model_validate(parsed)
|
|
48
|
+
if event_type.startswith("network."):
|
|
49
|
+
return NetworkWebhookEvent.model_validate(parsed)
|
|
47
50
|
if event_type == "webhook.test":
|
|
48
51
|
return WebhookTestEvent.model_validate(parsed)
|
|
49
52
|
|
|
@@ -38,6 +38,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
38
38
|
"send_message",
|
|
39
39
|
"sync_conversation",
|
|
40
40
|
"sync_inbox",
|
|
41
|
+
"sync_network",
|
|
41
42
|
"manage_conversation",
|
|
42
43
|
"nv_send_message",
|
|
43
44
|
"nv_sync_conversation",
|
|
@@ -55,7 +56,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
55
56
|
assert hasattr(operation, "execute")
|
|
56
57
|
assert hasattr(operation, "result")
|
|
57
58
|
assert hasattr(operation, "cancel")
|
|
58
|
-
assert len(linkedapi.operations) ==
|
|
59
|
+
assert len(linkedapi.operations) == 35
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
def test_operation_mappers_match_node_contract() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|