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.
Files changed (101) hide show
  1. {linkedapi-1.2.0 → linkedapi-1.3.0}/PKG-INFO +1 -1
  2. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/__init__.py +3 -1
  3. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/client.py +28 -0
  4. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/__init__.py +2 -0
  5. linkedapi-1.3.0/linkedapi/mappers/send_message.py +48 -0
  6. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/__init__.py +2 -0
  7. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/send_message.py +2 -2
  8. linkedapi-1.3.0/linkedapi/operations/sync_network.py +12 -0
  9. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/__init__.py +16 -0
  10. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/message.py +5 -0
  11. linkedapi-1.3.0/linkedapi/types/network.py +28 -0
  12. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/webhooks.py +25 -1
  13. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/webhooks/parse.py +3 -0
  14. {linkedapi-1.2.0 → linkedapi-1.3.0}/pyproject.toml +1 -1
  15. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_operations.py +2 -1
  16. {linkedapi-1.2.0 → linkedapi-1.3.0}/.github/workflows/publish.yaml +0 -0
  17. {linkedapi-1.2.0 → linkedapi-1.3.0}/.gitignore +0 -0
  18. {linkedapi-1.2.0 → linkedapi-1.3.0}/LICENSE +0 -0
  19. {linkedapi-1.2.0 → linkedapi-1.3.0}/README.md +0 -0
  20. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/__init__.py +0 -0
  21. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/accounts.py +0 -0
  22. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/admin.py +0 -0
  23. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/http_client.py +0 -0
  24. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/limits.py +0 -0
  25. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/subscription.py +0 -0
  26. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/admin/webhooks.py +0 -0
  27. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/config.py +0 -0
  28. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/__init__.py +0 -0
  29. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/operation.py +0 -0
  30. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/core/polling.py +0 -0
  31. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/errors.py +0 -0
  32. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/__init__.py +0 -0
  33. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/base.py +0 -0
  34. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/http/linked_api_http_client.py +0 -0
  35. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/array.py +0 -0
  36. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/base.py +0 -0
  37. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/simple.py +0 -0
  38. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/then.py +0 -0
  39. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/mappers/void.py +0 -0
  40. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/accept_connection_request.py +0 -0
  41. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/check_connection_status.py +0 -0
  42. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/comment_on_post.py +0 -0
  43. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/create_post.py +0 -0
  44. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/custom_workflow.py +0 -0
  45. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_company.py +0 -0
  46. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_job.py +0 -0
  47. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_person.py +0 -0
  48. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/fetch_post.py +0 -0
  49. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/ignore_connection_request.py +0 -0
  50. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/manage_conversation.py +0 -0
  51. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_company.py +0 -0
  52. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_fetch_person.py +0 -0
  53. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_manage_conversation.py +0 -0
  54. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_search_companies.py +0 -0
  55. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_search_people.py +0 -0
  56. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_send_message.py +0 -0
  57. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_conversation.py +0 -0
  58. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/nv_sync_inbox.py +0 -0
  59. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/react_to_post.py +0 -0
  60. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/remove_connection.py +0 -0
  61. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_connection_requests.py +0 -0
  62. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_connections.py +0 -0
  63. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_pending_requests.py +0 -0
  64. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_performance.py +0 -0
  65. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/retrieve_ssi.py +0 -0
  66. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_companies.py +0 -0
  67. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_jobs.py +0 -0
  68. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/search_people.py +0 -0
  69. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/send_connection_request.py +0 -0
  70. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/sync_conversation.py +0 -0
  71. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/sync_inbox.py +0 -0
  72. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/operations/withdraw_connection_request.py +0 -0
  73. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/py.typed +0 -0
  74. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/account.py +0 -0
  75. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/__init__.py +0 -0
  76. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/accounts.py +0 -0
  77. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/config.py +0 -0
  78. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/limits.py +0 -0
  79. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/admin/subscription.py +0 -0
  80. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/base.py +0 -0
  81. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/company.py +0 -0
  82. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/connection.py +0 -0
  83. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/jobs.py +0 -0
  84. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/params.py +0 -0
  85. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/person.py +0 -0
  86. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/post.py +0 -0
  87. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/responses.py +0 -0
  88. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/search_companies.py +0 -0
  89. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/search_people.py +0 -0
  90. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/statistics.py +0 -0
  91. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/types/workflow.py +0 -0
  92. {linkedapi-1.2.0 → linkedapi-1.3.0}/linkedapi/webhooks/__init__.py +0 -0
  93. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/conftest.py +0 -0
  94. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_admin.py +0 -0
  95. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_direct_methods.py +0 -0
  96. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_errors.py +0 -0
  97. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_http_client.py +0 -0
  98. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_mappers.py +0 -0
  99. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_models.py +0 -0
  100. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_polling.py +0 -0
  101. {linkedapi-1.2.0 → linkedapi-1.3.0}/tests/test_webhooks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: linkedapi
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Official synchronous Python SDK for Linked API.
5
5
  Project-URL: Homepage, https://linkedapi.io
6
6
  Project-URL: Repository, https://github.com/Linked-API/linkedapi-python
@@ -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.0"
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 VoidWorkflowMapper
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 = VoidWorkflowMapper[SendMessageParams]("st.sendMessage")
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 | AccountWebhookEvent | MessageWebhookEvent | WebhookTestEvent
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
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "linkedapi"
7
- version = "1.2.0"
7
+ version = "1.3.0"
8
8
  description = "Official synchronous Python SDK for Linked API."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -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) == 34
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