linkedapi 1.5.0__tar.gz → 1.6.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.5.0 → linkedapi-1.6.0}/PKG-INFO +1 -1
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/client.py +93 -2
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/errors.py +6 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/__init__.py +32 -0
- linkedapi-1.6.0/linkedapi/types/signals.py +136 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/webhooks.py +44 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/webhooks/parse.py +3 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/pyproject.toml +1 -1
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_errors.py +3 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_open_vocabularies.py +15 -0
- linkedapi-1.6.0/tests/test_signals.py +217 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/.gitignore +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/LICENSE +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/README.md +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/examples/verify_webhook_signature.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/changelog.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/config.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/http/base.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/endorse_person_skills.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/send_message.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/accept_invitation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/create_repost.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/endorse_person_skill.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/endorse_person_skills.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/ignore_invitation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/manage_conversation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_create_list.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_create_saved_search.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_delete_list.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_delete_saved_search.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_manage_conversation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_remove_account_from_list.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_remove_lead_from_list.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_rename_list.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_retrieve_alerts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_retrieve_list_accounts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_retrieve_list_leads.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_retrieve_lists.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_retrieve_saved_searches.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_save_account.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_save_lead.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_unsave_account.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/nv_unsave_lead.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_archive_project.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_create_project.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_fetch_person.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_rename_project.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_retrieve_project_candidates.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_retrieve_projects.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_save_to_project.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_search_people.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_send_message.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/rc_sync_inbox.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/react_to_comment.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/reply_to_comment.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_feed.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_invitations.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_profile_viewers.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/search_posts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/send_message.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/sync_network.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/py.typed +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/account.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/admin/accounts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/admin/subscription.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/base.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/changelog.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/company.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/connection.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/feed.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/message.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/network.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/nv_alerts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/nv_list_management.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/nv_list_members.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/nv_saved_searches.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/nv_saved_subjects.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/params.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/person.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/post.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/profile_viewers.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/rc_people.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/rc_projects.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/search_posts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/viewer_state.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/webhooks/headers.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/linkedapi/webhooks/signature.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/conftest.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_admin.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_admin_webhooks.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_changelog.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_direct_methods.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_endorse_operations.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_http_client.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_limits_categories.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_mappers.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_models.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_nv_backlog.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_nv_list_management.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_nv_retrieve_alerts.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_nv_saved_subjects.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_operations.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_polling.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_rc_operations.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_webhook_signature.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_webhooks.py +0 -0
- {linkedapi-1.5.0 → linkedapi-1.6.0}/tests/test_working_hours_contract.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from typing import Any, overload
|
|
4
|
-
from urllib.parse import urlencode
|
|
4
|
+
from urllib.parse import quote, urlencode
|
|
5
5
|
|
|
6
6
|
from linkedapi.config import LinkedApiConfig
|
|
7
7
|
from linkedapi.errors import LinkedApiError
|
|
@@ -78,7 +78,7 @@ from linkedapi.operations import (
|
|
|
78
78
|
SyncNetwork,
|
|
79
79
|
WithdrawConnectionRequest,
|
|
80
80
|
)
|
|
81
|
-
from linkedapi.types import AccountInfo, LinkedApiActionError, serialize_value
|
|
81
|
+
from linkedapi.types import AccountInfo, LinkedApiActionError, LinkedApiResponse, serialize_value
|
|
82
82
|
from linkedapi.types.message import (
|
|
83
83
|
ConversationPollRequest,
|
|
84
84
|
ConversationPollResult,
|
|
@@ -88,6 +88,14 @@ from linkedapi.types.message import (
|
|
|
88
88
|
InboxPollRequest,
|
|
89
89
|
)
|
|
90
90
|
from linkedapi.types.network import NetworkEvent, NetworkPollRequest
|
|
91
|
+
from linkedapi.types.signals import (
|
|
92
|
+
CreateSignalParams,
|
|
93
|
+
GetSignalsParams,
|
|
94
|
+
Signal,
|
|
95
|
+
SignalEvent,
|
|
96
|
+
SignalIdParams,
|
|
97
|
+
SignalPollRequest,
|
|
98
|
+
)
|
|
91
99
|
from linkedapi.types.statistics import ApiUsageAction, ApiUsageParams
|
|
92
100
|
|
|
93
101
|
|
|
@@ -352,6 +360,75 @@ class LinkedApi:
|
|
|
352
360
|
],
|
|
353
361
|
)
|
|
354
362
|
|
|
363
|
+
def create_signal(self, params: CreateSignalParams) -> MappedResponse[Signal]:
|
|
364
|
+
"""Create a signal: one thing for the account to watch on LinkedIn.
|
|
365
|
+
|
|
366
|
+
Creating a signal that already exists on the account returns that signal instead of a
|
|
367
|
+
second one. Raises LinkedApiError "invalidRequestPayload" or "signalLimitReached".
|
|
368
|
+
"""
|
|
369
|
+
|
|
370
|
+
result = _signal_result(self.http_client.post("/signals", serialize_value(params)))
|
|
371
|
+
return MappedResponse(data=Signal.model_validate(result), errors=[])
|
|
372
|
+
|
|
373
|
+
def get_signals(self, params: GetSignalsParams | None = None) -> MappedResponse[list[Signal]]:
|
|
374
|
+
"""List the account's signals, optionally only those of one type or status."""
|
|
375
|
+
|
|
376
|
+
query = urlencode(serialize_value(params) if params is not None else {})
|
|
377
|
+
result = _signal_result(self.http_client.get(f"/signals?{query}" if query else "/signals"))
|
|
378
|
+
return MappedResponse(
|
|
379
|
+
data=[Signal.model_validate(item) for item in result.get("signals", [])],
|
|
380
|
+
errors=[],
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
def get_signal(self, params: SignalIdParams) -> MappedResponse[Signal]:
|
|
384
|
+
"""Retrieve one signal. Raises LinkedApiError "signalNotFound"."""
|
|
385
|
+
|
|
386
|
+
result = _signal_result(self.http_client.get(_signal_path(params.signal_id)))
|
|
387
|
+
return MappedResponse(data=Signal.model_validate(result), errors=[])
|
|
388
|
+
|
|
389
|
+
def pause_signal(self, params: SignalIdParams) -> MappedResponse[Signal]:
|
|
390
|
+
"""Pause a signal. A paused signal is not checked; its events stay available.
|
|
391
|
+
|
|
392
|
+
Raises LinkedApiError "signalNotFound" or "signalStopped".
|
|
393
|
+
"""
|
|
394
|
+
|
|
395
|
+
result = _signal_result(self.http_client.post(f"{_signal_path(params.signal_id)}/pause"))
|
|
396
|
+
return MappedResponse(data=Signal.model_validate(result), errors=[])
|
|
397
|
+
|
|
398
|
+
def resume_signal(self, params: SignalIdParams) -> MappedResponse[Signal]:
|
|
399
|
+
"""Resume a paused signal. Its first check reports what appeared while it was paused, as
|
|
400
|
+
far as LinkedIn still shows it.
|
|
401
|
+
|
|
402
|
+
Raises LinkedApiError "signalNotFound", "signalStopped" or "signalLimitReached".
|
|
403
|
+
"""
|
|
404
|
+
|
|
405
|
+
result = _signal_result(self.http_client.post(f"{_signal_path(params.signal_id)}/resume"))
|
|
406
|
+
return MappedResponse(data=Signal.model_validate(result), errors=[])
|
|
407
|
+
|
|
408
|
+
def delete_signal(self, params: SignalIdParams) -> MappedResponse[bool]:
|
|
409
|
+
"""Delete a signal. Its checks stop at once; the events it produced stay available
|
|
410
|
+
through poll_signals. Raises LinkedApiError "signalNotFound"."""
|
|
411
|
+
|
|
412
|
+
result = _signal_result(self.http_client.delete(_signal_path(params.signal_id)))
|
|
413
|
+
return MappedResponse(data=result.get("deleted") is True, errors=[])
|
|
414
|
+
|
|
415
|
+
def poll_signals(
|
|
416
|
+
self,
|
|
417
|
+
request: SignalPollRequest | None = None,
|
|
418
|
+
) -> MappedResponse[list[SignalEvent]]:
|
|
419
|
+
"""Read the events your signals detected, newest first.
|
|
420
|
+
|
|
421
|
+
Pass "since": without it every retained event is returned. On each next request pass the
|
|
422
|
+
"detected_at" of the newest event you have, and process each event once by its "id".
|
|
423
|
+
"""
|
|
424
|
+
|
|
425
|
+
payload = serialize_value(request) if request is not None else {}
|
|
426
|
+
result = _signal_result(self.http_client.post("/signals/poll", payload))
|
|
427
|
+
return MappedResponse(
|
|
428
|
+
data=[SignalEvent.model_validate(item) for item in result.get("events", [])],
|
|
429
|
+
errors=[],
|
|
430
|
+
)
|
|
431
|
+
|
|
355
432
|
def get_account_info(self) -> MappedResponse[AccountInfo]:
|
|
356
433
|
"""Retrieve basic information about the current LinkedIn account."""
|
|
357
434
|
|
|
@@ -377,3 +454,17 @@ class LinkedApi:
|
|
|
377
454
|
response.error.type if response.error else "httpError",
|
|
378
455
|
response.error.message if response.error else "",
|
|
379
456
|
)
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
# Signal ids are opaque ("sigsub-..."), so they are quoted rather than validated.
|
|
460
|
+
def _signal_path(signal_id: str) -> str:
|
|
461
|
+
return f"/signals/{quote(signal_id, safe='')}"
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def _signal_result(response: LinkedApiResponse[Any]) -> Any:
|
|
465
|
+
if response.success and response.result is not None:
|
|
466
|
+
return response.result
|
|
467
|
+
raise LinkedApiError(
|
|
468
|
+
response.error.type if response.error else "httpError",
|
|
469
|
+
response.error.message if response.error else "",
|
|
470
|
+
)
|
|
@@ -155,6 +155,9 @@ LinkedApiErrorType = Literal[
|
|
|
155
155
|
"sessionNotFound",
|
|
156
156
|
"noAvailableSeats",
|
|
157
157
|
"dailyConnectionAttemptsExceeded",
|
|
158
|
+
"signalLimitReached",
|
|
159
|
+
"signalNotFound",
|
|
160
|
+
"signalStopped",
|
|
158
161
|
]
|
|
159
162
|
LINKED_API_ERROR_TYPES: tuple[str, ...] = (
|
|
160
163
|
"linkedApiTokenRequired",
|
|
@@ -180,6 +183,9 @@ LINKED_API_ERROR_TYPES: tuple[str, ...] = (
|
|
|
180
183
|
"sessionNotFound",
|
|
181
184
|
"noAvailableSeats",
|
|
182
185
|
"dailyConnectionAttemptsExceeded",
|
|
186
|
+
"signalLimitReached",
|
|
187
|
+
"signalNotFound",
|
|
188
|
+
"signalStopped",
|
|
183
189
|
)
|
|
184
190
|
|
|
185
191
|
|
|
@@ -310,6 +310,21 @@ from linkedapi.types.search_posts import (
|
|
|
310
310
|
SearchPostsPersonFilter,
|
|
311
311
|
SearchPostsPersonFilterEntry,
|
|
312
312
|
)
|
|
313
|
+
from linkedapi.types.signals import (
|
|
314
|
+
CreateSignalParams,
|
|
315
|
+
GetSignalsParams,
|
|
316
|
+
Signal,
|
|
317
|
+
SignalComment,
|
|
318
|
+
SignalEvent,
|
|
319
|
+
SignalEventType,
|
|
320
|
+
SignalIdParams,
|
|
321
|
+
SignalPollRequest,
|
|
322
|
+
SignalPostSearchFilter,
|
|
323
|
+
SignalReaction,
|
|
324
|
+
SignalStatus,
|
|
325
|
+
SignalStoppedReason,
|
|
326
|
+
SignalType,
|
|
327
|
+
)
|
|
313
328
|
from linkedapi.types.statistics import (
|
|
314
329
|
ApiUsageAction,
|
|
315
330
|
ApiUsageParams,
|
|
@@ -340,6 +355,8 @@ from linkedapi.types.webhooks import (
|
|
|
340
355
|
SetWebhookParams,
|
|
341
356
|
SetWebhookPayloadModeParams,
|
|
342
357
|
SetWebhookSigningParams,
|
|
358
|
+
SignalWebhookEvent,
|
|
359
|
+
SignalWebhookEventData,
|
|
343
360
|
UnknownWebhookEvent,
|
|
344
361
|
WebhookDelivery,
|
|
345
362
|
WebhookDeliveryStatus,
|
|
@@ -420,6 +437,7 @@ __all__ = [
|
|
|
420
437
|
"CreateReconnectionSessionResult",
|
|
421
438
|
"CreateRepostParams",
|
|
422
439
|
"CreateRepostResult",
|
|
440
|
+
"CreateSignalParams",
|
|
423
441
|
"DeleteLimitEntry",
|
|
424
442
|
"DeleteLimitsParams",
|
|
425
443
|
"DeleteWebhookHeaderParams",
|
|
@@ -440,6 +458,7 @@ __all__ = [
|
|
|
440
458
|
"GetConnectionSessionParams",
|
|
441
459
|
"GetLimitsParams",
|
|
442
460
|
"GetLimitsUsageParams",
|
|
461
|
+
"GetSignalsParams",
|
|
443
462
|
"IgnoreInvitationParams",
|
|
444
463
|
"InboxMessage",
|
|
445
464
|
"InboxPersonMessage",
|
|
@@ -657,6 +676,19 @@ __all__ = [
|
|
|
657
676
|
"SetWebhookParams",
|
|
658
677
|
"SetWebhookPayloadModeParams",
|
|
659
678
|
"SetWebhookSigningParams",
|
|
679
|
+
"Signal",
|
|
680
|
+
"SignalComment",
|
|
681
|
+
"SignalEvent",
|
|
682
|
+
"SignalEventType",
|
|
683
|
+
"SignalIdParams",
|
|
684
|
+
"SignalPollRequest",
|
|
685
|
+
"SignalPostSearchFilter",
|
|
686
|
+
"SignalReaction",
|
|
687
|
+
"SignalStatus",
|
|
688
|
+
"SignalStoppedReason",
|
|
689
|
+
"SignalType",
|
|
690
|
+
"SignalWebhookEvent",
|
|
691
|
+
"SignalWebhookEventData",
|
|
660
692
|
"StCompanyDm",
|
|
661
693
|
"StCompanyEmployee",
|
|
662
694
|
"StCompanyEmployeesFilter",
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from linkedapi.types.base import LinkedApiModel
|
|
8
|
+
from linkedapi.types.post import PostAuthor, PostComment, ReactionType
|
|
9
|
+
from linkedapi.types.profile_viewers import ProfileViewer
|
|
10
|
+
from linkedapi.types.search_posts import (
|
|
11
|
+
PostSearchContentType,
|
|
12
|
+
PostSearchPostedBy,
|
|
13
|
+
SearchPostResult,
|
|
14
|
+
SearchPostsCompanyFilterEntry,
|
|
15
|
+
SearchPostsPersonFilterEntry,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
SignalType = Literal[
|
|
19
|
+
"personPosts",
|
|
20
|
+
"companyPosts",
|
|
21
|
+
"postSearch",
|
|
22
|
+
"postEngagement",
|
|
23
|
+
"network",
|
|
24
|
+
"profileViewers",
|
|
25
|
+
]
|
|
26
|
+
SignalStatus = Literal["active", "paused", "stopped"]
|
|
27
|
+
SignalStoppedReason = Literal["targetNotFound", "watchPeriodEnded"]
|
|
28
|
+
SignalEventType = Literal[
|
|
29
|
+
"postPublished",
|
|
30
|
+
"postFound",
|
|
31
|
+
"commentAdded",
|
|
32
|
+
"reactionAdded",
|
|
33
|
+
"profileViewed",
|
|
34
|
+
"connectionAccepted",
|
|
35
|
+
"connectionAdded",
|
|
36
|
+
"connectionRequestReceived",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SignalPostSearchFilter(LinkedApiModel):
|
|
41
|
+
"""The filters a "postSearch" signal accepts: the content search filters other than sort,
|
|
42
|
+
date and author."""
|
|
43
|
+
|
|
44
|
+
content_type: PostSearchContentType | None = None
|
|
45
|
+
posted_by: list[PostSearchPostedBy] | None = None
|
|
46
|
+
mentioning_members: list[SearchPostsPersonFilterEntry] | None = None
|
|
47
|
+
mentioning_companies: list[SearchPostsCompanyFilterEntry] | None = None
|
|
48
|
+
author_companies: list[SearchPostsCompanyFilterEntry] | None = None
|
|
49
|
+
author_industries: list[str] | None = None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class CreateSignalParams(LinkedApiModel):
|
|
53
|
+
"""A signal to create. The "type" decides the target field.
|
|
54
|
+
|
|
55
|
+
"personPosts" takes "person_url", "companyPosts" takes "company_url", "postSearch" takes
|
|
56
|
+
"term" (a phrase or a list of up to three) and an optional "filter", "postEngagement" takes
|
|
57
|
+
"post_url" or "my_posts=True", and "network" and "profileViewers" take none. "label" is your
|
|
58
|
+
own identifier, up to 64 characters, returned with the signal and every event it produces.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
type: SignalType
|
|
62
|
+
label: str | None = Field(default=None, max_length=64)
|
|
63
|
+
person_url: str | None = None
|
|
64
|
+
company_url: str | None = None
|
|
65
|
+
post_url: str | None = None
|
|
66
|
+
my_posts: Literal[True] | None = None
|
|
67
|
+
term: str | list[str] | None = None
|
|
68
|
+
filter: SignalPostSearchFilter | None = None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class GetSignalsParams(LinkedApiModel):
|
|
72
|
+
type: SignalType | None = None
|
|
73
|
+
status: SignalStatus | None = None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class SignalIdParams(LinkedApiModel):
|
|
77
|
+
signal_id: str
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class SignalPollRequest(LinkedApiModel):
|
|
81
|
+
"""Pass "since" as the "detected_at" of the newest event you have; without it every
|
|
82
|
+
retained event is returned."""
|
|
83
|
+
|
|
84
|
+
since: str | None = None
|
|
85
|
+
signal_id: str | None = None
|
|
86
|
+
signal_type: SignalType | None = None
|
|
87
|
+
event_type: SignalEventType | None = None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Signal(LinkedApiModel):
|
|
91
|
+
id: str | None = None
|
|
92
|
+
type: SignalType | str | None = None
|
|
93
|
+
label: str | None = None
|
|
94
|
+
status: SignalStatus | str | None = None
|
|
95
|
+
# Why Linked API stopped the signal; None unless status is "stopped".
|
|
96
|
+
stopped_reason: SignalStoppedReason | str | None = None
|
|
97
|
+
created_at: str | None = None
|
|
98
|
+
baseline_at: str | None = None
|
|
99
|
+
last_checked_at: str | None = None
|
|
100
|
+
next_check_at: str | None = None
|
|
101
|
+
person_url: str | None = None
|
|
102
|
+
company_url: str | None = None
|
|
103
|
+
post_url: str | None = None
|
|
104
|
+
my_posts: bool | None = None
|
|
105
|
+
term: str | list[str] | None = None
|
|
106
|
+
filter: dict[str, Any] | None = None
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class SignalComment(PostComment):
|
|
110
|
+
parent_comment_urn: str | None = None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class SignalReaction(LinkedApiModel):
|
|
114
|
+
actor: PostAuthor | None = None
|
|
115
|
+
type: ReactionType | str | None = None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class SignalEvent(LinkedApiModel):
|
|
119
|
+
"""One event a signal detected. Which subject fields are set depends on "type": "post" for
|
|
120
|
+
postPublished and postFound, "post_url" with "comment" or "reaction", "viewer" for
|
|
121
|
+
profileViewed, and "person_urn" with "person_url" for the connection events."""
|
|
122
|
+
|
|
123
|
+
id: str | None = None
|
|
124
|
+
signal_id: str | None = None
|
|
125
|
+
signal_type: SignalType | str | None = None
|
|
126
|
+
label: str | None = None
|
|
127
|
+
type: SignalEventType | str | None = None
|
|
128
|
+
# When Linked API recorded the event, not when it happened on LinkedIn.
|
|
129
|
+
detected_at: str | None = None
|
|
130
|
+
post: SearchPostResult | None = None
|
|
131
|
+
post_url: str | None = None
|
|
132
|
+
comment: SignalComment | None = None
|
|
133
|
+
reaction: SignalReaction | None = None
|
|
134
|
+
viewer: ProfileViewer | None = None
|
|
135
|
+
person_urn: str | None = None
|
|
136
|
+
person_url: str | None = None
|
|
@@ -6,6 +6,7 @@ from pydantic import SerializerFunctionWrapHandler, model_serializer
|
|
|
6
6
|
|
|
7
7
|
from linkedapi.types.base import LinkedApiModel
|
|
8
8
|
from linkedapi.types.message import InboxType, MessageSender
|
|
9
|
+
from linkedapi.types.signals import SignalEvent
|
|
9
10
|
|
|
10
11
|
WebhookPayloadMode = Literal["thin", "fat"]
|
|
11
12
|
WebhookEventType = Literal[
|
|
@@ -21,6 +22,14 @@ WebhookEventType = Literal[
|
|
|
21
22
|
"network.connectionAccepted",
|
|
22
23
|
"network.connectionAdded",
|
|
23
24
|
"network.connectionRequestReceived",
|
|
25
|
+
"signal.postPublished",
|
|
26
|
+
"signal.postFound",
|
|
27
|
+
"signal.commentAdded",
|
|
28
|
+
"signal.reactionAdded",
|
|
29
|
+
"signal.profileViewed",
|
|
30
|
+
"signal.connectionAccepted",
|
|
31
|
+
"signal.connectionAdded",
|
|
32
|
+
"signal.connectionRequestReceived",
|
|
24
33
|
"webhook.test",
|
|
25
34
|
]
|
|
26
35
|
WebhookEventSelector = Literal[
|
|
@@ -36,10 +45,19 @@ WebhookEventSelector = Literal[
|
|
|
36
45
|
"network.connectionAccepted",
|
|
37
46
|
"network.connectionAdded",
|
|
38
47
|
"network.connectionRequestReceived",
|
|
48
|
+
"signal.postPublished",
|
|
49
|
+
"signal.postFound",
|
|
50
|
+
"signal.commentAdded",
|
|
51
|
+
"signal.reactionAdded",
|
|
52
|
+
"signal.profileViewed",
|
|
53
|
+
"signal.connectionAccepted",
|
|
54
|
+
"signal.connectionAdded",
|
|
55
|
+
"signal.connectionRequestReceived",
|
|
39
56
|
"workflow.*",
|
|
40
57
|
"account.*",
|
|
41
58
|
"inbox.*",
|
|
42
59
|
"network.*",
|
|
60
|
+
"signal.*",
|
|
43
61
|
]
|
|
44
62
|
WebhookDeliveryStatus = Literal["pending", "delivering", "success", "failed"]
|
|
45
63
|
WorkflowWebhookStatus = Literal["pending", "running", "completed", "failed"]
|
|
@@ -222,6 +240,31 @@ class NetworkWebhookEvent(LinkedApiModel):
|
|
|
222
240
|
data: NetworkWebhookEventData
|
|
223
241
|
|
|
224
242
|
|
|
243
|
+
class SignalWebhookEventData(SignalEvent):
|
|
244
|
+
account_id: str | None = None
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class SignalWebhookEvent(LinkedApiModel):
|
|
248
|
+
"""A signal event: "data" is the event exactly as poll_signals returns it, plus account_id."""
|
|
249
|
+
|
|
250
|
+
id: str
|
|
251
|
+
type: (
|
|
252
|
+
Literal[
|
|
253
|
+
"signal.postPublished",
|
|
254
|
+
"signal.postFound",
|
|
255
|
+
"signal.commentAdded",
|
|
256
|
+
"signal.reactionAdded",
|
|
257
|
+
"signal.profileViewed",
|
|
258
|
+
"signal.connectionAccepted",
|
|
259
|
+
"signal.connectionAdded",
|
|
260
|
+
"signal.connectionRequestReceived",
|
|
261
|
+
]
|
|
262
|
+
| str
|
|
263
|
+
)
|
|
264
|
+
created_at: str | None = None
|
|
265
|
+
data: SignalWebhookEventData
|
|
266
|
+
|
|
267
|
+
|
|
225
268
|
class WebhookTestEventData(LinkedApiModel):
|
|
226
269
|
message: str | None = None
|
|
227
270
|
|
|
@@ -245,6 +288,7 @@ WebhookEvent = (
|
|
|
245
288
|
| AccountWebhookEvent
|
|
246
289
|
| MessageWebhookEvent
|
|
247
290
|
| NetworkWebhookEvent
|
|
291
|
+
| SignalWebhookEvent
|
|
248
292
|
| WebhookTestEvent
|
|
249
293
|
| UnknownWebhookEvent
|
|
250
294
|
)
|
|
@@ -7,6 +7,7 @@ from linkedapi.types.webhooks import (
|
|
|
7
7
|
AccountWebhookEvent,
|
|
8
8
|
MessageWebhookEvent,
|
|
9
9
|
NetworkWebhookEvent,
|
|
10
|
+
SignalWebhookEvent,
|
|
10
11
|
UnknownWebhookEvent,
|
|
11
12
|
WebhookEvent,
|
|
12
13
|
WebhookEventType,
|
|
@@ -53,6 +54,8 @@ def parse_webhook_event(raw_body: str | bytes) -> WebhookEvent:
|
|
|
53
54
|
return MessageWebhookEvent.model_validate(parsed)
|
|
54
55
|
if event_type.startswith("network."):
|
|
55
56
|
return NetworkWebhookEvent.model_validate(parsed)
|
|
57
|
+
if event_type.startswith("signal."):
|
|
58
|
+
return SignalWebhookEvent.model_validate(parsed)
|
|
56
59
|
if event_type == "webhook.test":
|
|
57
60
|
return WebhookTestEvent.model_validate(parsed)
|
|
58
61
|
|
|
@@ -39,6 +39,9 @@ def test_error_type_sets_match_node_contract() -> None:
|
|
|
39
39
|
"sessionNotFound",
|
|
40
40
|
"noAvailableSeats",
|
|
41
41
|
"dailyConnectionAttemptsExceeded",
|
|
42
|
+
"signalLimitReached",
|
|
43
|
+
"signalNotFound",
|
|
44
|
+
"signalStopped",
|
|
42
45
|
)
|
|
43
46
|
assert LINKED_API_ACTION_ERROR_TYPES == (
|
|
44
47
|
"personNotFound",
|
|
@@ -58,6 +58,13 @@ RESPONSE_VOCABULARIES = [
|
|
|
58
58
|
("SearchPostActor", "type", "person"),
|
|
59
59
|
("SearchPostResult", "type", "original"),
|
|
60
60
|
("SetSeatsResult", "status", "complete"),
|
|
61
|
+
("Signal", "type", "personPosts"),
|
|
62
|
+
("Signal", "status", "active"),
|
|
63
|
+
("Signal", "stopped_reason", "targetNotFound"),
|
|
64
|
+
("SignalEvent", "type", "postPublished"),
|
|
65
|
+
("SignalEvent", "signal_type", "network"),
|
|
66
|
+
("SignalReaction", "type", "like"),
|
|
67
|
+
("SignalWebhookEvent", "type", "signal.postPublished"),
|
|
61
68
|
("SubscriptionSeat", "seat_type", "core"),
|
|
62
69
|
("SubscriptionSeat", "billing_period", "month"),
|
|
63
70
|
("SubscriptionStatus", "status", "active"),
|
|
@@ -116,6 +123,14 @@ REQUEST_VOCABULARIES = [
|
|
|
116
123
|
("SetWebhookParams", "payload_mode", "thin", False),
|
|
117
124
|
("SetWebhookParams", "events", "workflow.created", True),
|
|
118
125
|
("SetWebhookPayloadModeParams", "payload_mode", "thin", False),
|
|
126
|
+
("CreateSignalParams", "type", "personPosts", False),
|
|
127
|
+
("GetSignalsParams", "type", "network", False),
|
|
128
|
+
("GetSignalsParams", "status", "active", False),
|
|
129
|
+
("SignalPollRequest", "signal_type", "network", False),
|
|
130
|
+
("SignalPollRequest", "event_type", "postPublished", False),
|
|
131
|
+
("SignalPostSearchFilter", "content_type", "videos", False),
|
|
132
|
+
("SignalPostSearchFilter", "posted_by", "me", True),
|
|
133
|
+
("SetWebhookParams", "events", "signal.*", True),
|
|
119
134
|
("StCompanyEmployeesFilter", "connection_degrees", "1st", True),
|
|
120
135
|
]
|
|
121
136
|
|