linkedapi 1.1.1__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.1.1 → linkedapi-1.3.0}/.github/workflows/publish.yaml +4 -4
- {linkedapi-1.1.1 → linkedapi-1.3.0}/PKG-INFO +1 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/__init__.py +13 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/client.py +43 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/errors.py +2 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/__init__.py +2 -0
- linkedapi-1.3.0/linkedapi/mappers/send_message.py +48 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/__init__.py +12 -0
- linkedapi-1.3.0/linkedapi/operations/accept_connection_request.py +12 -0
- linkedapi-1.3.0/linkedapi/operations/ignore_connection_request.py +12 -0
- linkedapi-1.3.0/linkedapi/operations/manage_conversation.py +12 -0
- linkedapi-1.3.0/linkedapi/operations/nv_manage_conversation.py +12 -0
- linkedapi-1.3.0/linkedapi/operations/retrieve_connection_requests.py +15 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/send_message.py +2 -2
- linkedapi-1.3.0/linkedapi/operations/sync_network.py +12 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/__init__.py +26 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/connection.py +15 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/message.py +15 -0
- linkedapi-1.3.0/linkedapi/types/network.py +28 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/webhooks.py +28 -4
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/webhooks/parse.py +4 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/pyproject.toml +1 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_errors.py +1 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_operations.py +20 -1
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_webhooks.py +4 -4
- {linkedapi-1.1.1 → linkedapi-1.3.0}/.gitignore +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/LICENSE +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/README.md +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/config.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/http/base.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/py.typed +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/account.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/admin/accounts.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/admin/subscription.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/base.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/company.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/params.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/person.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/post.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/conftest.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_admin.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_direct_methods.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_http_client.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_mappers.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_models.py +0 -0
- {linkedapi-1.1.1 → linkedapi-1.3.0}/tests/test_polling.py +0 -0
|
@@ -10,10 +10,10 @@ jobs:
|
|
|
10
10
|
|
|
11
11
|
steps:
|
|
12
12
|
- name: Checkout code
|
|
13
|
-
uses: actions/checkout@
|
|
13
|
+
uses: actions/checkout@v5
|
|
14
14
|
|
|
15
15
|
- name: Set up Python
|
|
16
|
-
uses: actions/setup-python@
|
|
16
|
+
uses: actions/setup-python@v6
|
|
17
17
|
with:
|
|
18
18
|
python-version: '3.12'
|
|
19
19
|
|
|
@@ -38,10 +38,10 @@ jobs:
|
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
40
|
- name: Checkout code
|
|
41
|
-
uses: actions/checkout@
|
|
41
|
+
uses: actions/checkout@v5
|
|
42
42
|
|
|
43
43
|
- name: Set up Python
|
|
44
|
-
uses: actions/setup-python@
|
|
44
|
+
uses: actions/setup-python@v6
|
|
45
45
|
with:
|
|
46
46
|
python-version: '3.12'
|
|
47
47
|
|
|
@@ -29,6 +29,7 @@ from linkedapi.mappers import (
|
|
|
29
29
|
VoidWorkflowMapper,
|
|
30
30
|
)
|
|
31
31
|
from linkedapi.operations import (
|
|
32
|
+
AcceptConnectionRequest,
|
|
32
33
|
CheckConnectionStatus,
|
|
33
34
|
CommentOnPost,
|
|
34
35
|
CreatePost,
|
|
@@ -41,10 +42,13 @@ from linkedapi.operations import (
|
|
|
41
42
|
FetchPersonMapper,
|
|
42
43
|
FetchPost,
|
|
43
44
|
FetchPostMapper,
|
|
45
|
+
IgnoreConnectionRequest,
|
|
46
|
+
ManageConversation,
|
|
44
47
|
NvFetchCompany,
|
|
45
48
|
NvFetchCompanyMapper,
|
|
46
49
|
NvFetchPerson,
|
|
47
50
|
NvFetchPersonMapper,
|
|
51
|
+
NvManageConversation,
|
|
48
52
|
NvSearchCompanies,
|
|
49
53
|
NvSearchPeople,
|
|
50
54
|
NvSendMessage,
|
|
@@ -52,6 +56,7 @@ from linkedapi.operations import (
|
|
|
52
56
|
NvSyncInbox,
|
|
53
57
|
ReactToPost,
|
|
54
58
|
RemoveConnection,
|
|
59
|
+
RetrieveConnectionRequests,
|
|
55
60
|
RetrieveConnections,
|
|
56
61
|
RetrievePendingRequests,
|
|
57
62
|
RetrievePerformance,
|
|
@@ -63,17 +68,19 @@ from linkedapi.operations import (
|
|
|
63
68
|
SendMessage,
|
|
64
69
|
SyncConversation,
|
|
65
70
|
SyncInbox,
|
|
71
|
+
SyncNetwork,
|
|
66
72
|
WithdrawConnectionRequest,
|
|
67
73
|
)
|
|
68
74
|
from linkedapi.types import * # noqa: F403
|
|
69
75
|
from linkedapi.types import __all__ as _types_all
|
|
70
76
|
from linkedapi.webhooks import parse_webhook_event
|
|
71
77
|
|
|
72
|
-
__version__ = "1.
|
|
78
|
+
__version__ = "1.2.1"
|
|
73
79
|
PredefinedOperation = Operation
|
|
74
80
|
|
|
75
81
|
__all__ = [
|
|
76
82
|
*_types_all,
|
|
83
|
+
"AcceptConnectionRequest",
|
|
77
84
|
"AdminAccounts",
|
|
78
85
|
"AdminHttpClient",
|
|
79
86
|
"AdminLimits",
|
|
@@ -95,6 +102,7 @@ __all__ = [
|
|
|
95
102
|
"FetchPost",
|
|
96
103
|
"FetchPostMapper",
|
|
97
104
|
"HttpClient",
|
|
105
|
+
"IgnoreConnectionRequest",
|
|
98
106
|
"LINKED_API_ACTION_ERROR_TYPES",
|
|
99
107
|
"LINKED_API_ERROR_TYPES",
|
|
100
108
|
"LinkedApi",
|
|
@@ -105,11 +113,13 @@ __all__ = [
|
|
|
105
113
|
"LinkedApiErrorType",
|
|
106
114
|
"LinkedApiHttpClient",
|
|
107
115
|
"LinkedApiWorkflowTimeoutError",
|
|
116
|
+
"ManageConversation",
|
|
108
117
|
"MappedResponse",
|
|
109
118
|
"NvFetchCompany",
|
|
110
119
|
"NvFetchCompanyMapper",
|
|
111
120
|
"NvFetchPerson",
|
|
112
121
|
"NvFetchPersonMapper",
|
|
122
|
+
"NvManageConversation",
|
|
113
123
|
"NvSearchCompanies",
|
|
114
124
|
"NvSearchPeople",
|
|
115
125
|
"NvSendMessage",
|
|
@@ -120,6 +130,7 @@ __all__ = [
|
|
|
120
130
|
"ReactToPost",
|
|
121
131
|
"RemoveConnection",
|
|
122
132
|
"ResponseMapping",
|
|
133
|
+
"RetrieveConnectionRequests",
|
|
123
134
|
"RetrieveConnections",
|
|
124
135
|
"RetrievePendingRequests",
|
|
125
136
|
"RetrievePerformance",
|
|
@@ -132,6 +143,7 @@ __all__ = [
|
|
|
132
143
|
"SimpleWorkflowMapper",
|
|
133
144
|
"SyncConversation",
|
|
134
145
|
"SyncInbox",
|
|
146
|
+
"SyncNetwork",
|
|
135
147
|
"ThenWorkflowMapper",
|
|
136
148
|
"VoidWorkflowMapper",
|
|
137
149
|
"WithdrawConnectionRequest",
|
|
@@ -8,6 +8,7 @@ from linkedapi.errors import LinkedApiError
|
|
|
8
8
|
from linkedapi.http import HttpClient, LinkedApiHttpClient
|
|
9
9
|
from linkedapi.mappers import MappedResponse
|
|
10
10
|
from linkedapi.operations import (
|
|
11
|
+
AcceptConnectionRequest,
|
|
11
12
|
CheckConnectionStatus,
|
|
12
13
|
CommentOnPost,
|
|
13
14
|
CreatePost,
|
|
@@ -16,8 +17,11 @@ from linkedapi.operations import (
|
|
|
16
17
|
FetchJob,
|
|
17
18
|
FetchPerson,
|
|
18
19
|
FetchPost,
|
|
20
|
+
IgnoreConnectionRequest,
|
|
21
|
+
ManageConversation,
|
|
19
22
|
NvFetchCompany,
|
|
20
23
|
NvFetchPerson,
|
|
24
|
+
NvManageConversation,
|
|
21
25
|
NvSearchCompanies,
|
|
22
26
|
NvSearchPeople,
|
|
23
27
|
NvSendMessage,
|
|
@@ -25,6 +29,7 @@ from linkedapi.operations import (
|
|
|
25
29
|
NvSyncInbox,
|
|
26
30
|
ReactToPost,
|
|
27
31
|
RemoveConnection,
|
|
32
|
+
RetrieveConnectionRequests,
|
|
28
33
|
RetrieveConnections,
|
|
29
34
|
RetrievePendingRequests,
|
|
30
35
|
RetrievePerformance,
|
|
@@ -36,6 +41,7 @@ from linkedapi.operations import (
|
|
|
36
41
|
SendMessage,
|
|
37
42
|
SyncConversation,
|
|
38
43
|
SyncInbox,
|
|
44
|
+
SyncNetwork,
|
|
39
45
|
WithdrawConnectionRequest,
|
|
40
46
|
)
|
|
41
47
|
from linkedapi.types import AccountInfo, LinkedApiActionError, serialize_value
|
|
@@ -45,6 +51,7 @@ from linkedapi.types.message import (
|
|
|
45
51
|
InboxMessage,
|
|
46
52
|
InboxPollRequest,
|
|
47
53
|
)
|
|
54
|
+
from linkedapi.types.network import NetworkEvent, NetworkPollRequest
|
|
48
55
|
from linkedapi.types.statistics import ApiUsageAction, ApiUsageParams
|
|
49
56
|
|
|
50
57
|
|
|
@@ -62,10 +69,15 @@ class LinkedApi:
|
|
|
62
69
|
self.send_message = SendMessage(self.http_client)
|
|
63
70
|
self.sync_conversation = SyncConversation(self.http_client)
|
|
64
71
|
self.sync_inbox = SyncInbox(self.http_client)
|
|
72
|
+
self.sync_network = SyncNetwork(self.http_client)
|
|
73
|
+
self.manage_conversation = ManageConversation(self.http_client)
|
|
65
74
|
self.check_connection_status = CheckConnectionStatus(self.http_client)
|
|
66
75
|
self.send_connection_request = SendConnectionRequest(self.http_client)
|
|
67
76
|
self.withdraw_connection_request = WithdrawConnectionRequest(self.http_client)
|
|
77
|
+
self.accept_connection_request = AcceptConnectionRequest(self.http_client)
|
|
78
|
+
self.ignore_connection_request = IgnoreConnectionRequest(self.http_client)
|
|
68
79
|
self.retrieve_pending_requests = RetrievePendingRequests(self.http_client)
|
|
80
|
+
self.retrieve_connection_requests = RetrieveConnectionRequests(self.http_client)
|
|
69
81
|
self.retrieve_connections = RetrieveConnections(self.http_client)
|
|
70
82
|
self.remove_connection = RemoveConnection(self.http_client)
|
|
71
83
|
self.search_companies = SearchCompanies(self.http_client)
|
|
@@ -83,6 +95,7 @@ class LinkedApi:
|
|
|
83
95
|
self.nv_send_message = NvSendMessage(self.http_client)
|
|
84
96
|
self.nv_sync_conversation = NvSyncConversation(self.http_client)
|
|
85
97
|
self.nv_sync_inbox = NvSyncInbox(self.http_client)
|
|
98
|
+
self.nv_manage_conversation = NvManageConversation(self.http_client)
|
|
86
99
|
self.nv_search_companies = NvSearchCompanies(self.http_client)
|
|
87
100
|
self.nv_search_people = NvSearchPeople(self.http_client)
|
|
88
101
|
self.nv_fetch_company = NvFetchCompany(self.http_client)
|
|
@@ -93,10 +106,15 @@ class LinkedApi:
|
|
|
93
106
|
self.send_message,
|
|
94
107
|
self.sync_conversation,
|
|
95
108
|
self.sync_inbox,
|
|
109
|
+
self.sync_network,
|
|
110
|
+
self.manage_conversation,
|
|
96
111
|
self.check_connection_status,
|
|
97
112
|
self.send_connection_request,
|
|
98
113
|
self.withdraw_connection_request,
|
|
114
|
+
self.accept_connection_request,
|
|
115
|
+
self.ignore_connection_request,
|
|
99
116
|
self.retrieve_pending_requests,
|
|
117
|
+
self.retrieve_connection_requests,
|
|
100
118
|
self.retrieve_connections,
|
|
101
119
|
self.remove_connection,
|
|
102
120
|
self.search_companies,
|
|
@@ -114,6 +132,7 @@ class LinkedApi:
|
|
|
114
132
|
self.nv_send_message,
|
|
115
133
|
self.nv_sync_conversation,
|
|
116
134
|
self.nv_sync_inbox,
|
|
135
|
+
self.nv_manage_conversation,
|
|
117
136
|
self.nv_search_companies,
|
|
118
137
|
self.nv_search_people,
|
|
119
138
|
self.nv_fetch_company,
|
|
@@ -174,6 +193,30 @@ class LinkedApi:
|
|
|
174
193
|
],
|
|
175
194
|
)
|
|
176
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
|
+
|
|
177
220
|
def get_account_info(self) -> MappedResponse[AccountInfo]:
|
|
178
221
|
"""Retrieve basic information about the current LinkedIn account."""
|
|
179
222
|
|
|
@@ -23,6 +23,7 @@ LinkedApiActionErrorType = Literal[
|
|
|
23
23
|
"noPostingPermission",
|
|
24
24
|
"noSalesNavigator",
|
|
25
25
|
"conversationsNotSynced",
|
|
26
|
+
"threadNotFound",
|
|
26
27
|
]
|
|
27
28
|
LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
|
|
28
29
|
"personNotFound",
|
|
@@ -45,6 +46,7 @@ LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
|
|
|
45
46
|
"noPostingPermission",
|
|
46
47
|
"noSalesNavigator",
|
|
47
48
|
"conversationsNotSynced",
|
|
49
|
+
"threadNotFound",
|
|
48
50
|
)
|
|
49
51
|
|
|
50
52
|
LinkedApiErrorType = Literal[
|
|
@@ -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))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from linkedapi.operations.accept_connection_request import AcceptConnectionRequest
|
|
1
2
|
from linkedapi.operations.check_connection_status import CheckConnectionStatus
|
|
2
3
|
from linkedapi.operations.comment_on_post import CommentOnPost
|
|
3
4
|
from linkedapi.operations.create_post import CreatePost
|
|
@@ -6,8 +7,11 @@ from linkedapi.operations.fetch_company import FetchCompany, FetchCompanyMapper
|
|
|
6
7
|
from linkedapi.operations.fetch_job import FetchJob, FetchJobMapper
|
|
7
8
|
from linkedapi.operations.fetch_person import FetchPerson, FetchPersonMapper
|
|
8
9
|
from linkedapi.operations.fetch_post import FetchPost, FetchPostMapper
|
|
10
|
+
from linkedapi.operations.ignore_connection_request import IgnoreConnectionRequest
|
|
11
|
+
from linkedapi.operations.manage_conversation import ManageConversation
|
|
9
12
|
from linkedapi.operations.nv_fetch_company import NvFetchCompany, NvFetchCompanyMapper
|
|
10
13
|
from linkedapi.operations.nv_fetch_person import NvFetchPerson, NvFetchPersonMapper
|
|
14
|
+
from linkedapi.operations.nv_manage_conversation import NvManageConversation
|
|
11
15
|
from linkedapi.operations.nv_search_companies import NvSearchCompanies
|
|
12
16
|
from linkedapi.operations.nv_search_people import NvSearchPeople
|
|
13
17
|
from linkedapi.operations.nv_send_message import NvSendMessage
|
|
@@ -15,6 +19,7 @@ from linkedapi.operations.nv_sync_conversation import NvSyncConversation
|
|
|
15
19
|
from linkedapi.operations.nv_sync_inbox import NvSyncInbox
|
|
16
20
|
from linkedapi.operations.react_to_post import ReactToPost
|
|
17
21
|
from linkedapi.operations.remove_connection import RemoveConnection
|
|
22
|
+
from linkedapi.operations.retrieve_connection_requests import RetrieveConnectionRequests
|
|
18
23
|
from linkedapi.operations.retrieve_connections import RetrieveConnections
|
|
19
24
|
from linkedapi.operations.retrieve_pending_requests import RetrievePendingRequests
|
|
20
25
|
from linkedapi.operations.retrieve_performance import RetrievePerformance
|
|
@@ -26,9 +31,11 @@ from linkedapi.operations.send_connection_request import SendConnectionRequest
|
|
|
26
31
|
from linkedapi.operations.send_message import SendMessage
|
|
27
32
|
from linkedapi.operations.sync_conversation import SyncConversation
|
|
28
33
|
from linkedapi.operations.sync_inbox import SyncInbox
|
|
34
|
+
from linkedapi.operations.sync_network import SyncNetwork
|
|
29
35
|
from linkedapi.operations.withdraw_connection_request import WithdrawConnectionRequest
|
|
30
36
|
|
|
31
37
|
__all__ = [
|
|
38
|
+
"AcceptConnectionRequest",
|
|
32
39
|
"CheckConnectionStatus",
|
|
33
40
|
"CommentOnPost",
|
|
34
41
|
"CreatePost",
|
|
@@ -41,10 +48,13 @@ __all__ = [
|
|
|
41
48
|
"FetchPersonMapper",
|
|
42
49
|
"FetchPost",
|
|
43
50
|
"FetchPostMapper",
|
|
51
|
+
"IgnoreConnectionRequest",
|
|
52
|
+
"ManageConversation",
|
|
44
53
|
"NvFetchCompany",
|
|
45
54
|
"NvFetchCompanyMapper",
|
|
46
55
|
"NvFetchPerson",
|
|
47
56
|
"NvFetchPersonMapper",
|
|
57
|
+
"NvManageConversation",
|
|
48
58
|
"NvSearchCompanies",
|
|
49
59
|
"NvSearchPeople",
|
|
50
60
|
"NvSendMessage",
|
|
@@ -52,6 +62,7 @@ __all__ = [
|
|
|
52
62
|
"NvSyncInbox",
|
|
53
63
|
"ReactToPost",
|
|
54
64
|
"RemoveConnection",
|
|
65
|
+
"RetrieveConnectionRequests",
|
|
55
66
|
"RetrieveConnections",
|
|
56
67
|
"RetrievePendingRequests",
|
|
57
68
|
"RetrievePerformance",
|
|
@@ -63,5 +74,6 @@ __all__ = [
|
|
|
63
74
|
"SendMessage",
|
|
64
75
|
"SyncConversation",
|
|
65
76
|
"SyncInbox",
|
|
77
|
+
"SyncNetwork",
|
|
66
78
|
"WithdrawConnectionRequest",
|
|
67
79
|
]
|
|
@@ -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 AcceptConnectionRequestParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AcceptConnectionRequest(Operation[AcceptConnectionRequestParams, None]):
|
|
9
|
+
"""Accept an incoming standard LinkedIn connection request."""
|
|
10
|
+
|
|
11
|
+
operation_name = "acceptConnectionRequest"
|
|
12
|
+
mapper = VoidWorkflowMapper[AcceptConnectionRequestParams]("st.acceptConnectionRequest")
|
|
@@ -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 IgnoreConnectionRequestParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IgnoreConnectionRequest(Operation[IgnoreConnectionRequestParams, None]):
|
|
9
|
+
"""Ignore an incoming standard LinkedIn connection request."""
|
|
10
|
+
|
|
11
|
+
operation_name = "ignoreConnectionRequest"
|
|
12
|
+
mapper = VoidWorkflowMapper[IgnoreConnectionRequestParams]("st.ignoreConnectionRequest")
|
|
@@ -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 ManageConversationParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ManageConversation(Operation[ManageConversationParams, None]):
|
|
9
|
+
"""Manage a standard LinkedIn conversation thread."""
|
|
10
|
+
|
|
11
|
+
operation_name = "manageConversation"
|
|
12
|
+
mapper = VoidWorkflowMapper[ManageConversationParams]("st.manageConversation")
|
|
@@ -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 NvManageConversationParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class NvManageConversation(Operation[NvManageConversationParams, None]):
|
|
9
|
+
"""Manage a Sales Navigator conversation thread."""
|
|
10
|
+
|
|
11
|
+
operation_name = "nvManageConversation"
|
|
12
|
+
mapper = VoidWorkflowMapper[NvManageConversationParams]("nv.manageConversation")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from linkedapi.core import Operation
|
|
4
|
+
from linkedapi.mappers import ArrayWorkflowMapper
|
|
5
|
+
from linkedapi.types import RetrieveConnectionRequestsResult
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RetrieveConnectionRequests(Operation[None, list[RetrieveConnectionRequestsResult]]):
|
|
9
|
+
"""Retrieve incoming standard LinkedIn connection requests."""
|
|
10
|
+
|
|
11
|
+
operation_name = "retrieveConnectionRequests"
|
|
12
|
+
mapper = ArrayWorkflowMapper[None, RetrieveConnectionRequestsResult](
|
|
13
|
+
"st.retrieveConnectionRequests",
|
|
14
|
+
RetrieveConnectionRequestsResult,
|
|
15
|
+
)
|
|
@@ -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")
|
|
@@ -68,13 +68,16 @@ from linkedapi.types.company import (
|
|
|
68
68
|
StCompanyEmployeesRetrievalConfig,
|
|
69
69
|
)
|
|
70
70
|
from linkedapi.types.connection import (
|
|
71
|
+
AcceptConnectionRequestParams,
|
|
71
72
|
CheckConnectionStatusParams,
|
|
72
73
|
CheckConnectionStatusResult,
|
|
73
74
|
ConnectionPerson,
|
|
74
75
|
ConnectionStatus,
|
|
76
|
+
IgnoreConnectionRequestParams,
|
|
75
77
|
NvOpenPersonPageParams,
|
|
76
78
|
NvOpenPersonPageResult,
|
|
77
79
|
RemoveConnectionParams,
|
|
80
|
+
RetrieveConnectionRequestsResult,
|
|
78
81
|
RetrieveConnectionsFilter,
|
|
79
82
|
RetrieveConnectionsParams,
|
|
80
83
|
RetrieveConnectionsResult,
|
|
@@ -103,15 +106,24 @@ from linkedapi.types.message import (
|
|
|
103
106
|
ConversationType,
|
|
104
107
|
InboxMessage,
|
|
105
108
|
InboxPollRequest,
|
|
109
|
+
ManageConversationParams,
|
|
106
110
|
Message,
|
|
107
111
|
MessageSender,
|
|
112
|
+
NvManageConversationParams,
|
|
108
113
|
NvSendMessageParams,
|
|
109
114
|
NvSyncConversationParams,
|
|
110
115
|
NvSyncInboxParams,
|
|
116
|
+
SendMessageManageConversation,
|
|
111
117
|
SendMessageParams,
|
|
112
118
|
SyncConversationParams,
|
|
113
119
|
SyncInboxParams,
|
|
114
120
|
)
|
|
121
|
+
from linkedapi.types.network import (
|
|
122
|
+
NetworkEvent,
|
|
123
|
+
NetworkEventType,
|
|
124
|
+
NetworkPollRequest,
|
|
125
|
+
SyncNetworkParams,
|
|
126
|
+
)
|
|
115
127
|
from linkedapi.types.params import BaseActionParams, LimitParams, LimitSinceParams
|
|
116
128
|
from linkedapi.types.person import (
|
|
117
129
|
BaseFetchPersonParams,
|
|
@@ -189,6 +201,8 @@ from linkedapi.types.webhooks import (
|
|
|
189
201
|
DeleteWebhookParams,
|
|
190
202
|
MessageWebhookEvent,
|
|
191
203
|
MessageWebhookEventData,
|
|
204
|
+
NetworkWebhookEvent,
|
|
205
|
+
NetworkWebhookEventData,
|
|
192
206
|
ReplayWebhookDeliveryParams,
|
|
193
207
|
SetWebhookParams,
|
|
194
208
|
SetWebhookPayloadModeParams,
|
|
@@ -219,6 +233,7 @@ from linkedapi.types.workflow import (
|
|
|
219
233
|
)
|
|
220
234
|
|
|
221
235
|
__all__ = [
|
|
236
|
+
"AcceptConnectionRequestParams",
|
|
222
237
|
"AccountInfo",
|
|
223
238
|
"AccountWebhookEvent",
|
|
224
239
|
"AccountWebhookEventData",
|
|
@@ -275,6 +290,7 @@ __all__ = [
|
|
|
275
290
|
"GetConnectionSessionParams",
|
|
276
291
|
"GetLimitsParams",
|
|
277
292
|
"GetLimitsUsageParams",
|
|
293
|
+
"IgnoreConnectionRequestParams",
|
|
278
294
|
"InboxMessage",
|
|
279
295
|
"InboxPollRequest",
|
|
280
296
|
"Job",
|
|
@@ -298,12 +314,18 @@ __all__ = [
|
|
|
298
314
|
"LinkedApiRequestError",
|
|
299
315
|
"LinkedApiResponse",
|
|
300
316
|
"LocationType",
|
|
317
|
+
"ManageConversationParams",
|
|
301
318
|
"MaxAnnualRevenue",
|
|
302
319
|
"Message",
|
|
303
320
|
"MessageSender",
|
|
304
321
|
"MessageWebhookEvent",
|
|
305
322
|
"MessageWebhookEventData",
|
|
306
323
|
"MinAnnualRevenue",
|
|
324
|
+
"NetworkEvent",
|
|
325
|
+
"NetworkEventType",
|
|
326
|
+
"NetworkPollRequest",
|
|
327
|
+
"NetworkWebhookEvent",
|
|
328
|
+
"NetworkWebhookEventData",
|
|
307
329
|
"NvBaseFetchCompanyParams",
|
|
308
330
|
"NvBaseFetchCompanyParamsWide",
|
|
309
331
|
"NvCompany",
|
|
@@ -313,6 +335,7 @@ __all__ = [
|
|
|
313
335
|
"NvCompanyEmployeeRetrievalConfig",
|
|
314
336
|
"NvFetchCompanyParams",
|
|
315
337
|
"NvFetchCompanyResult",
|
|
338
|
+
"NvManageConversationParams",
|
|
316
339
|
"NvOpenPersonPageParams",
|
|
317
340
|
"NvOpenPersonPageResult",
|
|
318
341
|
"NvSearchCompaniesFilter",
|
|
@@ -352,6 +375,7 @@ __all__ = [
|
|
|
352
375
|
"ReparseAccountInfoResult",
|
|
353
376
|
"ReplayWebhookDeliveryParams",
|
|
354
377
|
"ResetLimitsParams",
|
|
378
|
+
"RetrieveConnectionRequestsResult",
|
|
355
379
|
"RetrieveConnectionsFilter",
|
|
356
380
|
"RetrieveConnectionsParams",
|
|
357
381
|
"RetrieveConnectionsResult",
|
|
@@ -371,6 +395,7 @@ __all__ = [
|
|
|
371
395
|
"SearchPeopleResult",
|
|
372
396
|
"SeatType",
|
|
373
397
|
"SendConnectionRequestParams",
|
|
398
|
+
"SendMessageManageConversation",
|
|
374
399
|
"SendMessageParams",
|
|
375
400
|
"SetLimitEntry",
|
|
376
401
|
"SetLimitsParams",
|
|
@@ -389,6 +414,7 @@ __all__ = [
|
|
|
389
414
|
"SubscriptionStatusValue",
|
|
390
415
|
"SyncConversationParams",
|
|
391
416
|
"SyncInboxParams",
|
|
417
|
+
"SyncNetworkParams",
|
|
392
418
|
"WebhookDelivery",
|
|
393
419
|
"WebhookDeliveryStatus",
|
|
394
420
|
"WebhookEvent",
|
|
@@ -5,7 +5,7 @@ from typing import Literal
|
|
|
5
5
|
from linkedapi.types.base import LinkedApiModel
|
|
6
6
|
from linkedapi.types.params import BaseActionParams, LimitParams
|
|
7
7
|
|
|
8
|
-
ConnectionStatus = Literal["connected", "pending", "notConnected"]
|
|
8
|
+
ConnectionStatus = Literal["connected", "pending", "incoming", "notConnected"]
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ConnectionPerson(LinkedApiModel):
|
|
@@ -42,6 +42,20 @@ class RetrievePendingRequestsResult(LinkedApiModel):
|
|
|
42
42
|
sent_time: str | None = None
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
class AcceptConnectionRequestParams(BaseActionParams):
|
|
46
|
+
person_url: str
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class IgnoreConnectionRequestParams(BaseActionParams):
|
|
50
|
+
person_url: str
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class RetrieveConnectionRequestsResult(LinkedApiModel):
|
|
54
|
+
name: str | None = None
|
|
55
|
+
public_url: str | None = None
|
|
56
|
+
headline: str | None = None
|
|
57
|
+
|
|
58
|
+
|
|
45
59
|
class RetrieveConnectionsFilter(LinkedApiModel):
|
|
46
60
|
first_name: str | None = None
|
|
47
61
|
last_name: str | None = None
|
|
@@ -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):
|
|
@@ -23,6 +28,11 @@ class SyncInboxParams(BaseActionParams):
|
|
|
23
28
|
pass
|
|
24
29
|
|
|
25
30
|
|
|
31
|
+
class ManageConversationParams(BaseActionParams):
|
|
32
|
+
thread_id: str
|
|
33
|
+
operation: str
|
|
34
|
+
|
|
35
|
+
|
|
26
36
|
class NvSendMessageParams(BaseActionParams):
|
|
27
37
|
text: str
|
|
28
38
|
person_url: str | None = None
|
|
@@ -38,6 +48,11 @@ class NvSyncInboxParams(BaseActionParams):
|
|
|
38
48
|
pass
|
|
39
49
|
|
|
40
50
|
|
|
51
|
+
class NvManageConversationParams(BaseActionParams):
|
|
52
|
+
thread_id: str
|
|
53
|
+
operation: str
|
|
54
|
+
|
|
55
|
+
|
|
41
56
|
class ConversationPollRequest(LinkedApiModel):
|
|
42
57
|
person_url: str
|
|
43
58
|
type: ConversationType
|
|
@@ -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
|
|
@@ -14,8 +14,11 @@ WebhookEventType = Literal[
|
|
|
14
14
|
"account.reconnectionRequired",
|
|
15
15
|
"account.frozen",
|
|
16
16
|
"account.deleted",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"inbox.messageReceived",
|
|
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"]
|
|
@@ -107,11 +110,28 @@ class MessageWebhookEventData(LinkedApiModel):
|
|
|
107
110
|
|
|
108
111
|
class MessageWebhookEvent(LinkedApiModel):
|
|
109
112
|
id: str
|
|
110
|
-
type: Literal["
|
|
113
|
+
type: Literal["inbox.messageReceived", "inbox.messageSent"]
|
|
111
114
|
created_at: str | None = None
|
|
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,
|
|
@@ -42,8 +43,10 @@ def parse_webhook_event(raw_body: str | bytes) -> WebhookEvent:
|
|
|
42
43
|
return WorkflowWebhookEvent.model_validate(parsed)
|
|
43
44
|
if event_type.startswith("account."):
|
|
44
45
|
return AccountWebhookEvent.model_validate(parsed)
|
|
45
|
-
if event_type.startswith("
|
|
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
|
|
|
@@ -29,15 +29,21 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
29
29
|
"send_connection_request",
|
|
30
30
|
"check_connection_status",
|
|
31
31
|
"withdraw_connection_request",
|
|
32
|
+
"accept_connection_request",
|
|
33
|
+
"ignore_connection_request",
|
|
32
34
|
"retrieve_pending_requests",
|
|
35
|
+
"retrieve_connection_requests",
|
|
33
36
|
"retrieve_connections",
|
|
34
37
|
"remove_connection",
|
|
35
38
|
"send_message",
|
|
36
39
|
"sync_conversation",
|
|
37
40
|
"sync_inbox",
|
|
41
|
+
"sync_network",
|
|
42
|
+
"manage_conversation",
|
|
38
43
|
"nv_send_message",
|
|
39
44
|
"nv_sync_conversation",
|
|
40
45
|
"nv_sync_inbox",
|
|
46
|
+
"nv_manage_conversation",
|
|
41
47
|
"react_to_post",
|
|
42
48
|
"comment_on_post",
|
|
43
49
|
"create_post",
|
|
@@ -50,7 +56,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
50
56
|
assert hasattr(operation, "execute")
|
|
51
57
|
assert hasattr(operation, "result")
|
|
52
58
|
assert hasattr(operation, "cancel")
|
|
53
|
-
assert len(linkedapi.operations) ==
|
|
59
|
+
assert len(linkedapi.operations) == 35
|
|
54
60
|
|
|
55
61
|
|
|
56
62
|
def test_operation_mappers_match_node_contract() -> None:
|
|
@@ -66,10 +72,23 @@ def test_operation_mappers_match_node_contract() -> None:
|
|
|
66
72
|
assert linkedapi.fetch_job.mapper.default_params == {"basicInfo": True}
|
|
67
73
|
assert isinstance(linkedapi.send_connection_request.mapper, VoidWorkflowMapper)
|
|
68
74
|
assert linkedapi.send_connection_request.mapper.action_type == "st.sendConnectionRequest"
|
|
75
|
+
assert isinstance(linkedapi.accept_connection_request.mapper, VoidWorkflowMapper)
|
|
76
|
+
assert linkedapi.accept_connection_request.mapper.action_type == "st.acceptConnectionRequest"
|
|
77
|
+
assert isinstance(linkedapi.ignore_connection_request.mapper, VoidWorkflowMapper)
|
|
78
|
+
assert linkedapi.ignore_connection_request.mapper.action_type == "st.ignoreConnectionRequest"
|
|
79
|
+
assert isinstance(linkedapi.retrieve_connection_requests.mapper, ArrayWorkflowMapper)
|
|
80
|
+
assert (
|
|
81
|
+
linkedapi.retrieve_connection_requests.mapper.base_action_type
|
|
82
|
+
== "st.retrieveConnectionRequests"
|
|
83
|
+
)
|
|
69
84
|
assert isinstance(linkedapi.sync_inbox.mapper, VoidWorkflowMapper)
|
|
70
85
|
assert linkedapi.sync_inbox.mapper.action_type == "st.syncInbox"
|
|
71
86
|
assert isinstance(linkedapi.nv_sync_inbox.mapper, VoidWorkflowMapper)
|
|
72
87
|
assert linkedapi.nv_sync_inbox.mapper.action_type == "nv.syncInbox"
|
|
88
|
+
assert isinstance(linkedapi.manage_conversation.mapper, VoidWorkflowMapper)
|
|
89
|
+
assert linkedapi.manage_conversation.mapper.action_type == "st.manageConversation"
|
|
90
|
+
assert isinstance(linkedapi.nv_manage_conversation.mapper, VoidWorkflowMapper)
|
|
91
|
+
assert linkedapi.nv_manage_conversation.mapper.action_type == "nv.manageConversation"
|
|
73
92
|
|
|
74
93
|
|
|
75
94
|
def test_execute_and_result_flow_returns_pydantic_data(
|
|
@@ -41,7 +41,7 @@ def test_parse_message_received_event() -> None:
|
|
|
41
41
|
json.dumps(
|
|
42
42
|
{
|
|
43
43
|
"id": "e3",
|
|
44
|
-
"type": "
|
|
44
|
+
"type": "inbox.messageReceived",
|
|
45
45
|
"data": {
|
|
46
46
|
"accountId": "a1",
|
|
47
47
|
"type": "st",
|
|
@@ -57,7 +57,7 @@ def test_parse_message_received_event() -> None:
|
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
assert isinstance(event, MessageWebhookEvent)
|
|
60
|
-
assert event.type == "
|
|
60
|
+
assert event.type == "inbox.messageReceived"
|
|
61
61
|
assert event.data.thread_id == "t1"
|
|
62
62
|
assert event.data.message_id == "m1"
|
|
63
63
|
assert event.data.sender == "them"
|
|
@@ -68,14 +68,14 @@ def test_parse_message_sent_event() -> None:
|
|
|
68
68
|
json.dumps(
|
|
69
69
|
{
|
|
70
70
|
"id": "e4",
|
|
71
|
-
"type": "
|
|
71
|
+
"type": "inbox.messageSent",
|
|
72
72
|
"data": {"accountId": "a1", "type": "nv", "sender": "us", "text": "hi"},
|
|
73
73
|
}
|
|
74
74
|
)
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
assert isinstance(event, MessageWebhookEvent)
|
|
78
|
-
assert event.type == "
|
|
78
|
+
assert event.type == "inbox.messageSent"
|
|
79
79
|
assert event.data.type == "nv"
|
|
80
80
|
|
|
81
81
|
|
|
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
|