linkedapi 1.4.6__tar.gz → 1.4.7__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.6 → linkedapi-1.4.7}/PKG-INFO +1 -1
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/__init__.py +5 -1
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/client.py +6 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/errors.py +6 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/__init__.py +2 -0
- linkedapi-1.4.7/linkedapi/mappers/endorse_person_skills.py +84 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/__init__.py +4 -0
- linkedapi-1.4.7/linkedapi/operations/endorse_person_skill.py +12 -0
- linkedapi-1.4.7/linkedapi/operations/endorse_person_skills.py +12 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/__init__.py +8 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/admin/accounts.py +2 -2
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/admin/limits.py +4 -4
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/admin/subscription.py +4 -4
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/connection.py +5 -3
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/jobs.py +2 -2
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/message.py +5 -5
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/network.py +1 -1
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/person.py +20 -3
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/post.py +9 -9
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/profile_viewers.py +5 -3
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/search_posts.py +2 -2
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/viewer_state.py +1 -1
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/webhooks.py +34 -20
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/workflow.py +6 -6
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/webhooks/parse.py +10 -5
- {linkedapi-1.4.6 → linkedapi-1.4.7}/pyproject.toml +1 -1
- linkedapi-1.4.7/tests/test_endorse_operations.py +291 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_errors.py +3 -0
- linkedapi-1.4.7/tests/test_limits_categories.py +106 -0
- linkedapi-1.4.7/tests/test_open_vocabularies.py +351 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_operations.py +3 -1
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_webhooks.py +9 -5
- {linkedapi-1.4.6 → linkedapi-1.4.7}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/.gitignore +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/LICENSE +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/README.md +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/examples/verify_webhook_signature.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/changelog.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/config.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/http/base.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/send_message.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/accept_invitation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/create_repost.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/ignore_invitation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/manage_conversation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_manage_conversation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/react_to_comment.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/reply_to_comment.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_feed.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_invitations.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_profile_viewers.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/search_posts.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/send_message.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/sync_network.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/py.typed +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/account.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/base.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/changelog.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/company.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/feed.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/params.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/webhooks/headers.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/linkedapi/webhooks/signature.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/conftest.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_admin.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_admin_webhooks.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_changelog.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_direct_methods.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_http_client.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_mappers.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_models.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_polling.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_webhook_signature.py +0 -0
- {linkedapi-1.4.6 → linkedapi-1.4.7}/tests/test_working_hours_contract.py +0 -0
|
@@ -36,6 +36,8 @@ from linkedapi.operations import (
|
|
|
36
36
|
CreatePost,
|
|
37
37
|
CreateRepost,
|
|
38
38
|
CustomWorkflow,
|
|
39
|
+
EndorsePersonSkill,
|
|
40
|
+
EndorsePersonSkills,
|
|
39
41
|
FetchCompany,
|
|
40
42
|
FetchCompanyMapper,
|
|
41
43
|
FetchJob,
|
|
@@ -87,7 +89,7 @@ from linkedapi.webhooks import (
|
|
|
87
89
|
verify_webhook_signature,
|
|
88
90
|
)
|
|
89
91
|
|
|
90
|
-
__version__ = "1.4.
|
|
92
|
+
__version__ = "1.4.7"
|
|
91
93
|
PredefinedOperation = Operation
|
|
92
94
|
|
|
93
95
|
__all__ = [
|
|
@@ -106,6 +108,8 @@ __all__ = [
|
|
|
106
108
|
"CreatePost",
|
|
107
109
|
"CreateRepost",
|
|
108
110
|
"CustomWorkflow",
|
|
111
|
+
"EndorsePersonSkill",
|
|
112
|
+
"EndorsePersonSkills",
|
|
109
113
|
"FetchCompany",
|
|
110
114
|
"FetchCompanyMapper",
|
|
111
115
|
"FetchJob",
|
|
@@ -14,6 +14,8 @@ from linkedapi.operations import (
|
|
|
14
14
|
CreatePost,
|
|
15
15
|
CreateRepost,
|
|
16
16
|
CustomWorkflow,
|
|
17
|
+
EndorsePersonSkill,
|
|
18
|
+
EndorsePersonSkills,
|
|
17
19
|
FetchCompany,
|
|
18
20
|
FetchJob,
|
|
19
21
|
FetchPerson,
|
|
@@ -94,6 +96,8 @@ class LinkedApi:
|
|
|
94
96
|
self.search_posts = SearchPosts(self.http_client)
|
|
95
97
|
self.fetch_company = FetchCompany(self.http_client)
|
|
96
98
|
self.fetch_person = FetchPerson(self.http_client)
|
|
99
|
+
self.endorse_person_skill = EndorsePersonSkill(self.http_client)
|
|
100
|
+
self.endorse_person_skills = EndorsePersonSkills(self.http_client)
|
|
97
101
|
self.fetch_post = FetchPost(self.http_client)
|
|
98
102
|
self.fetch_job = FetchJob(self.http_client)
|
|
99
103
|
self.react_to_post = ReactToPost(self.http_client)
|
|
@@ -137,6 +141,8 @@ class LinkedApi:
|
|
|
137
141
|
self.search_posts,
|
|
138
142
|
self.fetch_company,
|
|
139
143
|
self.fetch_person,
|
|
144
|
+
self.endorse_person_skill,
|
|
145
|
+
self.endorse_person_skills,
|
|
140
146
|
self.fetch_post,
|
|
141
147
|
self.fetch_job,
|
|
142
148
|
self.react_to_post,
|
|
@@ -15,6 +15,9 @@ LinkedApiActionErrorType = Literal[
|
|
|
15
15
|
"notPending",
|
|
16
16
|
"retrievingNotAllowed",
|
|
17
17
|
"connectionNotFound",
|
|
18
|
+
"skillNotFound",
|
|
19
|
+
"endorsementUnavailable",
|
|
20
|
+
"limitExceeded",
|
|
18
21
|
"searchingNotAllowed",
|
|
19
22
|
"searchInterfaceMismatch",
|
|
20
23
|
"filterNotApplied",
|
|
@@ -46,6 +49,9 @@ LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
|
|
|
46
49
|
"notPending",
|
|
47
50
|
"retrievingNotAllowed",
|
|
48
51
|
"connectionNotFound",
|
|
52
|
+
"skillNotFound",
|
|
53
|
+
"endorsementUnavailable",
|
|
54
|
+
"limitExceeded",
|
|
49
55
|
"searchingNotAllowed",
|
|
50
56
|
"searchInterfaceMismatch",
|
|
51
57
|
"filterNotApplied",
|
|
@@ -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.endorse_person_skills import EndorsePersonSkillsMapper
|
|
3
4
|
from linkedapi.mappers.send_message import SendMessageMapper
|
|
4
5
|
from linkedapi.mappers.simple import SimpleWorkflowMapper
|
|
5
6
|
from linkedapi.mappers.then import ActionConfig, ResponseMapping, ThenWorkflowMapper
|
|
@@ -9,6 +10,7 @@ __all__ = [
|
|
|
9
10
|
"ActionConfig",
|
|
10
11
|
"ArrayWorkflowMapper",
|
|
11
12
|
"BaseMapper",
|
|
13
|
+
"EndorsePersonSkillsMapper",
|
|
12
14
|
"MappedResponse",
|
|
13
15
|
"ResponseMapping",
|
|
14
16
|
"SendMessageMapper",
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, cast
|
|
4
|
+
|
|
5
|
+
from linkedapi.errors import LinkedApiError
|
|
6
|
+
from linkedapi.mappers.base import (
|
|
7
|
+
BaseMapper,
|
|
8
|
+
MappedResponse,
|
|
9
|
+
as_action_dict,
|
|
10
|
+
parse_action_error,
|
|
11
|
+
parse_result,
|
|
12
|
+
)
|
|
13
|
+
from linkedapi.types import (
|
|
14
|
+
EndorsePersonSkillsParams,
|
|
15
|
+
PersonSkillEndorsement,
|
|
16
|
+
WorkflowCompletion,
|
|
17
|
+
WorkflowDefinition,
|
|
18
|
+
serialize_model,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class EndorsePersonSkillsMapper(
|
|
23
|
+
BaseMapper[EndorsePersonSkillsParams, list[PersonSkillEndorsement]]
|
|
24
|
+
):
|
|
25
|
+
def map_request(self, params: EndorsePersonSkillsParams | None = None) -> WorkflowDefinition:
|
|
26
|
+
serialized = serialize_model(params)
|
|
27
|
+
skill_name_patterns = serialized.pop("skillNamePatterns", None)
|
|
28
|
+
do_for_skills: dict[str, Any] = {
|
|
29
|
+
"actionType": "st.doForSkills",
|
|
30
|
+
"then": {"actionType": "st.endorsePersonSkill"},
|
|
31
|
+
}
|
|
32
|
+
if skill_name_patterns is not None:
|
|
33
|
+
do_for_skills["skillNamePatterns"] = skill_name_patterns
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
"actionType": "st.openPersonPage",
|
|
37
|
+
"basicInfo": False,
|
|
38
|
+
**serialized,
|
|
39
|
+
"then": {"actionType": "st.retrievePersonSkills", "then": do_for_skills},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
def map_response(
|
|
43
|
+
self, completion: WorkflowCompletion
|
|
44
|
+
) -> MappedResponse[list[PersonSkillEndorsement]]:
|
|
45
|
+
action = as_action_dict(completion)
|
|
46
|
+
error = parse_action_error(action.get("error"))
|
|
47
|
+
if error is not None:
|
|
48
|
+
return MappedResponse(data=None, errors=[error])
|
|
49
|
+
|
|
50
|
+
data = action.get("data")
|
|
51
|
+
if data is None:
|
|
52
|
+
raise LinkedApiError.unknown_error()
|
|
53
|
+
then_actions = as_action_dict(data).get("then")
|
|
54
|
+
child_actions = then_actions if isinstance(then_actions, list) else [then_actions]
|
|
55
|
+
for child in child_actions:
|
|
56
|
+
skills_action = as_action_dict(child)
|
|
57
|
+
if skills_action.get("actionType") == "st.retrievePersonSkills":
|
|
58
|
+
return self._map_skills(skills_action)
|
|
59
|
+
raise LinkedApiError.unknown_error()
|
|
60
|
+
|
|
61
|
+
def _map_skills(self, action: dict[str, Any]) -> MappedResponse[list[PersonSkillEndorsement]]:
|
|
62
|
+
error = parse_action_error(action.get("error"))
|
|
63
|
+
if error is not None:
|
|
64
|
+
return MappedResponse(data=None, errors=[error])
|
|
65
|
+
|
|
66
|
+
selected_skills: list[dict[str, Any]] = []
|
|
67
|
+
for skill in action["data"]:
|
|
68
|
+
for child in skill.get("then", []):
|
|
69
|
+
endorsement = as_action_dict(child)
|
|
70
|
+
if endorsement.get("actionType") == "st.endorsePersonSkill":
|
|
71
|
+
selected_skills.append(
|
|
72
|
+
{
|
|
73
|
+
"skillName": skill["name"],
|
|
74
|
+
"success": endorsement["success"],
|
|
75
|
+
"error": endorsement.get("error"),
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
break
|
|
79
|
+
return MappedResponse(
|
|
80
|
+
data=cast(
|
|
81
|
+
list[PersonSkillEndorsement], parse_result(selected_skills, PersonSkillEndorsement)
|
|
82
|
+
),
|
|
83
|
+
errors=[],
|
|
84
|
+
)
|
|
@@ -4,6 +4,8 @@ from linkedapi.operations.comment_on_post import CommentOnPost
|
|
|
4
4
|
from linkedapi.operations.create_post import CreatePost
|
|
5
5
|
from linkedapi.operations.create_repost import CreateRepost
|
|
6
6
|
from linkedapi.operations.custom_workflow import CustomWorkflow
|
|
7
|
+
from linkedapi.operations.endorse_person_skill import EndorsePersonSkill
|
|
8
|
+
from linkedapi.operations.endorse_person_skills import EndorsePersonSkills
|
|
7
9
|
from linkedapi.operations.fetch_company import FetchCompany, FetchCompanyMapper
|
|
8
10
|
from linkedapi.operations.fetch_job import FetchJob, FetchJobMapper
|
|
9
11
|
from linkedapi.operations.fetch_person import FetchPerson, FetchPersonMapper
|
|
@@ -47,6 +49,8 @@ __all__ = [
|
|
|
47
49
|
"CreatePost",
|
|
48
50
|
"CreateRepost",
|
|
49
51
|
"CustomWorkflow",
|
|
52
|
+
"EndorsePersonSkill",
|
|
53
|
+
"EndorsePersonSkills",
|
|
50
54
|
"FetchCompany",
|
|
51
55
|
"FetchCompanyMapper",
|
|
52
56
|
"FetchJob",
|
|
@@ -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 EndorsePersonSkillParams
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EndorsePersonSkill(Operation[EndorsePersonSkillParams, None]):
|
|
9
|
+
"""Endorse a first-degree connection's skill by its exact name."""
|
|
10
|
+
|
|
11
|
+
operation_name = "endorsePersonSkill"
|
|
12
|
+
mapper = VoidWorkflowMapper[EndorsePersonSkillParams]("st.endorsePersonSkill")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from linkedapi.core import Operation
|
|
4
|
+
from linkedapi.mappers import EndorsePersonSkillsMapper
|
|
5
|
+
from linkedapi.types import EndorsePersonSkillsParams, PersonSkillEndorsement
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EndorsePersonSkills(Operation[EndorsePersonSkillsParams, list[PersonSkillEndorsement]]):
|
|
9
|
+
"""Endorse selected skills and return each skill's outcome in profile order."""
|
|
10
|
+
|
|
11
|
+
operation_name = "endorsePersonSkills"
|
|
12
|
+
mapper = EndorsePersonSkillsMapper()
|
|
@@ -142,6 +142,8 @@ from linkedapi.types.person import (
|
|
|
142
142
|
BaseFetchPersonParams,
|
|
143
143
|
BaseFetchPersonParamsWide,
|
|
144
144
|
EmploymentType,
|
|
145
|
+
EndorsePersonSkillParams,
|
|
146
|
+
EndorsePersonSkillsParams,
|
|
145
147
|
FetchPersonParams,
|
|
146
148
|
FetchPersonResult,
|
|
147
149
|
LanguageProficiency,
|
|
@@ -151,6 +153,7 @@ from linkedapi.types.person import (
|
|
|
151
153
|
PersonExperience,
|
|
152
154
|
PersonLanguage,
|
|
153
155
|
PersonSkill,
|
|
156
|
+
PersonSkillEndorsement,
|
|
154
157
|
YearsOfExperience,
|
|
155
158
|
)
|
|
156
159
|
from linkedapi.types.post import (
|
|
@@ -262,6 +265,7 @@ from linkedapi.types.webhooks import (
|
|
|
262
265
|
SetWebhookParams,
|
|
263
266
|
SetWebhookPayloadModeParams,
|
|
264
267
|
SetWebhookSigningParams,
|
|
268
|
+
UnknownWebhookEvent,
|
|
265
269
|
WebhookDelivery,
|
|
266
270
|
WebhookDeliveryStatus,
|
|
267
271
|
WebhookEvent,
|
|
@@ -347,6 +351,8 @@ __all__ = [
|
|
|
347
351
|
"DeleteWebhookParams",
|
|
348
352
|
"DisconnectParams",
|
|
349
353
|
"EmploymentType",
|
|
354
|
+
"EndorsePersonSkillParams",
|
|
355
|
+
"EndorsePersonSkillsParams",
|
|
350
356
|
"FeedPost",
|
|
351
357
|
"FetchCompanyParams",
|
|
352
358
|
"FetchCompanyResult",
|
|
@@ -433,6 +439,7 @@ __all__ = [
|
|
|
433
439
|
"PersonExperience",
|
|
434
440
|
"PersonLanguage",
|
|
435
441
|
"PersonSkill",
|
|
442
|
+
"PersonSkillEndorsement",
|
|
436
443
|
"PersonViewerState",
|
|
437
444
|
"Post",
|
|
438
445
|
"PostActorType",
|
|
@@ -526,6 +533,7 @@ __all__ = [
|
|
|
526
533
|
"SyncConversationResult",
|
|
527
534
|
"SyncInboxParams",
|
|
528
535
|
"SyncNetworkParams",
|
|
536
|
+
"UnknownWebhookEvent",
|
|
529
537
|
"WebhookDelivery",
|
|
530
538
|
"WebhookDeliveryStatus",
|
|
531
539
|
"WebhookEvent",
|
|
@@ -25,7 +25,7 @@ class AdminAccount(LinkedApiModel):
|
|
|
25
25
|
headline: str | None = None
|
|
26
26
|
country_code: str | None = None
|
|
27
27
|
identification_token: str | None = None
|
|
28
|
-
status: AdminAccountStatus | None = None
|
|
28
|
+
status: AdminAccountStatus | str | None = None
|
|
29
29
|
connected_at: str | None = None
|
|
30
30
|
reconnection_session_id: str | None = None
|
|
31
31
|
reconnection_link: str | None = None
|
|
@@ -81,7 +81,7 @@ class GetConnectionSessionParams(LinkedApiModel):
|
|
|
81
81
|
|
|
82
82
|
class ConnectionSession(LinkedApiModel):
|
|
83
83
|
session_id: str | None = None
|
|
84
|
-
status: ConnectionSessionStatus | None = None
|
|
84
|
+
status: ConnectionSessionStatus | str | None = None
|
|
85
85
|
type: str | None = None
|
|
86
86
|
|
|
87
87
|
|
|
@@ -22,15 +22,15 @@ LimitPeriod = Literal["daily", "weekly", "monthly"]
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class Limit(LinkedApiModel):
|
|
25
|
-
category: LimitCategory | None = None
|
|
26
|
-
period: LimitPeriod | None = None
|
|
25
|
+
category: LimitCategory | str | None = None
|
|
26
|
+
period: LimitPeriod | str | None = None
|
|
27
27
|
max_value: int | None = None
|
|
28
28
|
is_enabled: bool | None = None
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class LimitUsage(LinkedApiModel):
|
|
32
|
-
category: LimitCategory | None = None
|
|
33
|
-
period: LimitPeriod | None = None
|
|
32
|
+
category: LimitCategory | str | None = None
|
|
33
|
+
period: LimitPeriod | str | None = None
|
|
34
34
|
max_value: int | None = None
|
|
35
35
|
current_usage: int | None = None
|
|
36
36
|
is_enabled: bool | None = None
|
|
@@ -11,15 +11,15 @@ SetSeatsStatus = Literal["complete", "processing"]
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class SubscriptionStatus(LinkedApiModel):
|
|
14
|
-
status: SubscriptionStatusValue | None = None
|
|
14
|
+
status: SubscriptionStatusValue | str | None = None
|
|
15
15
|
eligible_for_trial: bool | None = None
|
|
16
16
|
cancel_at_period_end: bool | None = None
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class SubscriptionSeat(LinkedApiModel):
|
|
20
|
-
seat_type: SeatType | None = None
|
|
20
|
+
seat_type: SeatType | str | None = None
|
|
21
21
|
quantity: int | None = None
|
|
22
|
-
billing_period: BillingPeriod | None = None
|
|
22
|
+
billing_period: BillingPeriod | str | None = None
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class SetSeatsParams(LinkedApiModel):
|
|
@@ -29,7 +29,7 @@ class SetSeatsParams(LinkedApiModel):
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class SetSeatsResult(LinkedApiModel):
|
|
32
|
-
status: SetSeatsStatus | None = None
|
|
32
|
+
status: SetSeatsStatus | str | None = None
|
|
33
33
|
payment_link: str | None = None
|
|
34
34
|
|
|
35
35
|
|
|
@@ -30,7 +30,7 @@ class CheckConnectionStatusParams(BaseActionParams):
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class CheckConnectionStatusResult(LinkedApiModel):
|
|
33
|
-
connection_status: ConnectionStatus | None = None
|
|
33
|
+
connection_status: ConnectionStatus | str | None = None
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class WithdrawConnectionRequestParams(BaseActionParams):
|
|
@@ -77,7 +77,7 @@ class IgnoreInvitationParams(InvitationTargetParams):
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
class Invitation(LinkedApiModel):
|
|
80
|
-
invitation_type: InvitationType
|
|
80
|
+
invitation_type: InvitationType | str
|
|
81
81
|
name: str
|
|
82
82
|
urn: str | None = None
|
|
83
83
|
public_url: str
|
|
@@ -102,7 +102,9 @@ class Invitation(LinkedApiModel):
|
|
|
102
102
|
"connect": {"headline", "note"},
|
|
103
103
|
"companyFollow": {"company_url", "company_name"},
|
|
104
104
|
"newsletterSubscribe": {"newsletter_url", "newsletter_name"},
|
|
105
|
-
}
|
|
105
|
+
}.get(self.invitation_type)
|
|
106
|
+
if required_fields is None:
|
|
107
|
+
return self
|
|
106
108
|
missing_fields = required_fields - self.model_fields_set
|
|
107
109
|
if missing_fields:
|
|
108
110
|
msg = (
|
|
@@ -85,10 +85,10 @@ JobCurrency = Literal[
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
class JobSalary(LinkedApiModel):
|
|
88
|
-
currency: JobCurrency | None = None
|
|
88
|
+
currency: JobCurrency | str | None = None
|
|
89
89
|
min_amount: float | None = None
|
|
90
90
|
max_amount: float | None = None
|
|
91
|
-
period: SalaryPeriod | None = None
|
|
91
|
+
period: SalaryPeriod | str | None = None
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
class SearchJobsFilter(LinkedApiModel):
|
|
@@ -73,7 +73,7 @@ class ConversationPollRequest(LinkedApiModel):
|
|
|
73
73
|
|
|
74
74
|
class Message(LinkedApiModel):
|
|
75
75
|
id: str | None = None
|
|
76
|
-
sender: MessageSender | None = None
|
|
76
|
+
sender: MessageSender | str | None = None
|
|
77
77
|
text: str | None = None
|
|
78
78
|
time: str | None = None
|
|
79
79
|
thread_id: str | None = None
|
|
@@ -82,7 +82,7 @@ class Message(LinkedApiModel):
|
|
|
82
82
|
class ConversationPollResult(LinkedApiModel):
|
|
83
83
|
person_urn: str | None = None
|
|
84
84
|
person_url: str | None = None
|
|
85
|
-
type: ConversationType | None = None
|
|
85
|
+
type: ConversationType | str | None = None
|
|
86
86
|
messages: list[Message] | None = None
|
|
87
87
|
since: str | None = None
|
|
88
88
|
sync_until: str | None = None
|
|
@@ -101,14 +101,14 @@ class InboxPersonPollRequest(InboxPollRequest):
|
|
|
101
101
|
|
|
102
102
|
class InboxMessage(LinkedApiModel):
|
|
103
103
|
id: str | None = None
|
|
104
|
-
type: ConversationType | None = None
|
|
104
|
+
type: ConversationType | str | None = None
|
|
105
105
|
thread_id: str | None = None
|
|
106
106
|
person_urn: str | None = None
|
|
107
107
|
person_hashed_url: str | None = None
|
|
108
108
|
person_public_url: str | None = None
|
|
109
109
|
# Deprecated: use person_hashed_url. Still returned by the API for compatibility.
|
|
110
110
|
person_url: str | None = None
|
|
111
|
-
sender: MessageSender | None = None
|
|
111
|
+
sender: MessageSender | str | None = None
|
|
112
112
|
text: str | None = None
|
|
113
113
|
time: str | None = None
|
|
114
114
|
|
|
@@ -119,7 +119,7 @@ class InboxPersonMessage(InboxMessage):
|
|
|
119
119
|
|
|
120
120
|
class InboxPersonThread(LinkedApiModel):
|
|
121
121
|
thread_id: str | None = None
|
|
122
|
-
type: ConversationType | None = None
|
|
122
|
+
type: ConversationType | str | None = None
|
|
123
123
|
person_urn: str | None = None
|
|
124
124
|
history_from: str | None = None
|
|
125
125
|
history_complete: bool = False
|
|
@@ -23,7 +23,7 @@ class NetworkPollRequest(LinkedApiModel):
|
|
|
23
23
|
|
|
24
24
|
class NetworkEvent(LinkedApiModel):
|
|
25
25
|
id: str | None = None
|
|
26
|
-
type: NetworkEventType | None = None
|
|
26
|
+
type: NetworkEventType | str | None = None
|
|
27
27
|
person_urn: str | None = None
|
|
28
28
|
person_url: str | None = None
|
|
29
29
|
detected_at: str | None = None
|
|
@@ -5,6 +5,7 @@ from typing import Literal, TypeAlias
|
|
|
5
5
|
from linkedapi.types.params import BaseActionParams, LimitSinceParams
|
|
6
6
|
from linkedapi.types.post import Comment, Post, Reaction
|
|
7
7
|
from linkedapi.types.viewer_state import PersonViewerState
|
|
8
|
+
from linkedapi.types.workflow import LinkedApiActionError
|
|
8
9
|
|
|
9
10
|
EmploymentType = Literal[
|
|
10
11
|
"fullTime",
|
|
@@ -54,12 +55,28 @@ class FetchPersonParams(BaseFetchPersonParams):
|
|
|
54
55
|
reactions_retrieval_config: LimitSinceParams | None = None
|
|
55
56
|
|
|
56
57
|
|
|
58
|
+
class EndorsePersonSkillParams(BaseActionParams):
|
|
59
|
+
person_url: str
|
|
60
|
+
skill_name: str
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class EndorsePersonSkillsParams(BaseActionParams):
|
|
64
|
+
person_url: str
|
|
65
|
+
skill_name_patterns: list[str] | None = None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class PersonSkillEndorsement(BaseActionParams):
|
|
69
|
+
skill_name: str
|
|
70
|
+
success: bool
|
|
71
|
+
error: LinkedApiActionError | None = None
|
|
72
|
+
|
|
73
|
+
|
|
57
74
|
class PersonExperience(BaseActionParams):
|
|
58
75
|
position: str | None = None
|
|
59
76
|
company_name: str | None = None
|
|
60
77
|
company_hashed_url: str | None = None
|
|
61
|
-
employment_type: EmploymentType | None = None
|
|
62
|
-
location_type: LocationType | None = None
|
|
78
|
+
employment_type: EmploymentType | str | None = None
|
|
79
|
+
location_type: LocationType | str | None = None
|
|
63
80
|
description: str | None = None
|
|
64
81
|
duration: int | None = None
|
|
65
82
|
start_time: str | None = None
|
|
@@ -79,7 +96,7 @@ class PersonSkill(BaseActionParams):
|
|
|
79
96
|
|
|
80
97
|
class PersonLanguage(BaseActionParams):
|
|
81
98
|
name: str | None = None
|
|
82
|
-
proficiency: LanguageProficiency | None = None
|
|
99
|
+
proficiency: LanguageProficiency | str | None = None
|
|
83
100
|
|
|
84
101
|
|
|
85
102
|
class Person(BaseActionParams):
|
|
@@ -23,14 +23,14 @@ class ContentViewerState(LinkedApiModel):
|
|
|
23
23
|
company page you administer is False.
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
-
reaction: ReactionType | None = None
|
|
26
|
+
reaction: ReactionType | str | None = None
|
|
27
27
|
is_own: bool | None = None
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class Reaction(LinkedApiModel):
|
|
31
31
|
post_url: str | None = None
|
|
32
32
|
time: str | None = None
|
|
33
|
-
reaction_type: ReactionType | None = None
|
|
33
|
+
reaction_type: ReactionType | str | None = None
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class Comment(LinkedApiModel):
|
|
@@ -85,7 +85,7 @@ ReplyToCommentResult: TypeAlias = CommentResult
|
|
|
85
85
|
class PostCommentAuthor(LinkedApiModel):
|
|
86
86
|
"""The commenter in the same actor shape a post's author has."""
|
|
87
87
|
|
|
88
|
-
type: PostActorType | None = None
|
|
88
|
+
type: PostActorType | str | None = None
|
|
89
89
|
name: str | None = None
|
|
90
90
|
profile_url: str | None = None
|
|
91
91
|
headline: str | None = None
|
|
@@ -101,7 +101,7 @@ class PostComment(LinkedApiModel):
|
|
|
101
101
|
commenter_url: str | None = None
|
|
102
102
|
commenter_name: str | None = None
|
|
103
103
|
commenter_headline: str | None = None
|
|
104
|
-
commenter_type: PostCommenterType | None = None
|
|
104
|
+
commenter_type: PostCommenterType | str | None = None
|
|
105
105
|
time: str | None = None
|
|
106
106
|
text: str | None = None
|
|
107
107
|
image: str | None = None
|
|
@@ -125,12 +125,12 @@ class PostReaction(LinkedApiModel):
|
|
|
125
125
|
engager_url: str | None = None
|
|
126
126
|
engager_name: str | None = None
|
|
127
127
|
engager_headline: str | None = None
|
|
128
|
-
engager_type: PostEngagerType | None = None
|
|
129
|
-
type: ReactionType | None = None
|
|
128
|
+
engager_type: PostEngagerType | str | None = None
|
|
129
|
+
type: ReactionType | str | None = None
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
class PostAuthor(LinkedApiModel):
|
|
133
|
-
type: PostActorType | None = None
|
|
133
|
+
type: PostActorType | str | None = None
|
|
134
134
|
name: str | None = None
|
|
135
135
|
urn: str | None = None
|
|
136
136
|
profile_url: str | None = None
|
|
@@ -142,7 +142,7 @@ class PostAuthor(LinkedApiModel):
|
|
|
142
142
|
|
|
143
143
|
# A reposter carries no viewer_state: only the author's relation to your account is reported.
|
|
144
144
|
class PostReposter(LinkedApiModel):
|
|
145
|
-
type: PostActorType | None = None
|
|
145
|
+
type: PostActorType | str | None = None
|
|
146
146
|
name: str | None = None
|
|
147
147
|
urn: str | None = None
|
|
148
148
|
profile_url: str | None = None
|
|
@@ -153,7 +153,7 @@ class PostReposter(LinkedApiModel):
|
|
|
153
153
|
class Post(LinkedApiModel):
|
|
154
154
|
url: str | None = None
|
|
155
155
|
time: str | None = None
|
|
156
|
-
type: PostType | None = None
|
|
156
|
+
type: PostType | str | None = None
|
|
157
157
|
activity_urn: str | None = None
|
|
158
158
|
author: PostAuthor | None = None
|
|
159
159
|
reposter: PostReposter | None = None
|
|
@@ -16,14 +16,14 @@ class RetrieveProfileViewersParams(BaseActionParams):
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ProfileViewer(LinkedApiModel):
|
|
19
|
-
viewer_type: ProfileViewerType
|
|
19
|
+
viewer_type: ProfileViewerType | str
|
|
20
20
|
viewed_at: str | None
|
|
21
21
|
viewed_ago: str | None
|
|
22
22
|
name: str | None = None
|
|
23
23
|
public_url: str | None = None
|
|
24
24
|
urn: str | None = None
|
|
25
25
|
headline: str | None = None
|
|
26
|
-
connection_degree: Literal[1, 2, 3] | None = None
|
|
26
|
+
connection_degree: Literal[1, 2, 3] | int | None = None
|
|
27
27
|
avatar_url: str | None = None
|
|
28
28
|
description: str | None = None
|
|
29
29
|
search_url: str | None = None
|
|
@@ -50,7 +50,9 @@ class ProfileViewer(LinkedApiModel):
|
|
|
50
50
|
"avatar_url",
|
|
51
51
|
},
|
|
52
52
|
"anonymous": {"description", "search_url"},
|
|
53
|
-
}
|
|
53
|
+
}.get(self.viewer_type)
|
|
54
|
+
if required_fields is None:
|
|
55
|
+
return self
|
|
54
56
|
missing_fields = required_fields - self.model_fields_set
|
|
55
57
|
if missing_fields:
|
|
56
58
|
msg = (
|
|
@@ -84,7 +84,7 @@ class SearchPostActor(LinkedApiModel):
|
|
|
84
84
|
identity anchors on the post's own page, and a search result list has none of them.
|
|
85
85
|
"""
|
|
86
86
|
|
|
87
|
-
type: PostActorType | None = None
|
|
87
|
+
type: PostActorType | str | None = None
|
|
88
88
|
name: str | None = None
|
|
89
89
|
profile_url: str | None = None
|
|
90
90
|
headline: str | None = None
|
|
@@ -97,7 +97,7 @@ class SearchPostResult(LinkedApiModel):
|
|
|
97
97
|
url: str | None = None
|
|
98
98
|
activity_urn: str | None = None
|
|
99
99
|
time: str | None = None
|
|
100
|
-
type: PostType | None = None
|
|
100
|
+
type: PostType | str | None = None
|
|
101
101
|
author: SearchPostActor | None = None
|
|
102
102
|
# Non-null only when "type" is "repost".
|
|
103
103
|
reposter: SearchPostActor | None = None
|