linkedapi 1.0.2__tar.gz → 1.1.1__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.0.2 → linkedapi-1.1.1}/.gitignore +1 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/PKG-INFO +1 -1
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/__init__.py +9 -1
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/__init__.py +2 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/accounts.py +23 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/admin.py +3 -1
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/subscription.py +0 -18
- linkedapi-1.1.1/linkedapi/admin/webhooks.py +82 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/client.py +36 -1
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/errors.py +4 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/__init__.py +4 -0
- linkedapi-1.1.1/linkedapi/operations/nv_sync_inbox.py +12 -0
- linkedapi-1.1.1/linkedapi/operations/sync_inbox.py +12 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/__init__.py +58 -10
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/admin/__init__.py +8 -10
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/admin/accounts.py +22 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/admin/subscription.py +0 -21
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/message.py +30 -3
- linkedapi-1.1.1/linkedapi/types/webhooks.py +128 -0
- linkedapi-1.1.1/linkedapi/webhooks/__init__.py +3 -0
- linkedapi-1.1.1/linkedapi/webhooks/parse.py +51 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/pyproject.toml +1 -1
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_admin.py +9 -6
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_direct_methods.py +58 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_errors.py +2 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_operations.py +7 -1
- linkedapi-1.1.1/tests/test_webhooks.py +84 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/LICENSE +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/README.md +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/config.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/http/base.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/__init__.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/send_message.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/py.typed +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/account.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/base.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/company.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/connection.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/params.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/person.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/post.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/conftest.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_http_client.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_mappers.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_models.py +0 -0
- {linkedapi-1.0.2 → linkedapi-1.1.1}/tests/test_polling.py +0 -0
|
@@ -3,6 +3,7 @@ from linkedapi.admin import (
|
|
|
3
3
|
AdminHttpClient,
|
|
4
4
|
AdminLimits,
|
|
5
5
|
AdminSubscription,
|
|
6
|
+
AdminWebhooks,
|
|
6
7
|
LinkedApiAdmin,
|
|
7
8
|
)
|
|
8
9
|
from linkedapi.client import LinkedApi
|
|
@@ -48,6 +49,7 @@ from linkedapi.operations import (
|
|
|
48
49
|
NvSearchPeople,
|
|
49
50
|
NvSendMessage,
|
|
50
51
|
NvSyncConversation,
|
|
52
|
+
NvSyncInbox,
|
|
51
53
|
ReactToPost,
|
|
52
54
|
RemoveConnection,
|
|
53
55
|
RetrieveConnections,
|
|
@@ -60,12 +62,14 @@ from linkedapi.operations import (
|
|
|
60
62
|
SendConnectionRequest,
|
|
61
63
|
SendMessage,
|
|
62
64
|
SyncConversation,
|
|
65
|
+
SyncInbox,
|
|
63
66
|
WithdrawConnectionRequest,
|
|
64
67
|
)
|
|
65
68
|
from linkedapi.types import * # noqa: F403
|
|
66
69
|
from linkedapi.types import __all__ as _types_all
|
|
70
|
+
from linkedapi.webhooks import parse_webhook_event
|
|
67
71
|
|
|
68
|
-
__version__ = "1.
|
|
72
|
+
__version__ = "1.1.1"
|
|
69
73
|
PredefinedOperation = Operation
|
|
70
74
|
|
|
71
75
|
__all__ = [
|
|
@@ -74,6 +78,7 @@ __all__ = [
|
|
|
74
78
|
"AdminHttpClient",
|
|
75
79
|
"AdminLimits",
|
|
76
80
|
"AdminSubscription",
|
|
81
|
+
"AdminWebhooks",
|
|
77
82
|
"ActionConfig",
|
|
78
83
|
"ArrayWorkflowMapper",
|
|
79
84
|
"BaseMapper",
|
|
@@ -109,6 +114,7 @@ __all__ = [
|
|
|
109
114
|
"NvSearchPeople",
|
|
110
115
|
"NvSendMessage",
|
|
111
116
|
"NvSyncConversation",
|
|
117
|
+
"NvSyncInbox",
|
|
112
118
|
"Operation",
|
|
113
119
|
"PredefinedOperation",
|
|
114
120
|
"ReactToPost",
|
|
@@ -125,9 +131,11 @@ __all__ = [
|
|
|
125
131
|
"SendMessage",
|
|
126
132
|
"SimpleWorkflowMapper",
|
|
127
133
|
"SyncConversation",
|
|
134
|
+
"SyncInbox",
|
|
128
135
|
"ThenWorkflowMapper",
|
|
129
136
|
"VoidWorkflowMapper",
|
|
130
137
|
"WithdrawConnectionRequest",
|
|
131
138
|
"__version__",
|
|
139
|
+
"parse_webhook_event",
|
|
132
140
|
"poll_workflow_result",
|
|
133
141
|
]
|
|
@@ -3,11 +3,13 @@ from linkedapi.admin.admin import LinkedApiAdmin
|
|
|
3
3
|
from linkedapi.admin.http_client import AdminHttpClient
|
|
4
4
|
from linkedapi.admin.limits import AdminLimits
|
|
5
5
|
from linkedapi.admin.subscription import AdminSubscription
|
|
6
|
+
from linkedapi.admin.webhooks import AdminWebhooks
|
|
6
7
|
|
|
7
8
|
__all__ = [
|
|
8
9
|
"AdminAccounts",
|
|
9
10
|
"AdminHttpClient",
|
|
10
11
|
"AdminLimits",
|
|
11
12
|
"AdminSubscription",
|
|
13
|
+
"AdminWebhooks",
|
|
12
14
|
"LinkedApiAdmin",
|
|
13
15
|
]
|
|
@@ -11,10 +11,14 @@ from linkedapi.types.admin import (
|
|
|
11
11
|
CancelConnectionSessionParams,
|
|
12
12
|
ConnectionSessionResult,
|
|
13
13
|
CreateConnectionSessionResult,
|
|
14
|
+
CreateReconnectionSessionParams,
|
|
15
|
+
CreateReconnectionSessionResult,
|
|
14
16
|
DisconnectParams,
|
|
15
17
|
GetConnectionSessionParams,
|
|
16
18
|
RegenerateTokenParams,
|
|
17
19
|
RegenerateTokenResult,
|
|
20
|
+
ReparseAccountInfoParams,
|
|
21
|
+
ReparseAccountInfoResult,
|
|
18
22
|
)
|
|
19
23
|
|
|
20
24
|
TModel = TypeVar("TModel", bound=BaseModel)
|
|
@@ -30,6 +34,14 @@ class AdminAccounts:
|
|
|
30
34
|
def disconnect(self, params: DisconnectParams) -> None:
|
|
31
35
|
self._post_void("/admin/accounts.disconnect", "Failed to disconnect account", params)
|
|
32
36
|
|
|
37
|
+
def reparse_account_info(self, params: ReparseAccountInfoParams) -> ReparseAccountInfoResult:
|
|
38
|
+
return self._post_result(
|
|
39
|
+
"/admin/accounts.reparseAccountInfo",
|
|
40
|
+
ReparseAccountInfoResult,
|
|
41
|
+
"Failed to reparse account info",
|
|
42
|
+
params,
|
|
43
|
+
)
|
|
44
|
+
|
|
33
45
|
def regenerate_identification_token(
|
|
34
46
|
self,
|
|
35
47
|
params: RegenerateTokenParams,
|
|
@@ -48,6 +60,17 @@ class AdminAccounts:
|
|
|
48
60
|
"Failed to create connection session",
|
|
49
61
|
)
|
|
50
62
|
|
|
63
|
+
def create_reconnection_session(
|
|
64
|
+
self,
|
|
65
|
+
params: CreateReconnectionSessionParams,
|
|
66
|
+
) -> CreateReconnectionSessionResult:
|
|
67
|
+
return self._post_result(
|
|
68
|
+
"/admin/accounts.createReconnectionSession",
|
|
69
|
+
CreateReconnectionSessionResult,
|
|
70
|
+
"Failed to create reconnection session",
|
|
71
|
+
params,
|
|
72
|
+
)
|
|
73
|
+
|
|
51
74
|
def get_connection_session(
|
|
52
75
|
self,
|
|
53
76
|
params: GetConnectionSessionParams,
|
|
@@ -6,12 +6,13 @@ from linkedapi.admin.accounts import AdminAccounts
|
|
|
6
6
|
from linkedapi.admin.http_client import AdminHttpClient
|
|
7
7
|
from linkedapi.admin.limits import AdminLimits
|
|
8
8
|
from linkedapi.admin.subscription import AdminSubscription
|
|
9
|
+
from linkedapi.admin.webhooks import AdminWebhooks
|
|
9
10
|
from linkedapi.http import HttpClient
|
|
10
11
|
from linkedapi.types.admin import AdminConfig
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class LinkedApiAdmin:
|
|
14
|
-
"""Admin SDK for Linked API subscription, account, and
|
|
15
|
+
"""Admin SDK for Linked API subscription, account, limit, and webhook management."""
|
|
15
16
|
|
|
16
17
|
def __init__(self, config: AdminConfig | HttpClient[Any]) -> None:
|
|
17
18
|
http_client = (
|
|
@@ -20,3 +21,4 @@ class LinkedApiAdmin:
|
|
|
20
21
|
self.subscription = AdminSubscription(http_client)
|
|
21
22
|
self.accounts = AdminAccounts(http_client)
|
|
22
23
|
self.limits = AdminLimits(http_client)
|
|
24
|
+
self.webhooks = AdminWebhooks(http_client)
|
|
@@ -7,11 +7,8 @@ from pydantic import BaseModel
|
|
|
7
7
|
from linkedapi.errors import LinkedApiError
|
|
8
8
|
from linkedapi.http import HttpClient
|
|
9
9
|
from linkedapi.types.admin import (
|
|
10
|
-
BillingLinkResult,
|
|
11
|
-
CancelResult,
|
|
12
10
|
SetSeatsParams,
|
|
13
11
|
SetSeatsResult,
|
|
14
|
-
SubscriptionPricingResult,
|
|
15
12
|
SubscriptionSeatsResult,
|
|
16
13
|
SubscriptionStatus,
|
|
17
14
|
)
|
|
@@ -33,26 +30,11 @@ class AdminSubscription:
|
|
|
33
30
|
"/admin/subscription.getSeats", SubscriptionSeatsResult, "Failed to get seats"
|
|
34
31
|
)
|
|
35
32
|
|
|
36
|
-
def get_pricing(self) -> SubscriptionPricingResult:
|
|
37
|
-
return self._post_result(
|
|
38
|
-
"/admin/subscription.getPricing", SubscriptionPricingResult, "Failed to get pricing"
|
|
39
|
-
)
|
|
40
|
-
|
|
41
33
|
def set_seats(self, params: SetSeatsParams) -> SetSeatsResult:
|
|
42
34
|
return self._post_result(
|
|
43
35
|
"/admin/subscription.setSeats", SetSeatsResult, "Failed to set seats", params
|
|
44
36
|
)
|
|
45
37
|
|
|
46
|
-
def get_billing_link(self) -> BillingLinkResult:
|
|
47
|
-
return self._post_result(
|
|
48
|
-
"/admin/subscription.getBillingLink", BillingLinkResult, "Failed to get billing link"
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
def cancel(self) -> CancelResult:
|
|
52
|
-
return self._post_result(
|
|
53
|
-
"/admin/subscription.cancel", CancelResult, "Failed to cancel subscription"
|
|
54
|
-
)
|
|
55
|
-
|
|
56
38
|
def _post_result(
|
|
57
39
|
self,
|
|
58
40
|
path: str,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from linkedapi.errors import LinkedApiError
|
|
6
|
+
from linkedapi.http import HttpClient
|
|
7
|
+
from linkedapi.types.webhooks import (
|
|
8
|
+
DeleteWebhookParams,
|
|
9
|
+
ReplayWebhookDeliveryParams,
|
|
10
|
+
SetWebhookParams,
|
|
11
|
+
SetWebhookPayloadModeParams,
|
|
12
|
+
WebhookDelivery,
|
|
13
|
+
WebhookSubscription,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AdminWebhooks:
|
|
18
|
+
"""Manage the client's registered outbound webhook and inspect recent deliveries.
|
|
19
|
+
|
|
20
|
+
A client may hold at most one active webhook. It receives every event Linked API emits
|
|
21
|
+
(workflow lifecycle + account status changes); filter by the event ``type`` on your receiver.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, http_client: HttpClient[Any]) -> None:
|
|
25
|
+
self.http_client = http_client
|
|
26
|
+
|
|
27
|
+
def set(self, params: SetWebhookParams) -> WebhookSubscription:
|
|
28
|
+
result = self._post_result("/admin/webhook.set", "Failed to set webhook", params)
|
|
29
|
+
return WebhookSubscription.model_validate(result["webhook"])
|
|
30
|
+
|
|
31
|
+
def get(self) -> list[WebhookSubscription]:
|
|
32
|
+
result = self._post_result("/admin/webhook.get", "Failed to get webhooks")
|
|
33
|
+
return [WebhookSubscription.model_validate(item) for item in result["webhooks"]]
|
|
34
|
+
|
|
35
|
+
def set_payload_mode(self, params: SetWebhookPayloadModeParams) -> WebhookSubscription:
|
|
36
|
+
result = self._post_result(
|
|
37
|
+
"/admin/webhook.setPayloadMode",
|
|
38
|
+
"Failed to set webhook payload mode",
|
|
39
|
+
params,
|
|
40
|
+
)
|
|
41
|
+
return WebhookSubscription.model_validate(result["webhook"])
|
|
42
|
+
|
|
43
|
+
def delete(self, params: DeleteWebhookParams) -> None:
|
|
44
|
+
self._post_void("/admin/webhook.delete", "Failed to delete webhook", params)
|
|
45
|
+
|
|
46
|
+
def deliveries(self) -> list[WebhookDelivery]:
|
|
47
|
+
result = self._post_result("/admin/webhook.deliveries", "Failed to get webhook deliveries")
|
|
48
|
+
return [WebhookDelivery.model_validate(item) for item in result["deliveries"]]
|
|
49
|
+
|
|
50
|
+
def replay_delivery(self, params: ReplayWebhookDeliveryParams) -> None:
|
|
51
|
+
self._post_void(
|
|
52
|
+
"/admin/webhook.replayDelivery",
|
|
53
|
+
"Failed to replay webhook delivery",
|
|
54
|
+
params,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def send_test(self) -> None:
|
|
58
|
+
self._post_void("/admin/webhook.sendTest", "Failed to send test webhook")
|
|
59
|
+
|
|
60
|
+
def _post_result(
|
|
61
|
+
self,
|
|
62
|
+
path: str,
|
|
63
|
+
default_message: str,
|
|
64
|
+
params: Any | None = None,
|
|
65
|
+
) -> dict[str, Any]:
|
|
66
|
+
response = self.http_client.post(path, params)
|
|
67
|
+
if response.success and response.result is not None:
|
|
68
|
+
result: dict[str, Any] = response.result
|
|
69
|
+
return result
|
|
70
|
+
raise LinkedApiError(
|
|
71
|
+
response.error.type if response.error else "httpError",
|
|
72
|
+
response.error.message if response.error else default_message,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
def _post_void(self, path: str, default_message: str, params: Any | None = None) -> None:
|
|
76
|
+
response = self.http_client.post(path, params)
|
|
77
|
+
if response.success:
|
|
78
|
+
return
|
|
79
|
+
raise LinkedApiError(
|
|
80
|
+
response.error.type if response.error else "httpError",
|
|
81
|
+
response.error.message if response.error else default_message,
|
|
82
|
+
)
|
|
@@ -22,6 +22,7 @@ from linkedapi.operations import (
|
|
|
22
22
|
NvSearchPeople,
|
|
23
23
|
NvSendMessage,
|
|
24
24
|
NvSyncConversation,
|
|
25
|
+
NvSyncInbox,
|
|
25
26
|
ReactToPost,
|
|
26
27
|
RemoveConnection,
|
|
27
28
|
RetrieveConnections,
|
|
@@ -34,10 +35,16 @@ from linkedapi.operations import (
|
|
|
34
35
|
SendConnectionRequest,
|
|
35
36
|
SendMessage,
|
|
36
37
|
SyncConversation,
|
|
38
|
+
SyncInbox,
|
|
37
39
|
WithdrawConnectionRequest,
|
|
38
40
|
)
|
|
39
41
|
from linkedapi.types import AccountInfo, LinkedApiActionError, serialize_value
|
|
40
|
-
from linkedapi.types.message import
|
|
42
|
+
from linkedapi.types.message import (
|
|
43
|
+
ConversationPollRequest,
|
|
44
|
+
ConversationPollResult,
|
|
45
|
+
InboxMessage,
|
|
46
|
+
InboxPollRequest,
|
|
47
|
+
)
|
|
41
48
|
from linkedapi.types.statistics import ApiUsageAction, ApiUsageParams
|
|
42
49
|
|
|
43
50
|
|
|
@@ -54,6 +61,7 @@ class LinkedApi:
|
|
|
54
61
|
self.custom_workflow = CustomWorkflow(self.http_client)
|
|
55
62
|
self.send_message = SendMessage(self.http_client)
|
|
56
63
|
self.sync_conversation = SyncConversation(self.http_client)
|
|
64
|
+
self.sync_inbox = SyncInbox(self.http_client)
|
|
57
65
|
self.check_connection_status = CheckConnectionStatus(self.http_client)
|
|
58
66
|
self.send_connection_request = SendConnectionRequest(self.http_client)
|
|
59
67
|
self.withdraw_connection_request = WithdrawConnectionRequest(self.http_client)
|
|
@@ -74,6 +82,7 @@ class LinkedApi:
|
|
|
74
82
|
self.retrieve_performance = RetrievePerformance(self.http_client)
|
|
75
83
|
self.nv_send_message = NvSendMessage(self.http_client)
|
|
76
84
|
self.nv_sync_conversation = NvSyncConversation(self.http_client)
|
|
85
|
+
self.nv_sync_inbox = NvSyncInbox(self.http_client)
|
|
77
86
|
self.nv_search_companies = NvSearchCompanies(self.http_client)
|
|
78
87
|
self.nv_search_people = NvSearchPeople(self.http_client)
|
|
79
88
|
self.nv_fetch_company = NvFetchCompany(self.http_client)
|
|
@@ -83,6 +92,7 @@ class LinkedApi:
|
|
|
83
92
|
self.custom_workflow,
|
|
84
93
|
self.send_message,
|
|
85
94
|
self.sync_conversation,
|
|
95
|
+
self.sync_inbox,
|
|
86
96
|
self.check_connection_status,
|
|
87
97
|
self.send_connection_request,
|
|
88
98
|
self.withdraw_connection_request,
|
|
@@ -103,6 +113,7 @@ class LinkedApi:
|
|
|
103
113
|
self.retrieve_performance,
|
|
104
114
|
self.nv_send_message,
|
|
105
115
|
self.nv_sync_conversation,
|
|
116
|
+
self.nv_sync_inbox,
|
|
106
117
|
self.nv_search_companies,
|
|
107
118
|
self.nv_search_people,
|
|
108
119
|
self.nv_fetch_company,
|
|
@@ -139,6 +150,30 @@ class LinkedApi:
|
|
|
139
150
|
)
|
|
140
151
|
raise
|
|
141
152
|
|
|
153
|
+
def poll_inbox(
|
|
154
|
+
self,
|
|
155
|
+
request: InboxPollRequest | None = None,
|
|
156
|
+
) -> MappedResponse[list[InboxMessage]]:
|
|
157
|
+
"""Read the monitored standard or Sales Navigator inbox, newest messages first."""
|
|
158
|
+
|
|
159
|
+
payload = serialize_value(request) if request is not None else {}
|
|
160
|
+
response = self.http_client.post("/inbox/poll", payload)
|
|
161
|
+
if response.success and response.result is not None:
|
|
162
|
+
messages = response.result.get("messages", [])
|
|
163
|
+
return MappedResponse(
|
|
164
|
+
data=[InboxMessage.model_validate(item) for item in messages],
|
|
165
|
+
errors=[],
|
|
166
|
+
)
|
|
167
|
+
return MappedResponse(
|
|
168
|
+
data=None,
|
|
169
|
+
errors=[
|
|
170
|
+
LinkedApiActionError(
|
|
171
|
+
type=response.error.type if response.error else "",
|
|
172
|
+
message=response.error.message if response.error else "",
|
|
173
|
+
),
|
|
174
|
+
],
|
|
175
|
+
)
|
|
176
|
+
|
|
142
177
|
def get_account_info(self) -> MappedResponse[AccountInfo]:
|
|
143
178
|
"""Retrieve basic information about the current LinkedIn account."""
|
|
144
179
|
|
|
@@ -9,6 +9,8 @@ LinkedApiActionErrorType = Literal[
|
|
|
9
9
|
"alreadyPending",
|
|
10
10
|
"alreadyConnected",
|
|
11
11
|
"emailRequired",
|
|
12
|
+
"noteTooLong",
|
|
13
|
+
"noteLimitExceeded",
|
|
12
14
|
"requestNotAllowed",
|
|
13
15
|
"notPending",
|
|
14
16
|
"retrievingNotAllowed",
|
|
@@ -29,6 +31,8 @@ LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
|
|
|
29
31
|
"alreadyPending",
|
|
30
32
|
"alreadyConnected",
|
|
31
33
|
"emailRequired",
|
|
34
|
+
"noteTooLong",
|
|
35
|
+
"noteLimitExceeded",
|
|
32
36
|
"requestNotAllowed",
|
|
33
37
|
"notPending",
|
|
34
38
|
"retrievingNotAllowed",
|
|
@@ -12,6 +12,7 @@ from linkedapi.operations.nv_search_companies import NvSearchCompanies
|
|
|
12
12
|
from linkedapi.operations.nv_search_people import NvSearchPeople
|
|
13
13
|
from linkedapi.operations.nv_send_message import NvSendMessage
|
|
14
14
|
from linkedapi.operations.nv_sync_conversation import NvSyncConversation
|
|
15
|
+
from linkedapi.operations.nv_sync_inbox import NvSyncInbox
|
|
15
16
|
from linkedapi.operations.react_to_post import ReactToPost
|
|
16
17
|
from linkedapi.operations.remove_connection import RemoveConnection
|
|
17
18
|
from linkedapi.operations.retrieve_connections import RetrieveConnections
|
|
@@ -24,6 +25,7 @@ from linkedapi.operations.search_people import SearchPeople
|
|
|
24
25
|
from linkedapi.operations.send_connection_request import SendConnectionRequest
|
|
25
26
|
from linkedapi.operations.send_message import SendMessage
|
|
26
27
|
from linkedapi.operations.sync_conversation import SyncConversation
|
|
28
|
+
from linkedapi.operations.sync_inbox import SyncInbox
|
|
27
29
|
from linkedapi.operations.withdraw_connection_request import WithdrawConnectionRequest
|
|
28
30
|
|
|
29
31
|
__all__ = [
|
|
@@ -47,6 +49,7 @@ __all__ = [
|
|
|
47
49
|
"NvSearchPeople",
|
|
48
50
|
"NvSendMessage",
|
|
49
51
|
"NvSyncConversation",
|
|
52
|
+
"NvSyncInbox",
|
|
50
53
|
"ReactToPost",
|
|
51
54
|
"RemoveConnection",
|
|
52
55
|
"RetrieveConnections",
|
|
@@ -59,5 +62,6 @@ __all__ = [
|
|
|
59
62
|
"SendConnectionRequest",
|
|
60
63
|
"SendMessage",
|
|
61
64
|
"SyncConversation",
|
|
65
|
+
"SyncInbox",
|
|
62
66
|
"WithdrawConnectionRequest",
|
|
63
67
|
]
|
|
@@ -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 NvSyncInboxParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class NvSyncInbox(Operation[NvSyncInboxParams, None]):
|
|
9
|
+
"""Enable whole-inbox monitoring for Sales Navigator conversations."""
|
|
10
|
+
|
|
11
|
+
operation_name = "nvSyncInbox"
|
|
12
|
+
mapper = VoidWorkflowMapper[NvSyncInboxParams]("nv.syncInbox")
|
|
@@ -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 SyncInboxParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SyncInbox(Operation[SyncInboxParams, None]):
|
|
9
|
+
"""Enable whole-inbox monitoring for standard LinkedIn conversations."""
|
|
10
|
+
|
|
11
|
+
operation_name = "syncInbox"
|
|
12
|
+
mapper = VoidWorkflowMapper[SyncInboxParams]("st.syncInbox")
|
|
@@ -4,15 +4,14 @@ from linkedapi.types.admin import (
|
|
|
4
4
|
AdminAccount,
|
|
5
5
|
AdminAccountStatus,
|
|
6
6
|
AdminConfig,
|
|
7
|
-
BillingLinkResult,
|
|
8
7
|
BillingPeriod,
|
|
9
8
|
CancelConnectionSessionParams,
|
|
10
|
-
CancelResult,
|
|
11
9
|
ConnectionSession,
|
|
12
10
|
ConnectionSessionResult,
|
|
13
11
|
ConnectionSessionStatus,
|
|
14
12
|
CreateConnectionSessionResult,
|
|
15
|
-
|
|
13
|
+
CreateReconnectionSessionParams,
|
|
14
|
+
CreateReconnectionSessionResult,
|
|
16
15
|
DeleteLimitEntry,
|
|
17
16
|
DeleteLimitsParams,
|
|
18
17
|
DisconnectParams,
|
|
@@ -28,6 +27,8 @@ from linkedapi.types.admin import (
|
|
|
28
27
|
PendingConnectionSession,
|
|
29
28
|
RegenerateTokenParams,
|
|
30
29
|
RegenerateTokenResult,
|
|
30
|
+
ReparseAccountInfoParams,
|
|
31
|
+
ReparseAccountInfoResult,
|
|
31
32
|
ResetLimitsParams,
|
|
32
33
|
SeatType,
|
|
33
34
|
SetLimitEntry,
|
|
@@ -35,8 +36,6 @@ from linkedapi.types.admin import (
|
|
|
35
36
|
SetSeatsParams,
|
|
36
37
|
SetSeatsResult,
|
|
37
38
|
SetSeatsStatus,
|
|
38
|
-
SubscriptionPricingResult,
|
|
39
|
-
SubscriptionProduct,
|
|
40
39
|
SubscriptionSeat,
|
|
41
40
|
SubscriptionSeatsResult,
|
|
42
41
|
SubscriptionStatus,
|
|
@@ -102,12 +101,16 @@ from linkedapi.types.message import (
|
|
|
102
101
|
ConversationPollRequest,
|
|
103
102
|
ConversationPollResult,
|
|
104
103
|
ConversationType,
|
|
104
|
+
InboxMessage,
|
|
105
|
+
InboxPollRequest,
|
|
105
106
|
Message,
|
|
106
107
|
MessageSender,
|
|
107
108
|
NvSendMessageParams,
|
|
108
109
|
NvSyncConversationParams,
|
|
110
|
+
NvSyncInboxParams,
|
|
109
111
|
SendMessageParams,
|
|
110
112
|
SyncConversationParams,
|
|
113
|
+
SyncInboxParams,
|
|
111
114
|
)
|
|
112
115
|
from linkedapi.types.params import BaseActionParams, LimitParams, LimitSinceParams
|
|
113
116
|
from linkedapi.types.person import (
|
|
@@ -179,6 +182,28 @@ from linkedapi.types.statistics import (
|
|
|
179
182
|
RetrievePerformanceResult,
|
|
180
183
|
RetrieveSSIResult,
|
|
181
184
|
)
|
|
185
|
+
from linkedapi.types.webhooks import (
|
|
186
|
+
AccountWebhookEvent,
|
|
187
|
+
AccountWebhookEventData,
|
|
188
|
+
AccountWebhookStatus,
|
|
189
|
+
DeleteWebhookParams,
|
|
190
|
+
MessageWebhookEvent,
|
|
191
|
+
MessageWebhookEventData,
|
|
192
|
+
ReplayWebhookDeliveryParams,
|
|
193
|
+
SetWebhookParams,
|
|
194
|
+
SetWebhookPayloadModeParams,
|
|
195
|
+
WebhookDelivery,
|
|
196
|
+
WebhookDeliveryStatus,
|
|
197
|
+
WebhookEvent,
|
|
198
|
+
WebhookEventType,
|
|
199
|
+
WebhookPayloadMode,
|
|
200
|
+
WebhookSubscription,
|
|
201
|
+
WebhookTestEvent,
|
|
202
|
+
WebhookTestEventData,
|
|
203
|
+
WorkflowWebhookEvent,
|
|
204
|
+
WorkflowWebhookEventData,
|
|
205
|
+
WorkflowWebhookStatus,
|
|
206
|
+
)
|
|
182
207
|
from linkedapi.types.workflow import (
|
|
183
208
|
LinkedApiActionError,
|
|
184
209
|
WorkflowCancelResponse,
|
|
@@ -195,6 +220,9 @@ from linkedapi.types.workflow import (
|
|
|
195
220
|
|
|
196
221
|
__all__ = [
|
|
197
222
|
"AccountInfo",
|
|
223
|
+
"AccountWebhookEvent",
|
|
224
|
+
"AccountWebhookEventData",
|
|
225
|
+
"AccountWebhookStatus",
|
|
198
226
|
"AccountsResult",
|
|
199
227
|
"AdminAccount",
|
|
200
228
|
"AdminAccountStatus",
|
|
@@ -210,10 +238,8 @@ __all__ = [
|
|
|
210
238
|
"BaseFetchPersonParamsWide",
|
|
211
239
|
"BaseFetchPostParams",
|
|
212
240
|
"BaseFetchPostParamsWide",
|
|
213
|
-
"BillingLinkResult",
|
|
214
241
|
"BillingPeriod",
|
|
215
242
|
"CancelConnectionSessionParams",
|
|
216
|
-
"CancelResult",
|
|
217
243
|
"CheckConnectionStatusParams",
|
|
218
244
|
"CheckConnectionStatusResult",
|
|
219
245
|
"Comment",
|
|
@@ -231,9 +257,11 @@ __all__ = [
|
|
|
231
257
|
"CreatePostAttachment",
|
|
232
258
|
"CreatePostParams",
|
|
233
259
|
"CreatePostResult",
|
|
234
|
-
"
|
|
260
|
+
"CreateReconnectionSessionParams",
|
|
261
|
+
"CreateReconnectionSessionResult",
|
|
235
262
|
"DeleteLimitEntry",
|
|
236
263
|
"DeleteLimitsParams",
|
|
264
|
+
"DeleteWebhookParams",
|
|
237
265
|
"DisconnectParams",
|
|
238
266
|
"EmploymentType",
|
|
239
267
|
"FetchCompanyParams",
|
|
@@ -247,6 +275,8 @@ __all__ = [
|
|
|
247
275
|
"GetConnectionSessionParams",
|
|
248
276
|
"GetLimitsParams",
|
|
249
277
|
"GetLimitsUsageParams",
|
|
278
|
+
"InboxMessage",
|
|
279
|
+
"InboxPollRequest",
|
|
250
280
|
"Job",
|
|
251
281
|
"JobCurrency",
|
|
252
282
|
"JobDatePosted",
|
|
@@ -271,6 +301,8 @@ __all__ = [
|
|
|
271
301
|
"MaxAnnualRevenue",
|
|
272
302
|
"Message",
|
|
273
303
|
"MessageSender",
|
|
304
|
+
"MessageWebhookEvent",
|
|
305
|
+
"MessageWebhookEventData",
|
|
274
306
|
"MinAnnualRevenue",
|
|
275
307
|
"NvBaseFetchCompanyParams",
|
|
276
308
|
"NvBaseFetchCompanyParamsWide",
|
|
@@ -291,6 +323,7 @@ __all__ = [
|
|
|
291
323
|
"NvSearchPeopleResult",
|
|
292
324
|
"NvSendMessageParams",
|
|
293
325
|
"NvSyncConversationParams",
|
|
326
|
+
"NvSyncInboxParams",
|
|
294
327
|
"PendingConnectionSession",
|
|
295
328
|
"Person",
|
|
296
329
|
"PersonEducation",
|
|
@@ -315,6 +348,9 @@ __all__ = [
|
|
|
315
348
|
"RegenerateTokenParams",
|
|
316
349
|
"RegenerateTokenResult",
|
|
317
350
|
"RemoveConnectionParams",
|
|
351
|
+
"ReparseAccountInfoParams",
|
|
352
|
+
"ReparseAccountInfoResult",
|
|
353
|
+
"ReplayWebhookDeliveryParams",
|
|
318
354
|
"ResetLimitsParams",
|
|
319
355
|
"RetrieveConnectionsFilter",
|
|
320
356
|
"RetrieveConnectionsParams",
|
|
@@ -341,17 +377,26 @@ __all__ = [
|
|
|
341
377
|
"SetSeatsParams",
|
|
342
378
|
"SetSeatsResult",
|
|
343
379
|
"SetSeatsStatus",
|
|
380
|
+
"SetWebhookParams",
|
|
381
|
+
"SetWebhookPayloadModeParams",
|
|
344
382
|
"StCompanyDm",
|
|
345
383
|
"StCompanyEmployee",
|
|
346
384
|
"StCompanyEmployeesFilter",
|
|
347
385
|
"StCompanyEmployeesRetrievalConfig",
|
|
348
|
-
"SubscriptionPricingResult",
|
|
349
|
-
"SubscriptionProduct",
|
|
350
386
|
"SubscriptionSeat",
|
|
351
387
|
"SubscriptionSeatsResult",
|
|
352
388
|
"SubscriptionStatus",
|
|
353
389
|
"SubscriptionStatusValue",
|
|
354
390
|
"SyncConversationParams",
|
|
391
|
+
"SyncInboxParams",
|
|
392
|
+
"WebhookDelivery",
|
|
393
|
+
"WebhookDeliveryStatus",
|
|
394
|
+
"WebhookEvent",
|
|
395
|
+
"WebhookEventType",
|
|
396
|
+
"WebhookPayloadMode",
|
|
397
|
+
"WebhookSubscription",
|
|
398
|
+
"WebhookTestEvent",
|
|
399
|
+
"WebhookTestEventData",
|
|
355
400
|
"WithdrawConnectionRequestParams",
|
|
356
401
|
"WorkflowCancelResponse",
|
|
357
402
|
"WorkflowCompletion",
|
|
@@ -363,6 +408,9 @@ __all__ = [
|
|
|
363
408
|
"WorkflowResponse",
|
|
364
409
|
"WorkflowStartedResponse",
|
|
365
410
|
"WorkflowStatus",
|
|
411
|
+
"WorkflowWebhookEvent",
|
|
412
|
+
"WorkflowWebhookEventData",
|
|
413
|
+
"WorkflowWebhookStatus",
|
|
366
414
|
"YearsOfExperience",
|
|
367
415
|
"dump_model_by_name",
|
|
368
416
|
"serialize_model",
|