linkedapi 1.3.10__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {linkedapi-1.3.10 → linkedapi-1.4.0}/PKG-INFO +1 -1
  2. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/__init__.py +5 -1
  3. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/client.py +6 -0
  4. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/errors.py +8 -0
  5. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/__init__.py +4 -0
  6. linkedapi-1.4.0/linkedapi/operations/create_repost.py +15 -0
  7. linkedapi-1.4.0/linkedapi/operations/search_posts.py +15 -0
  8. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/__init__.py +36 -0
  9. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/post.py +46 -7
  10. linkedapi-1.4.0/linkedapi/types/search_posts.py +103 -0
  11. {linkedapi-1.3.10 → linkedapi-1.4.0}/pyproject.toml +1 -1
  12. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_errors.py +4 -0
  13. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_operations.py +158 -1
  14. {linkedapi-1.3.10 → linkedapi-1.4.0}/.github/workflows/publish.yaml +0 -0
  15. {linkedapi-1.3.10 → linkedapi-1.4.0}/.gitignore +0 -0
  16. {linkedapi-1.3.10 → linkedapi-1.4.0}/LICENSE +0 -0
  17. {linkedapi-1.3.10 → linkedapi-1.4.0}/README.md +0 -0
  18. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/__init__.py +0 -0
  19. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/accounts.py +0 -0
  20. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/admin.py +0 -0
  21. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/http_client.py +0 -0
  22. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/limits.py +0 -0
  23. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/subscription.py +0 -0
  24. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/admin/webhooks.py +0 -0
  25. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/config.py +0 -0
  26. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/core/__init__.py +0 -0
  27. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/core/operation.py +0 -0
  28. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/core/polling.py +0 -0
  29. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/http/__init__.py +0 -0
  30. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/http/base.py +0 -0
  31. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/http/linked_api_http_client.py +0 -0
  32. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/__init__.py +0 -0
  33. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/array.py +0 -0
  34. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/base.py +0 -0
  35. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/send_message.py +0 -0
  36. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/simple.py +0 -0
  37. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/then.py +0 -0
  38. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/mappers/void.py +0 -0
  39. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/accept_invitation.py +0 -0
  40. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/check_connection_status.py +0 -0
  41. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/comment_on_post.py +0 -0
  42. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/create_post.py +0 -0
  43. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/custom_workflow.py +0 -0
  44. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/fetch_company.py +0 -0
  45. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/fetch_job.py +0 -0
  46. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/fetch_person.py +0 -0
  47. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/fetch_post.py +0 -0
  48. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/ignore_invitation.py +0 -0
  49. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/manage_conversation.py +0 -0
  50. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_fetch_company.py +0 -0
  51. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_fetch_person.py +0 -0
  52. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_manage_conversation.py +0 -0
  53. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_search_companies.py +0 -0
  54. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_search_people.py +0 -0
  55. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_send_message.py +0 -0
  56. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_sync_conversation.py +0 -0
  57. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/nv_sync_inbox.py +0 -0
  58. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/react_to_comment.py +0 -0
  59. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/react_to_post.py +0 -0
  60. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/remove_connection.py +0 -0
  61. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/reply_to_comment.py +0 -0
  62. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_connections.py +0 -0
  63. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_feed.py +0 -0
  64. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_invitations.py +0 -0
  65. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_pending_requests.py +0 -0
  66. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_performance.py +0 -0
  67. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_profile_viewers.py +0 -0
  68. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/retrieve_ssi.py +0 -0
  69. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/search_companies.py +0 -0
  70. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/search_jobs.py +0 -0
  71. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/search_people.py +0 -0
  72. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/send_connection_request.py +0 -0
  73. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/send_message.py +0 -0
  74. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/sync_conversation.py +0 -0
  75. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/sync_inbox.py +0 -0
  76. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/sync_network.py +0 -0
  77. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/operations/withdraw_connection_request.py +0 -0
  78. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/py.typed +0 -0
  79. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/account.py +0 -0
  80. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/admin/__init__.py +0 -0
  81. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/admin/accounts.py +0 -0
  82. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/admin/config.py +0 -0
  83. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/admin/limits.py +0 -0
  84. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/admin/subscription.py +0 -0
  85. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/base.py +0 -0
  86. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/company.py +0 -0
  87. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/connection.py +0 -0
  88. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/feed.py +0 -0
  89. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/jobs.py +0 -0
  90. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/message.py +0 -0
  91. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/network.py +0 -0
  92. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/params.py +0 -0
  93. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/person.py +0 -0
  94. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/profile_viewers.py +0 -0
  95. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/responses.py +0 -0
  96. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/search_companies.py +0 -0
  97. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/search_people.py +0 -0
  98. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/statistics.py +0 -0
  99. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/webhooks.py +0 -0
  100. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/types/workflow.py +0 -0
  101. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/webhooks/__init__.py +0 -0
  102. {linkedapi-1.3.10 → linkedapi-1.4.0}/linkedapi/webhooks/parse.py +0 -0
  103. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/conftest.py +0 -0
  104. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_admin.py +0 -0
  105. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_direct_methods.py +0 -0
  106. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_http_client.py +0 -0
  107. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_mappers.py +0 -0
  108. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_models.py +0 -0
  109. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_polling.py +0 -0
  110. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_webhooks.py +0 -0
  111. {linkedapi-1.3.10 → linkedapi-1.4.0}/tests/test_working_hours_contract.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: linkedapi
