linkedapi 1.4.8__tar.gz → 1.4.9__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.4.8 → linkedapi-1.4.9}/PKG-INFO +1 -1
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/__init__.py +3 -1
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/client.py +3 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/__init__.py +2 -0
- linkedapi-1.4.9/linkedapi/operations/nv_retrieve_alerts.py +12 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/__init__.py +10 -0
- linkedapi-1.4.9/linkedapi/types/nv_alerts.py +41 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/pyproject.toml +1 -1
- linkedapi-1.4.9/tests/test_nv_retrieve_alerts.py +135 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_operations.py +2 -1
- {linkedapi-1.4.8 → linkedapi-1.4.9}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/.gitignore +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/LICENSE +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/README.md +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/examples/verify_webhook_signature.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/changelog.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/config.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/errors.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/http/base.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/endorse_person_skills.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/send_message.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/accept_invitation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/create_repost.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/endorse_person_skill.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/endorse_person_skills.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/ignore_invitation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/manage_conversation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_manage_conversation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/react_to_comment.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/reply_to_comment.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_feed.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_invitations.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_profile_viewers.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/search_posts.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/send_message.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/sync_network.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/py.typed +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/account.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/admin/accounts.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/admin/subscription.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/base.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/changelog.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/company.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/connection.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/feed.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/message.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/network.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/params.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/person.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/post.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/profile_viewers.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/search_posts.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/viewer_state.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/webhooks.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/webhooks/headers.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/webhooks/parse.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/linkedapi/webhooks/signature.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/conftest.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_admin.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_admin_webhooks.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_changelog.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_direct_methods.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_endorse_operations.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_errors.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_http_client.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_limits_categories.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_mappers.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_models.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_open_vocabularies.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_polling.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_webhook_signature.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_webhooks.py +0 -0
- {linkedapi-1.4.8 → linkedapi-1.4.9}/tests/test_working_hours_contract.py +0 -0
|
@@ -53,6 +53,7 @@ from linkedapi.operations import (
|
|
|
53
53
|
NvFetchPerson,
|
|
54
54
|
NvFetchPersonMapper,
|
|
55
55
|
NvManageConversation,
|
|
56
|
+
NvRetrieveAlerts,
|
|
56
57
|
NvSearchCompanies,
|
|
57
58
|
NvSearchPeople,
|
|
58
59
|
NvSendMessage,
|
|
@@ -89,7 +90,7 @@ from linkedapi.webhooks import (
|
|
|
89
90
|
verify_webhook_signature,
|
|
90
91
|
)
|
|
91
92
|
|
|
92
|
-
__version__ = "1.4.
|
|
93
|
+
__version__ = "1.4.9"
|
|
93
94
|
PredefinedOperation = Operation
|
|
94
95
|
|
|
95
96
|
__all__ = [
|
|
@@ -137,6 +138,7 @@ __all__ = [
|
|
|
137
138
|
"NvFetchPerson",
|
|
138
139
|
"NvFetchPersonMapper",
|
|
139
140
|
"NvManageConversation",
|
|
141
|
+
"NvRetrieveAlerts",
|
|
140
142
|
"NvSearchCompanies",
|
|
141
143
|
"NvSearchPeople",
|
|
142
144
|
"NvSendMessage",
|
|
@@ -25,6 +25,7 @@ from linkedapi.operations import (
|
|
|
25
25
|
NvFetchCompany,
|
|
26
26
|
NvFetchPerson,
|
|
27
27
|
NvManageConversation,
|
|
28
|
+
NvRetrieveAlerts,
|
|
28
29
|
NvSearchCompanies,
|
|
29
30
|
NvSearchPeople,
|
|
30
31
|
NvSendMessage,
|
|
@@ -114,6 +115,7 @@ class LinkedApi:
|
|
|
114
115
|
self.nv_sync_conversation = NvSyncConversation(self.http_client)
|
|
115
116
|
self.nv_sync_inbox = NvSyncInbox(self.http_client)
|
|
116
117
|
self.nv_manage_conversation = NvManageConversation(self.http_client)
|
|
118
|
+
self.nv_retrieve_alerts = NvRetrieveAlerts(self.http_client)
|
|
117
119
|
self.nv_search_companies = NvSearchCompanies(self.http_client)
|
|
118
120
|
self.nv_search_people = NvSearchPeople(self.http_client)
|
|
119
121
|
self.nv_fetch_company = NvFetchCompany(self.http_client)
|
|
@@ -159,6 +161,7 @@ class LinkedApi:
|
|
|
159
161
|
self.nv_sync_conversation,
|
|
160
162
|
self.nv_sync_inbox,
|
|
161
163
|
self.nv_manage_conversation,
|
|
164
|
+
self.nv_retrieve_alerts,
|
|
162
165
|
self.nv_search_companies,
|
|
163
166
|
self.nv_search_people,
|
|
164
167
|
self.nv_fetch_company,
|
|
@@ -15,6 +15,7 @@ from linkedapi.operations.manage_conversation import ManageConversation
|
|
|
15
15
|
from linkedapi.operations.nv_fetch_company import NvFetchCompany, NvFetchCompanyMapper
|
|
16
16
|
from linkedapi.operations.nv_fetch_person import NvFetchPerson, NvFetchPersonMapper
|
|
17
17
|
from linkedapi.operations.nv_manage_conversation import NvManageConversation
|
|
18
|
+
from linkedapi.operations.nv_retrieve_alerts import NvRetrieveAlerts
|
|
18
19
|
from linkedapi.operations.nv_search_companies import NvSearchCompanies
|
|
19
20
|
from linkedapi.operations.nv_search_people import NvSearchPeople
|
|
20
21
|
from linkedapi.operations.nv_send_message import NvSendMessage
|
|
@@ -66,6 +67,7 @@ __all__ = [
|
|
|
66
67
|
"NvFetchPerson",
|
|
67
68
|
"NvFetchPersonMapper",
|
|
68
69
|
"NvManageConversation",
|
|
70
|
+
"NvRetrieveAlerts",
|
|
69
71
|
"NvSearchCompanies",
|
|
70
72
|
"NvSearchPeople",
|
|
71
73
|
"NvSendMessage",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from linkedapi.core import Operation
|
|
4
|
+
from linkedapi.mappers import ArrayWorkflowMapper
|
|
5
|
+
from linkedapi.types import NvAlert, NvRetrieveAlertsParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class NvRetrieveAlerts(Operation[NvRetrieveAlertsParams, list[NvAlert]]):
|
|
9
|
+
"""Retrieve Sales Navigator lead and account alerts."""
|
|
10
|
+
|
|
11
|
+
operation_name = "nvRetrieveAlerts"
|
|
12
|
+
mapper = ArrayWorkflowMapper[NvRetrieveAlertsParams, NvAlert]("nv.retrieveAlerts", NvAlert)
|
|
@@ -137,6 +137,12 @@ from linkedapi.types.network import (
|
|
|
137
137
|
NetworkPollRequest,
|
|
138
138
|
SyncNetworkParams,
|
|
139
139
|
)
|
|
140
|
+
from linkedapi.types.nv_alerts import (
|
|
141
|
+
NvAlert,
|
|
142
|
+
NvAlertSubject,
|
|
143
|
+
NvRetrieveAlertsFilter,
|
|
144
|
+
NvRetrieveAlertsParams,
|
|
145
|
+
)
|
|
140
146
|
from linkedapi.types.params import BaseActionParams, LimitParams, LimitSinceParams
|
|
141
147
|
from linkedapi.types.person import (
|
|
142
148
|
BaseFetchPersonParams,
|
|
@@ -410,6 +416,8 @@ __all__ = [
|
|
|
410
416
|
"NetworkPollRequest",
|
|
411
417
|
"NetworkWebhookEvent",
|
|
412
418
|
"NetworkWebhookEventData",
|
|
419
|
+
"NvAlert",
|
|
420
|
+
"NvAlertSubject",
|
|
413
421
|
"NvBaseFetchCompanyParams",
|
|
414
422
|
"NvBaseFetchCompanyParamsWide",
|
|
415
423
|
"NvCompany",
|
|
@@ -423,6 +431,8 @@ __all__ = [
|
|
|
423
431
|
"NvManageConversationParams",
|
|
424
432
|
"NvOpenPersonPageParams",
|
|
425
433
|
"NvOpenPersonPageResult",
|
|
434
|
+
"NvRetrieveAlertsFilter",
|
|
435
|
+
"NvRetrieveAlertsParams",
|
|
426
436
|
"NvSearchCompaniesFilter",
|
|
427
437
|
"NvSearchCompaniesParams",
|
|
428
438
|
"NvSearchCompanyResult",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from linkedapi.types.base import LinkedApiModel
|
|
8
|
+
from linkedapi.types.params import BaseActionParams
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NvRetrieveAlertsFilter(LinkedApiModel):
|
|
12
|
+
category: Literal["lead", "account"] | None = None
|
|
13
|
+
types: list[str] | None = None
|
|
14
|
+
since: str | None = None
|
|
15
|
+
exclude_suggested: bool | None = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class NvRetrieveAlertsParams(BaseActionParams):
|
|
19
|
+
limit: int | None = Field(default=None, ge=1, le=1000)
|
|
20
|
+
sort: Literal["latest", "relevance"] | None = None
|
|
21
|
+
filter: NvRetrieveAlertsFilter | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class NvAlertSubject(LinkedApiModel):
|
|
25
|
+
type: Literal["lead", "account"] | str
|
|
26
|
+
urn: str
|
|
27
|
+
name: str | None
|
|
28
|
+
url: str
|
|
29
|
+
saved: bool | None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class NvAlert(LinkedApiModel):
|
|
33
|
+
id: str
|
|
34
|
+
type: str
|
|
35
|
+
published_at: str
|
|
36
|
+
subject: NvAlertSubject
|
|
37
|
+
headline: str | None
|
|
38
|
+
text: str | None
|
|
39
|
+
subline: str | None
|
|
40
|
+
url: str | None
|
|
41
|
+
related_entity_urn: str | None
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
import requests_mock
|
|
7
|
+
from pydantic import ValidationError
|
|
8
|
+
|
|
9
|
+
from linkedapi import (
|
|
10
|
+
LinkedApi,
|
|
11
|
+
LinkedApiConfig,
|
|
12
|
+
NvAlert,
|
|
13
|
+
NvRetrieveAlertsFilter,
|
|
14
|
+
NvRetrieveAlertsParams,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
ALERT = {
|
|
18
|
+
"id": "urn:li:notification:123",
|
|
19
|
+
"type": "FUTURE_MACHINE_TYPE",
|
|
20
|
+
"publishedAt": "2026-10-01T00:00:00.000Z",
|
|
21
|
+
"subject": {
|
|
22
|
+
"type": "lead",
|
|
23
|
+
"urn": "urn:li:fs_salesProfile:123",
|
|
24
|
+
"name": None,
|
|
25
|
+
"url": "https://www.linkedin.com/sales/lead/123",
|
|
26
|
+
"saved": None,
|
|
27
|
+
},
|
|
28
|
+
"headline": None,
|
|
29
|
+
"text": None,
|
|
30
|
+
"subline": None,
|
|
31
|
+
"url": None,
|
|
32
|
+
"relatedEntityUrn": None,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.mark.parametrize(
|
|
37
|
+
"params, expected",
|
|
38
|
+
[
|
|
39
|
+
(NvRetrieveAlertsParams(), {}),
|
|
40
|
+
(
|
|
41
|
+
NvRetrieveAlertsParams(
|
|
42
|
+
limit=1000,
|
|
43
|
+
sort="relevance",
|
|
44
|
+
filter=NvRetrieveAlertsFilter(
|
|
45
|
+
category="account",
|
|
46
|
+
types=["FUTURE_MACHINE_TYPE"],
|
|
47
|
+
since="2026-10-01T00:00:00Z",
|
|
48
|
+
exclude_suggested=True,
|
|
49
|
+
),
|
|
50
|
+
),
|
|
51
|
+
{
|
|
52
|
+
"limit": 1000,
|
|
53
|
+
"sort": "relevance",
|
|
54
|
+
"filter": {
|
|
55
|
+
"category": "account",
|
|
56
|
+
"types": ["FUTURE_MACHINE_TYPE"],
|
|
57
|
+
"since": "2026-10-01T00:00:00Z",
|
|
58
|
+
"excludeSuggested": True,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
),
|
|
62
|
+
(
|
|
63
|
+
NvRetrieveAlertsParams(
|
|
64
|
+
filter=NvRetrieveAlertsFilter(types=[], exclude_suggested=False)
|
|
65
|
+
),
|
|
66
|
+
{"filter": {"types": [], "excludeSuggested": False}},
|
|
67
|
+
),
|
|
68
|
+
],
|
|
69
|
+
)
|
|
70
|
+
def test_alerts_root_mapping_and_nullable_result(
|
|
71
|
+
requests_mock: requests_mock.Mocker,
|
|
72
|
+
params: NvRetrieveAlertsParams,
|
|
73
|
+
expected: dict[str, Any],
|
|
74
|
+
) -> None:
|
|
75
|
+
client = LinkedApi(
|
|
76
|
+
LinkedApiConfig(
|
|
77
|
+
linked_api_token="test", identification_token="test", base_url="https://api.test"
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
requests_mock.post(
|
|
81
|
+
"https://api.test/workflows",
|
|
82
|
+
json={"success": True, "result": {"workflowId": "alerts", "workflowStatus": "pending"}},
|
|
83
|
+
)
|
|
84
|
+
requests_mock.get(
|
|
85
|
+
"https://api.test/workflows/alerts",
|
|
86
|
+
json={
|
|
87
|
+
"success": True,
|
|
88
|
+
"result": {
|
|
89
|
+
"workflowStatus": "completed",
|
|
90
|
+
"completion": {"actionType": "nv.retrieveAlerts", "success": True, "data": [ALERT]},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
)
|
|
94
|
+
operation = client.nv_retrieve_alerts
|
|
95
|
+
assert operation in client.operations
|
|
96
|
+
workflow = operation.execute(params)
|
|
97
|
+
result = operation.result(workflow.workflow_id)
|
|
98
|
+
assert requests_mock.request_history[0].json() == {
|
|
99
|
+
"actionType": "nv.retrieveAlerts",
|
|
100
|
+
**expected,
|
|
101
|
+
}
|
|
102
|
+
assert result.errors == []
|
|
103
|
+
assert result.data is not None
|
|
104
|
+
assert isinstance(result.data[0], NvAlert)
|
|
105
|
+
assert result.data[0].model_dump(by_alias=True) == ALERT
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@pytest.mark.parametrize("limit", [0, 1001])
|
|
109
|
+
def test_alerts_limit_bounds(limit: int) -> None:
|
|
110
|
+
with pytest.raises(ValidationError):
|
|
111
|
+
NvRetrieveAlertsParams(limit=limit)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@pytest.mark.parametrize(
|
|
115
|
+
"completion, expected_data, expected_errors",
|
|
116
|
+
[
|
|
117
|
+
({"success": True, "data": []}, [], []),
|
|
118
|
+
(
|
|
119
|
+
{"success": False, "error": {"type": "unexpectedError", "message": "Capture failed"}},
|
|
120
|
+
None,
|
|
121
|
+
[{"type": "unexpectedError", "message": "Capture failed"}],
|
|
122
|
+
),
|
|
123
|
+
],
|
|
124
|
+
)
|
|
125
|
+
def test_empty_alerts_and_failures_remain_distinct(
|
|
126
|
+
completion: dict[str, Any],
|
|
127
|
+
expected_data: list[Any] | None,
|
|
128
|
+
expected_errors: list[dict[str, str]],
|
|
129
|
+
) -> None:
|
|
130
|
+
mapper = LinkedApi(
|
|
131
|
+
LinkedApiConfig(linked_api_token="test", identification_token="test")
|
|
132
|
+
).nv_retrieve_alerts.mapper
|
|
133
|
+
result = mapper.map_response({"actionType": "nv.retrieveAlerts", **completion})
|
|
134
|
+
assert result.data == expected_data
|
|
135
|
+
assert [error.model_dump() for error in result.errors] == expected_errors
|
|
@@ -59,6 +59,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
59
59
|
"nv_sync_conversation",
|
|
60
60
|
"nv_sync_inbox",
|
|
61
61
|
"nv_manage_conversation",
|
|
62
|
+
"nv_retrieve_alerts",
|
|
62
63
|
"react_to_post",
|
|
63
64
|
"endorse_person_skill",
|
|
64
65
|
"endorse_person_skills",
|
|
@@ -77,7 +78,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
|
|
|
77
78
|
assert hasattr(operation, "execute")
|
|
78
79
|
assert hasattr(operation, "result")
|
|
79
80
|
assert hasattr(operation, "cancel")
|
|
80
|
-
assert len(linkedapi.operations) ==
|
|
81
|
+
assert len(linkedapi.operations) == 44
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
def test_operation_mappers_match_node_contract() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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
|