3
- Version: 1.3.10
3
+ Version: 1.4.0
4
4
  Summary: Official synchronous Python SDK for Linked API.
5
5
  Project-URL: Homepage, https://linkedapi.io
6
6
  Project-URL: Repository, https://github.com/Linked-API/linkedapi-python
@@ -33,6 +33,7 @@ from linkedapi.operations import (
33
33
  CheckConnectionStatus,
34
34
  CommentOnPost,
35
35
  CreatePost,
36
+ CreateRepost,
36
37
  CustomWorkflow,
37
38
  FetchCompany,
38
39
  FetchCompanyMapper,
@@ -68,6 +69,7 @@ from linkedapi.operations import (
68
69
  SearchCompanies,
69
70
  SearchJobs,
70
71
  SearchPeople,
72
+ SearchPosts,
71
73
  SendConnectionRequest,
72
74
  SendMessage,
73
75
  SyncConversation,
@@ -79,7 +81,7 @@ from linkedapi.types import * # noqa: F403
79
81
  from linkedapi.types import __all__ as _types_all
80
82
  from linkedapi.webhooks import parse_webhook_event
81
83
 
82
- __version__ = "1.3.9"
84
+ __version__ = "1.3.11"
83
85
  PredefinedOperation = Operation
84
86
 
85
87
  __all__ = [
@@ -96,6 +98,7 @@ __all__ = [
96
98
  "CheckConnectionStatus",
97
99
  "CommentOnPost",
98
100
  "CreatePost",
101
+ "CreateRepost",
99
102
  "CustomWorkflow",
100
103
  "FetchCompany",
101
104
  "FetchCompanyMapper",
@@ -146,6 +149,7 @@ __all__ = [
146
149
  "SearchCompanies",
147
150
  "SearchJobs",
148
151
  "SearchPeople",
152
+ "SearchPosts",
149
153
  "SendConnectionRequest",
150
154
  "SendMessage",
151
155
  "SimpleWorkflowMapper",
@@ -12,6 +12,7 @@ from linkedapi.operations import (
12
12
  CheckConnectionStatus,
13
13
  CommentOnPost,
14
14
  CreatePost,
15
+ CreateRepost,
15
16
  CustomWorkflow,
16
17
  FetchCompany,
17
18
  FetchJob,
@@ -41,6 +42,7 @@ from linkedapi.operations import (
41
42
  SearchCompanies,
42
43
  SearchJobs,
43
44
  SearchPeople,
45
+ SearchPosts,
44
46
  SendConnectionRequest,
45
47
  SendMessage,
46
48
  SyncConversation,
@@ -87,6 +89,7 @@ class LinkedApi:
87
89
  self.search_companies = SearchCompanies(self.http_client)
88
90
  self.search_people = SearchPeople(self.http_client)
89
91
  self.search_jobs = SearchJobs(self.http_client)
92
+ self.search_posts = SearchPosts(self.http_client)
90
93
  self.fetch_company = FetchCompany(self.http_client)
91
94
  self.fetch_person = FetchPerson(self.http_client)
92
95
  self.fetch_post = FetchPost(self.http_client)
@@ -96,6 +99,7 @@ class LinkedApi:
96
99
  self.react_to_comment = ReactToComment(self.http_client)
97
100
  self.reply_to_comment = ReplyToComment(self.http_client)
98
101
  self.create_post = CreatePost(self.http_client)
102
+ self.create_repost = CreateRepost(self.http_client)
99
103
  self.retrieve_feed = RetrieveFeed(self.http_client)
100
104
  self.retrieve_ssi = RetrieveSSI(self.http_client)
101
105
  self.retrieve_performance = RetrievePerformance(self.http_client)
@@ -128,6 +132,7 @@ class LinkedApi:
128
132
  self.search_companies,
129
133
  self.search_people,
130
134
  self.search_jobs,
135
+ self.search_posts,
131
136
  self.fetch_company,
132
137
  self.fetch_person,
133
138
  self.fetch_post,
@@ -137,6 +142,7 @@ class LinkedApi:
137
142
  self.react_to_comment,
138
143
  self.reply_to_comment,
139
144
  self.create_post,
145
+ self.create_repost,
140
146
  self.retrieve_feed,
141
147
  self.retrieve_ssi,
142
148
  self.retrieve_performance,
@@ -17,6 +17,7 @@ LinkedApiActionErrorType = Literal[
17
17
  "connectionNotFound",
18
18
  "searchingNotAllowed",
19
19
  "searchInterfaceMismatch",
20
+ "filterIdentityMismatch",
20
21
  "companyNotFound",
21
22
  "postNotFound",
22
23
  "jobNotFound",
@@ -24,6 +25,9 @@ LinkedApiActionErrorType = Literal[
24
25
  "commentNotFound",
25
26
  "replyingNotAllowed",
26
27
  "noPostingPermission",
28
+ "mentionNotResolved",
29
+ "repostNotAllowed",
30
+ "alreadyReposted",
27
31
  "noSalesNavigator",
28
32
  "conversationsNotSynced",
29
33
  "threadNotFound",
@@ -43,6 +47,7 @@ LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
43
47
  "connectionNotFound",
44
48
  "searchingNotAllowed",
45
49
  "searchInterfaceMismatch",
50
+ "filterIdentityMismatch",
46
51
  "companyNotFound",
47
52
  "postNotFound",
48
53
  "jobNotFound",
@@ -50,6 +55,9 @@ LINKED_API_ACTION_ERROR_TYPES: tuple[str, ...] = (
50
55
  "commentNotFound",
51
56
  "replyingNotAllowed",
52
57
  "noPostingPermission",
58
+ "mentionNotResolved",
59
+ "repostNotAllowed",
60
+ "alreadyReposted",
53
61
  "noSalesNavigator",
54
62
  "conversationsNotSynced",
55
63
  "threadNotFound",
@@ -2,6 +2,7 @@ from linkedapi.operations.accept_invitation import AcceptInvitation
2
2
  from linkedapi.operations.check_connection_status import CheckConnectionStatus
3
3
  from linkedapi.operations.comment_on_post import CommentOnPost
4
4
  from linkedapi.operations.create_post import CreatePost
5
+ from linkedapi.operations.create_repost import CreateRepost
5
6
  from linkedapi.operations.custom_workflow import CustomWorkflow
6
7
  from linkedapi.operations.fetch_company import FetchCompany, FetchCompanyMapper
7
8
  from linkedapi.operations.fetch_job import FetchJob, FetchJobMapper
@@ -31,6 +32,7 @@ from linkedapi.operations.retrieve_ssi import RetrieveSSI
31
32
  from linkedapi.operations.search_companies import SearchCompanies
32
33
  from linkedapi.operations.search_jobs import SearchJobs
33
34
  from linkedapi.operations.search_people import SearchPeople
35
+ from linkedapi.operations.search_posts import SearchPosts
34
36
  from linkedapi.operations.send_connection_request import SendConnectionRequest
35
37
  from linkedapi.operations.send_message import SendMessage
36
38
  from linkedapi.operations.sync_conversation import SyncConversation
@@ -43,6 +45,7 @@ __all__ = [
43
45
  "CheckConnectionStatus",
44
46
  "CommentOnPost",
45
47
  "CreatePost",
48
+ "CreateRepost",
46
49
  "CustomWorkflow",
47
50
  "FetchCompany",
48
51
  "FetchCompanyMapper",
@@ -78,6 +81,7 @@ __all__ = [
78
81
  "SearchCompanies",
79
82
  "SearchJobs",
80
83
  "SearchPeople",
84
+ "SearchPosts",
81
85
  "SendConnectionRequest",
82
86
  "SendMessage",
83
87
  "SyncConversation",
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+
3
+ from linkedapi.core import Operation
4
+ from linkedapi.mappers import SimpleWorkflowMapper
5
+ from linkedapi.types import CreateRepostParams, CreateRepostResult
6
+
7
+
8
+ class CreateRepost(Operation[CreateRepostParams, CreateRepostResult]):
9
+ """Repost a LinkedIn post, either as is or with your own commentary."""
10
+
11
+ operation_name = "createRepost"
12
+ mapper = SimpleWorkflowMapper[CreateRepostParams, CreateRepostResult](
13
+ "st.createRepost",
14
+ result_model=CreateRepostResult,
15
+ )
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+
3
+ from linkedapi.core import Operation
4
+ from linkedapi.mappers import ArrayWorkflowMapper
5
+ from linkedapi.types import SearchPostResult, SearchPostsParams
6
+
7
+
8
+ class SearchPosts(Operation[SearchPostsParams, list[SearchPostResult]]):
9
+ """Search posts on standard LinkedIn."""
10
+
11
+ operation_name = "searchPosts"
12
+ mapper = ArrayWorkflowMapper[SearchPostsParams, SearchPostResult](
13
+ "st.searchPosts",
14
+ SearchPostResult,
15
+ )
@@ -159,6 +159,8 @@ from linkedapi.types.post import (
159
159
  CreatePostAttachment,
160
160
  CreatePostParams,
161
161
  CreatePostResult,
162
+ CreateRepostParams,
163
+ CreateRepostResult,
162
164
  FetchPostParams,
163
165
  FetchPostResult,
164
166
  Post,
@@ -169,10 +171,13 @@ from linkedapi.types.post import (
169
171
  PostCommentsRetrievalConfig,
170
172
  PostCommentsSort,
171
173
  PostEngagerType,
174
+ PostMention,
172
175
  PostReaction,
173
176
  PostReactionsRetrievalConfig,
174
177
  PostReposter,
178
+ PostTargetParams,
175
179
  PostType,
180
+ PublishedPostResult,
176
181
  Reaction,
177
182
  ReactionType,
178
183
  ReactToCommentParams,
@@ -206,6 +211,20 @@ from linkedapi.types.search_people import (
206
211
  SearchPeopleParams,
207
212
  SearchPeopleResult,
208
213
  )
214
+ from linkedapi.types.search_posts import (
215
+ PostSearchContentType,
216
+ PostSearchDatePosted,
217
+ PostSearchPostedBy,
218
+ PostSearchSort,
219
+ SearchPostActor,
220
+ SearchPostResult,
221
+ SearchPostsCompanyFilter,
222
+ SearchPostsCompanyFilterEntry,
223
+ SearchPostsFilter,
224
+ SearchPostsParams,
225
+ SearchPostsPersonFilter,
226
+ SearchPostsPersonFilterEntry,
227
+ )
209
228
  from linkedapi.types.statistics import (
210
229
  ApiUsageAction,
211
230
  ApiUsageParams,
@@ -295,6 +314,8 @@ __all__ = [
295
314
  "CreatePostResult",
296
315
  "CreateReconnectionSessionParams",
297
316
  "CreateReconnectionSessionResult",
317
+ "CreateRepostParams",
318
+ "CreateRepostResult",
298
319
  "DeleteLimitEntry",
299
320
  "DeleteLimitsParams",
300
321
  "DeleteWebhookParams",
@@ -389,12 +410,19 @@ __all__ = [
389
410
  "PostCommentsRetrievalConfig",
390
411
  "PostCommentsSort",
391
412
  "PostEngagerType",
413
+ "PostMention",
392
414
  "PostReaction",
393
415
  "PostReactionsRetrievalConfig",
394
416
  "PostReposter",
417
+ "PostSearchContentType",
418
+ "PostSearchDatePosted",
419
+ "PostSearchPostedBy",
420
+ "PostSearchSort",
421
+ "PostTargetParams",
395
422
  "PostType",
396
423
  "ProfileViewer",
397
424
  "ProfileViewerType",
425
+ "PublishedPostResult",
398
426
  "ReactToCommentParams",
399
427
  "ReactToPostParams",
400
428
  "Reaction",
@@ -428,6 +456,14 @@ __all__ = [
428
456
  "SearchPeopleFilter",
429
457
  "SearchPeopleParams",
430
458
  "SearchPeopleResult",
459
+ "SearchPostActor",
460
+ "SearchPostResult",
461
+ "SearchPostsCompanyFilter",
462
+ "SearchPostsCompanyFilterEntry",
463
+ "SearchPostsFilter",
464
+ "SearchPostsParams",
465
+ "SearchPostsPersonFilter",
466
+ "SearchPostsPersonFilterEntry",
431
467
  "SeatType",
432
468
  "SendConnectionRequestParams",
433
469
  "SendMessageManageConversation",
@@ -28,14 +28,22 @@ class Comment(LinkedApiModel):
28
28
  reactions_count: int | None = None
29
29
 
30
30
 
31
- class ReactToPostParams(BaseActionParams):
32
- post_url: str
31
+ class PostTargetParams(BaseActionParams):
32
+ """A post is addressed by its URL or by its URN.
33
+
34
+ Provide one of the two; when both are given, they must refer to the same post.
35
+ """
36
+
37
+ post_url: str | None = None
38
+ post_urn: str | None = None
39
+
40
+
41
+ class ReactToPostParams(PostTargetParams):
33
42
  type: ReactionType
34
43
  company_url: str | None = None
35
44
 
36
45
 
37
- class CommentOnPostParams(BaseActionParams):
38
- post_url: str
46
+ class CommentOnPostParams(PostTargetParams):
39
47
  text: str
40
48
  company_url: str | None = None
41
49
 
@@ -135,8 +143,7 @@ class PostCommentsRetrievalConfig(LimitParams):
135
143
  PostReactionsRetrievalConfig: TypeAlias = LimitParams
136
144
 
137
145
 
138
- class BaseFetchPostParams(BaseActionParams):
139
- post_url: str
146
+ class BaseFetchPostParams(PostTargetParams):
140
147
  retrieve_comments: bool | None = None
141
148
  retrieve_reactions: bool | None = None
142
149
 
@@ -160,11 +167,43 @@ class CreatePostAttachment(LinkedApiModel):
160
167
  name: str | None = None
161
168
 
162
169
 
170
+ class PostMention(LinkedApiModel):
171
+ """One person or company to mention, bound to a "@[key]" placeholder in the post text.
172
+
173
+ "name" is always required because LinkedIn's composer accepts nothing but typed text. The
174
+ optional identifier decides which of the offered namesakes is taken; with "name" alone the pick
175
+ is whichever suggestion LinkedIn ranked first. Provide at most one identifier.
176
+ """
177
+
178
+ key: str
179
+ name: str
180
+ urn: str | None = None
181
+ person_hashed_url: str | None = None
182
+ company_hashed_url: str | None = None
183
+
184
+
163
185
  class CreatePostParams(BaseActionParams):
164
186
  text: str
187
+ mentions: list[PostMention] | None = None
165
188
  attachments: list[CreatePostAttachment] | None = None
166
189
  company_url: str | None = None
167
190
 
168
191
 
169
- class CreatePostResult(LinkedApiModel):
192
+ class PublishedPostResult(LinkedApiModel):
193
+ """Identifiers of a post this account has just published."""
194
+
170
195
  post_url: str | None = None
196
+ post_urn: str | None = None
197
+
198
+
199
+ CreatePostResult: TypeAlias = PublishedPostResult
200
+
201
+
202
+ class CreateRepostParams(PostTargetParams):
203
+ """Without "text" the post is reposted as is; with "text" the commentary goes above it."""
204
+
205
+ text: str | None = None
206
+ mentions: list[PostMention] | None = None
207
+
208
+
209
+ CreateRepostResult: TypeAlias = PublishedPostResult
@@ -0,0 +1,103 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Literal, TypeAlias
4
+
5
+ from linkedapi.types.base import LinkedApiModel
6
+ from linkedapi.types.params import BaseActionParams, LimitParams
7
+ from linkedapi.types.post import PostActorType, PostType
8
+
9
+ PostSearchSort = Literal["topMatch", "latest"]
10
+ PostSearchDatePosted = Literal["past24Hours", "pastWeek", "pastMonth"]
11
+ PostSearchContentType = Literal["videos", "images", "jobPosts", "liveVideos", "documents"]
12
+ PostSearchPostedBy = Literal["me", "firstConnections", "peopleYouFollow"]
13
+
14
+
15
+ class SearchPostsPersonFilter(LinkedApiModel):
16
+ """One person to narrow a post search by.
17
+
18
+ "name" is always required because LinkedIn's filter panel accepts nothing but typed text. The
19
+ optional identifier decides which of the offered namesakes is taken; with "name" alone the pick
20
+ is whichever suggestion LinkedIn ranked first.
21
+ """
22
+
23
+ name: str
24
+ urn: str | None = None
25
+ person_hashed_url: str | None = None
26
+
27
+
28
+ class SearchPostsCompanyFilter(LinkedApiModel):
29
+ """One company to narrow a post search by. Same contract as SearchPostsPersonFilter."""
30
+
31
+ name: str
32
+ urn: str | None = None
33
+ company_hashed_url: str | None = None
34
+
35
+
36
+ # A plain string is shorthand for the name alone: "Bill Gates" means {"name": "Bill Gates"}.
37
+ # Both forms may be mixed in one list.
38
+ SearchPostsPersonFilterEntry: TypeAlias = SearchPostsPersonFilter | str
39
+ SearchPostsCompanyFilterEntry: TypeAlias = SearchPostsCompanyFilter | str
40
+
41
+
42
+ class SearchPostsFilter(LinkedApiModel):
43
+ """Filtering criteria for the LinkedIn content search.
44
+
45
+ Every specified field is applied, or the action fails. Ignored entirely when
46
+ "custom_search_url" is specified.
47
+ """
48
+
49
+ sort: PostSearchSort | None = None
50
+ date_posted: PostSearchDatePosted | None = None
51
+ content_type: PostSearchContentType | None = None
52
+ posted_by: list[PostSearchPostedBy] | None = None
53
+ from_members: list[SearchPostsPersonFilterEntry] | None = None
54
+ from_companies: list[SearchPostsCompanyFilterEntry] | None = None
55
+ mentioning_members: list[SearchPostsPersonFilterEntry] | None = None
56
+ mentioning_companies: list[SearchPostsCompanyFilterEntry] | None = None
57
+ author_companies: list[SearchPostsCompanyFilterEntry] | None = None
58
+ author_industries: list[str] | None = None
59
+
60
+
61
+ class SearchPostsParams(BaseActionParams, LimitParams):
62
+ # Either "term" or "custom_search_url" must be provided. "limit" defaults to 10 and may go up
63
+ # to 100, or up to 20 when child actions are attached.
64
+ term: str | None = None
65
+ filter: SearchPostsFilter | None = None
66
+ custom_search_url: str | None = None
67
+
68
+
69
+ class SearchPostActor(LinkedApiModel):
70
+ """Whoever a search result attributes content to: its author, or the actor that reshared it.
71
+
72
+ Unlike the actors of a post returned by fetch_post, these carry no "urn": the URN is read from
73
+ identity anchors on the post's own page, and a search result list has none of them.
74
+ """
75
+
76
+ type: PostActorType | None = None
77
+ name: str | None = None
78
+ profile_url: str | None = None
79
+ headline: str | None = None
80
+ company_url: str | None = None
81
+
82
+
83
+ class SearchPostResult(LinkedApiModel):
84
+ url: str | None = None
85
+ activity_urn: str | None = None
86
+ time: str | None = None
87
+ type: PostType | None = None
88
+ author: SearchPostActor | None = None
89
+ # Non-null only when "type" is "repost".
90
+ reposter: SearchPostActor | None = None
91
+ text: str | None = None
92
+ repost_text: str | None = None
93
+ hashtags: list[str] | None = None
94
+ mentions: list[str] | None = None
95
+ external_links: list[str] | None = None
96
+ images: list[str] | None = None
97
+ document_slides: list[str] | None = None
98
+ has_video: bool | None = None
99
+ video_thumbnail: str | None = None
100
+ has_poll: bool | None = None
101
+ reactions_count: int | None = None
102
+ comments_count: int | None = None
103
+ reposts_count: int | None = None
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "linkedapi"
7
- version = "1.3.10"
7
+ version = "1.4.0"
8
8
  description = "Official synchronous Python SDK for Linked API."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -46,6 +46,7 @@ def test_error_type_sets_match_node_contract() -> None:
46
46
  "connectionNotFound",
47
47
  "searchingNotAllowed",
48
48
  "searchInterfaceMismatch",
49
+ "filterIdentityMismatch",
49
50
  "companyNotFound",
50
51
  "postNotFound",
51
52
  "jobNotFound",
@@ -53,6 +54,9 @@ def test_error_type_sets_match_node_contract() -> None:
53
54
  "commentNotFound",
54
55
  "replyingNotAllowed",
55
56
  "noPostingPermission",
57
+ "mentionNotResolved",
58
+ "repostNotAllowed",
59
+ "alreadyReposted",
56
60
  "noSalesNavigator",
57
61
  "conversationsNotSynced",
58
62
  "threadNotFound",
@@ -13,6 +13,12 @@ from linkedapi import (
13
13
  LinkedApi,
14
14
  LinkedApiConfig,
15
15
  RetrieveFeedParams,
16
+ SearchPostActor,
17
+ SearchPostResult,
18
+ SearchPostsCompanyFilter,
19
+ SearchPostsFilter,
20
+ SearchPostsParams,
21
+ SearchPostsPersonFilter,
16
22
  SimpleWorkflowMapper,
17
23
  VoidWorkflowMapper,
18
24
  )
@@ -33,6 +39,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
33
39
  "search_companies",
34
40
  "nv_search_companies",
35
41
  "search_jobs",
42
+ "search_posts",
36
43
  "send_connection_request",
37
44
  "check_connection_status",
38
45
  "withdraw_connection_request",
@@ -57,6 +64,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
57
64
  "react_to_comment",
58
65
  "reply_to_comment",
59
66
  "create_post",
67
+ "create_repost",
60
68
  "retrieve_ssi",
61
69
  "retrieve_performance",
62
70
  "retrieve_profile_viewers",
@@ -67,7 +75,7 @@ def test_linked_api_exposes_all_predefined_operations() -> None:
67
75
  assert hasattr(operation, "execute")
68
76
  assert hasattr(operation, "result")
69
77
  assert hasattr(operation, "cancel")
70
- assert len(linkedapi.operations) == 39
78
+ assert len(linkedapi.operations) == 41
71
79
 
72
80
 
73
81
  def test_operation_mappers_match_node_contract() -> None:
@@ -79,6 +87,8 @@ def test_operation_mappers_match_node_contract() -> None:
79
87
  assert linkedapi.search_people.mapper.base_action_type == "st.searchPeople"
80
88
  assert isinstance(linkedapi.search_jobs.mapper, ArrayWorkflowMapper)
81
89
  assert linkedapi.search_jobs.mapper.base_action_type == "st.searchJobs"
90
+ assert isinstance(linkedapi.search_posts.mapper, ArrayWorkflowMapper)
91
+ assert linkedapi.search_posts.mapper.base_action_type == "st.searchPosts"
82
92
  assert linkedapi.fetch_job.mapper.base_action_type == "st.openJob"
83
93
  assert linkedapi.fetch_job.mapper.default_params == {"basicInfo": True}
84
94
  assert isinstance(linkedapi.send_connection_request.mapper, VoidWorkflowMapper)
@@ -134,6 +144,153 @@ def test_retrieve_feed_maps_params_and_feed_context() -> None:
134
144
  RetrieveFeedParams(limit=invalid_limit)
135
145
 
136
146
 
147
+ def test_search_posts_maps_filter_params_and_actors_without_urn() -> None:
148
+ linkedapi = LinkedApi(LinkedApiConfig(linked_api_token="x", identification_token="y"))
149
+
150
+ request = linkedapi.search_posts.mapper.map_request(
151
+ SearchPostsParams(
152
+ term="climate tech",
153
+ limit=20,
154
+ filter={
155
+ "sort": "latest",
156
+ "date_posted": "pastWeek",
157
+ "content_type": "images",
158
+ "posted_by": ["firstConnections", "peopleYouFollow"],
159
+ "from_members": [{"name": "Bill Gates", "urn": "urn:li:member:251749025"}],
160
+ "from_companies": ["Example Company"],
161
+ "mentioning_members": [],
162
+ "mentioning_companies": [],
163
+ "author_companies": [
164
+ {"name": "Example Company", "urn": "urn:li:organization:1234567"}
165
+ ],
166
+ "author_industries": ["Software Development"],
167
+ },
168
+ custom_search_url=(
169
+ "https://www.linkedin.com/search/results/content/?keywords=climate%20tech"
170
+ ),
171
+ )
172
+ )
173
+
174
+ assert request == {
175
+ "actionType": "st.searchPosts",
176
+ "term": "climate tech",
177
+ "limit": 20,
178
+ "filter": {
179
+ "sort": "latest",
180
+ "datePosted": "pastWeek",
181
+ "contentType": "images",
182
+ "postedBy": ["firstConnections", "peopleYouFollow"],
183
+ "fromMembers": [{"name": "Bill Gates", "urn": "urn:li:member:251749025"}],
184
+ "fromCompanies": ["Example Company"],
185
+ "mentioningMembers": [],
186
+ "mentioningCompanies": [],
187
+ "authorCompanies": [{"name": "Example Company", "urn": "urn:li:organization:1234567"}],
188
+ "authorIndustries": ["Software Development"],
189
+ },
190
+ "customSearchUrl": "https://www.linkedin.com/search/results/content/?keywords=climate%20tech",
191
+ }
192
+
193
+ response = linkedapi.search_posts.mapper.map_response(
194
+ {
195
+ "actionType": "st.searchPosts",
196
+ "success": True,
197
+ "data": [
198
+ {
199
+ "url": "https://www.linkedin.com/feed/update/urn:li:activity:1",
200
+ "activityUrn": "urn:li:activity:1",
201
+ "time": "2023-01-01T09:15:00Z",
202
+ "type": "repost",
203
+ "author": {
204
+ "type": "company",
205
+ "name": "Example Company",
206
+ "companyUrl": "https://www.linkedin.com/company/example-company",
207
+ },
208
+ "reposter": {
209
+ "type": "person",
210
+ "name": "Example Reposter",
211
+ "profileUrl": "https://www.linkedin.com/in/example-reposter",
212
+ "headline": None,
213
+ },
214
+ "text": "Original post content about the webinar.",
215
+ "repostText": "A useful summary for anyone planning a launch.",
216
+ "hashtags": [],
217
+ "mentions": [],
218
+ "externalLinks": [],
219
+ "images": [],
220
+ "documentSlides": [],
221
+ "hasVideo": True,
222
+ "videoThumbnail": "https://media.licdn.com/dms/image/video-cover.jpg",
223
+ "hasPoll": False,
224
+ "reactionsCount": 6,
225
+ "commentsCount": 0,
226
+ "repostsCount": 1,
227
+ }
228
+ ],
229
+ }
230
+ )
231
+
232
+ assert response.data is not None
233
+ post = response.data[0]
234
+ assert isinstance(post, SearchPostResult)
235
+ assert post.activity_urn == "urn:li:activity:1"
236
+ assert post.author is not None
237
+ assert post.author.company_url == "https://www.linkedin.com/company/example-company"
238
+ assert post.reposter is not None
239
+ assert post.reposter.profile_url == "https://www.linkedin.com/in/example-reposter"
240
+ assert post.video_thumbnail == "https://media.licdn.com/dms/image/video-cover.jpg"
241
+ assert post.reposts_count == 1
242
+ # A search result never resolves an actor urn, so the field must not exist on this surface.
243
+ assert "urn" not in SearchPostActor.model_fields
244
+
245
+
246
+ def test_search_posts_actor_filters_accept_bare_strings_and_objects_mixed() -> None:
247
+ params = SearchPostsParams(
248
+ term="ai",
249
+ filter=SearchPostsFilter(
250
+ from_members=[
251
+ "Bill Gates",
252
+ SearchPostsPersonFilter(
253
+ name="Satya Nadella",
254
+ person_hashed_url="https://www.linkedin.com/in/ACoAAABC",
255
+ ),
256
+ ],
257
+ from_companies=[
258
+ "Acme",
259
+ SearchPostsCompanyFilter(
260
+ name="Globex",
261
+ company_hashed_url="https://www.linkedin.com/company/1035",
262
+ ),
263
+ ],
264
+ ),
265
+ )
266
+
267
+ assert params.model_dump(by_alias=True, exclude_none=True) == {
268
+ "term": "ai",
269
+ "filter": {
270
+ "fromMembers": [
271
+ "Bill Gates",
272
+ {
273
+ "name": "Satya Nadella",
274
+ "personHashedUrl": "https://www.linkedin.com/in/ACoAAABC",
275
+ },
276
+ ],
277
+ "fromCompanies": [
278
+ "Acme",
279
+ {
280
+ "name": "Globex",
281
+ "companyHashedUrl": "https://www.linkedin.com/company/1035",
282
+ },
283
+ ],
284
+ },
285
+ }
286
+
287
+ with pytest.raises(ValidationError):
288
+ SearchPostsFilter(sort="mostRecent")
289
+
290
+ with pytest.raises(ValidationError):
291
+ SearchPostsFilter(from_members=[{"urn": "urn:li:member:1"}])
292
+
293
+
137
294
  def test_invitation_params_require_the_matching_target_url() -> None:
138
295
  params = AcceptInvitationParams(
139
296
  invitation_type="companyFollow",
File without changes
File without changes
File without changes
File without changes
File without changes