linkedapi 1.4.3__tar.gz → 1.4.5__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.3 → linkedapi-1.4.5}/PKG-INFO +1 -1
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/__init__.py +1 -1
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/client.py +35 -4
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/__init__.py +8 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/message.py +24 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/post.py +9 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/search_posts.py +14 -4
- {linkedapi-1.4.3 → linkedapi-1.4.5}/pyproject.toml +1 -1
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_direct_methods.py +54 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/.github/workflows/publish.yaml +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/.gitignore +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/LICENSE +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/README.md +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/examples/verify_webhook_signature.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/accounts.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/admin.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/http_client.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/limits.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/subscription.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/admin/webhooks.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/changelog.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/config.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/core/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/core/operation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/core/polling.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/errors.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/http/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/http/base.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/http/linked_api_http_client.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/array.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/base.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/send_message.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/simple.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/then.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/mappers/void.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/accept_invitation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/check_connection_status.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/comment_on_post.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/create_post.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/create_repost.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/custom_workflow.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/fetch_company.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/fetch_job.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/fetch_person.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/fetch_post.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/ignore_invitation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/manage_conversation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_fetch_company.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_fetch_person.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_manage_conversation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_search_companies.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_search_people.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_send_message.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_sync_conversation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/nv_sync_inbox.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/react_to_comment.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/react_to_post.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/remove_connection.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/reply_to_comment.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_connections.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_feed.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_invitations.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_pending_requests.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_performance.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_profile_viewers.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/retrieve_ssi.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/search_companies.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/search_jobs.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/search_people.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/search_posts.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/send_connection_request.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/send_message.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/sync_conversation.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/sync_inbox.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/sync_network.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/operations/withdraw_connection_request.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/py.typed +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/account.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/admin/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/admin/accounts.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/admin/config.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/admin/limits.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/admin/subscription.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/base.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/changelog.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/company.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/connection.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/feed.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/jobs.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/network.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/params.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/person.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/profile_viewers.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/responses.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/search_companies.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/search_people.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/statistics.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/viewer_state.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/webhooks.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/types/workflow.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/webhooks/__init__.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/webhooks/headers.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/webhooks/parse.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/linkedapi/webhooks/signature.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/conftest.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_admin.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_admin_webhooks.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_changelog.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_errors.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_http_client.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_mappers.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_models.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_operations.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_polling.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_webhook_signature.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_webhooks.py +0 -0
- {linkedapi-1.4.3 → linkedapi-1.4.5}/tests/test_working_hours_contract.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any, overload
|
|
4
4
|
from urllib.parse import urlencode
|
|
5
5
|
|
|
6
6
|
from linkedapi.config import LinkedApiConfig
|
|
@@ -55,6 +55,8 @@ from linkedapi.types.message import (
|
|
|
55
55
|
ConversationPollRequest,
|
|
56
56
|
ConversationPollResult,
|
|
57
57
|
InboxMessage,
|
|
58
|
+
InboxPersonPollRequest,
|
|
59
|
+
InboxPersonPollResult,
|
|
58
60
|
InboxPollRequest,
|
|
59
61
|
)
|
|
60
62
|
from linkedapi.types.network import NetworkEvent, NetworkPollRequest
|
|
@@ -161,7 +163,12 @@ class LinkedApi:
|
|
|
161
163
|
self,
|
|
162
164
|
conversations: list[ConversationPollRequest],
|
|
163
165
|
) -> MappedResponse[list[ConversationPollResult]]:
|
|
164
|
-
"""Poll previously synced standard or Sales Navigator conversations.
|
|
166
|
+
"""Poll previously synced standard or Sales Navigator conversations.
|
|
167
|
+
|
|
168
|
+
Deprecated: legacy, kept working for existing integrations. Use ``poll_inbox`` with
|
|
169
|
+
``InboxPersonPollRequest(person_url=...)``: it returns the same history together with the
|
|
170
|
+
messages the inbox captured, and does not fail for people whose history was never loaded.
|
|
171
|
+
"""
|
|
165
172
|
|
|
166
173
|
try:
|
|
167
174
|
response = self.http_client.post("/conversations/poll", serialize_value(conversations))
|
|
@@ -187,15 +194,39 @@ class LinkedApi:
|
|
|
187
194
|
)
|
|
188
195
|
raise
|
|
189
196
|
|
|
197
|
+
@overload
|
|
198
|
+
def poll_inbox( # type: ignore[overload-overlap]
|
|
199
|
+
self,
|
|
200
|
+
request: InboxPersonPollRequest,
|
|
201
|
+
) -> MappedResponse[InboxPersonPollResult]: ...
|
|
202
|
+
|
|
203
|
+
@overload
|
|
190
204
|
def poll_inbox(
|
|
191
205
|
self,
|
|
192
206
|
request: InboxPollRequest | None = None,
|
|
193
|
-
) -> MappedResponse[list[InboxMessage]]:
|
|
194
|
-
|
|
207
|
+
) -> MappedResponse[list[InboxMessage]]: ...
|
|
208
|
+
|
|
209
|
+
def poll_inbox(
|
|
210
|
+
self,
|
|
211
|
+
request: InboxPollRequest | None = None,
|
|
212
|
+
) -> MappedResponse[list[InboxMessage]] | MappedResponse[InboxPersonPollResult]:
|
|
213
|
+
"""Read the monitored standard or Sales Navigator inbox, newest messages first.
|
|
214
|
+
|
|
215
|
+
Without ``person_url`` the data is the list of inbox messages across every conversation.
|
|
216
|
+
With ``person_url`` (use ``InboxPersonPollRequest``) the data is the whole known
|
|
217
|
+
conversation with that person: the messages the inbox captured together with the history
|
|
218
|
+
loaded by ``sync_conversation`` / ``nv_sync_conversation``, each message once, plus
|
|
219
|
+
``threads`` with ``history_from`` and ``history_complete``.
|
|
220
|
+
"""
|
|
195
221
|
|
|
196
222
|
payload = serialize_value(request) if request is not None else {}
|
|
197
223
|
response = self.http_client.post("/inbox/poll", payload)
|
|
198
224
|
if response.success and response.result is not None:
|
|
225
|
+
if request is not None and request.person_url:
|
|
226
|
+
return MappedResponse(
|
|
227
|
+
data=InboxPersonPollResult.model_validate(response.result),
|
|
228
|
+
errors=[],
|
|
229
|
+
)
|
|
199
230
|
messages = response.result.get("messages", [])
|
|
200
231
|
return MappedResponse(
|
|
201
232
|
data=[InboxMessage.model_validate(item) for item in messages],
|
|
@@ -112,6 +112,10 @@ from linkedapi.types.message import (
|
|
|
112
112
|
ConversationPollResult,
|
|
113
113
|
ConversationType,
|
|
114
114
|
InboxMessage,
|
|
115
|
+
InboxPersonMessage,
|
|
116
|
+
InboxPersonPollRequest,
|
|
117
|
+
InboxPersonPollResult,
|
|
118
|
+
InboxPersonThread,
|
|
115
119
|
InboxPollRequest,
|
|
116
120
|
ManageConversationParams,
|
|
117
121
|
Message,
|
|
@@ -357,6 +361,10 @@ __all__ = [
|
|
|
357
361
|
"GetLimitsUsageParams",
|
|
358
362
|
"IgnoreInvitationParams",
|
|
359
363
|
"InboxMessage",
|
|
364
|
+
"InboxPersonMessage",
|
|
365
|
+
"InboxPersonPollRequest",
|
|
366
|
+
"InboxPersonPollResult",
|
|
367
|
+
"InboxPersonThread",
|
|
360
368
|
"InboxPollRequest",
|
|
361
369
|
"Invitation",
|
|
362
370
|
"InvitationTargetParams",
|
|
@@ -2,6 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Literal
|
|
4
4
|
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
5
7
|
from linkedapi.types.base import LinkedApiModel
|
|
6
8
|
from linkedapi.types.params import BaseActionParams
|
|
7
9
|
|
|
@@ -90,6 +92,11 @@ class InboxPollRequest(LinkedApiModel):
|
|
|
90
92
|
since: str | None = None
|
|
91
93
|
type: ConversationType | None = None
|
|
92
94
|
thread_id: str | None = None
|
|
95
|
+
person_url: str | None = None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class InboxPersonPollRequest(InboxPollRequest):
|
|
99
|
+
person_url: str
|
|
93
100
|
|
|
94
101
|
|
|
95
102
|
class InboxMessage(LinkedApiModel):
|
|
@@ -104,3 +111,20 @@ class InboxMessage(LinkedApiModel):
|
|
|
104
111
|
sender: MessageSender | None = None
|
|
105
112
|
text: str | None = None
|
|
106
113
|
time: str | None = None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class InboxPersonMessage(InboxMessage):
|
|
117
|
+
inbox_message_id: str | None = None
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class InboxPersonThread(LinkedApiModel):
|
|
121
|
+
thread_id: str | None = None
|
|
122
|
+
type: ConversationType | None = None
|
|
123
|
+
person_urn: str | None = None
|
|
124
|
+
history_from: str | None = None
|
|
125
|
+
history_complete: bool = False
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class InboxPersonPollResult(LinkedApiModel):
|
|
129
|
+
messages: list[InboxPersonMessage] = Field(default_factory=list)
|
|
130
|
+
threads: list[InboxPersonThread] = Field(default_factory=list)
|
|
@@ -112,6 +112,15 @@ class PostComment(LinkedApiModel):
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
class PostReaction(LinkedApiModel):
|
|
115
|
+
"""One reaction on a post.
|
|
116
|
+
|
|
117
|
+
"actor" is whoever reacted, in the same shape a post's author has.
|
|
118
|
+
|
|
119
|
+
Deprecated: the engager_* fields are still returned; use "actor" instead.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
actor: PostAuthor | None = None
|
|
123
|
+
# Deprecated: use "actor" instead of the five engager_* fields.
|
|
115
124
|
engager_urn: str | None = None
|
|
116
125
|
engager_url: str | None = None
|
|
117
126
|
engager_name: str | None = None
|
|
@@ -16,20 +16,30 @@ PostSearchPostedBy = Literal["me", "firstConnections", "peopleYouFollow"]
|
|
|
16
16
|
class SearchPostsPersonFilter(LinkedApiModel):
|
|
17
17
|
"""One person to narrow a post search by.
|
|
18
18
|
|
|
19
|
-
"name"
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
With "name" alone the filter may match a namesake. "id" is any identifier of the person - its
|
|
20
|
+
URN, or its public or hashed LinkedIn URL - and pins the filter to exactly that person; when it
|
|
21
|
+
cannot be applied, the action fails with "filterNotApplied" rather than filtering by somebody
|
|
22
|
+
else.
|
|
23
|
+
|
|
24
|
+
Deprecated: "urn" and "person_hashed_url" are still accepted; use "id" instead.
|
|
22
25
|
"""
|
|
23
26
|
|
|
24
27
|
name: str
|
|
28
|
+
id: str | None = None
|
|
25
29
|
urn: str | None = None
|
|
26
30
|
person_hashed_url: str | None = None
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
class SearchPostsCompanyFilter(LinkedApiModel):
|
|
30
|
-
"""One company to narrow a post search by. Same contract as SearchPostsPersonFilter.
|
|
34
|
+
"""One company to narrow a post search by. Same contract as SearchPostsPersonFilter.
|
|
35
|
+
|
|
36
|
+
"id" is the company's URN, its public or hashed LinkedIn URL, or its numeric ID.
|
|
37
|
+
|
|
38
|
+
Deprecated: "urn" and "company_hashed_url" are still accepted; use "id" instead.
|
|
39
|
+
"""
|
|
31
40
|
|
|
32
41
|
name: str
|
|
42
|
+
id: str | None = None
|
|
33
43
|
urn: str | None = None
|
|
34
44
|
company_hashed_url: str | None = None
|
|
35
45
|
|
|
@@ -6,6 +6,7 @@ from conftest import FakeHttpClient
|
|
|
6
6
|
from linkedapi import (
|
|
7
7
|
ApiUsageParams,
|
|
8
8
|
ConversationPollRequest,
|
|
9
|
+
InboxPersonPollRequest,
|
|
9
10
|
InboxPollRequest,
|
|
10
11
|
LinkedApi,
|
|
11
12
|
LinkedApiActionError,
|
|
@@ -108,6 +109,59 @@ def test_poll_inbox_success(fake_http_client: FakeHttpClient) -> None:
|
|
|
108
109
|
assert result.errors == []
|
|
109
110
|
|
|
110
111
|
|
|
112
|
+
def test_poll_inbox_with_person_url_returns_messages_and_threads(
|
|
113
|
+
fake_http_client: FakeHttpClient,
|
|
114
|
+
) -> None:
|
|
115
|
+
linkedapi = LinkedApi(fake_http_client)
|
|
116
|
+
fake_http_client.queue_response(
|
|
117
|
+
result={
|
|
118
|
+
"messages": [
|
|
119
|
+
{
|
|
120
|
+
"id": "h1",
|
|
121
|
+
"inboxMessageId": None,
|
|
122
|
+
"type": "st",
|
|
123
|
+
"threadId": None,
|
|
124
|
+
"personHashedUrl": "hashed",
|
|
125
|
+
"sender": "them",
|
|
126
|
+
"text": "hi",
|
|
127
|
+
"time": "2026-01-01T10:00:00.000Z",
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"threads": [
|
|
131
|
+
{
|
|
132
|
+
"threadId": None,
|
|
133
|
+
"type": "st",
|
|
134
|
+
"personUrn": "urn:li:member:1",
|
|
135
|
+
"historyFrom": "2026-01-01T10:00:00.000Z",
|
|
136
|
+
"historyComplete": True,
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
result = linkedapi.poll_inbox(InboxPersonPollRequest(person_url="u", since="s"))
|
|
143
|
+
|
|
144
|
+
assert fake_http_client.calls[0] == ("POST", "/inbox/poll", {"since": "s", "personUrl": "u"})
|
|
145
|
+
assert result.data is not None
|
|
146
|
+
assert result.data.messages[0].inbox_message_id is None
|
|
147
|
+
assert result.data.messages[0].thread_id is None
|
|
148
|
+
assert result.data.threads[0].history_complete is True
|
|
149
|
+
assert result.data.threads[0].history_from == "2026-01-01T10:00:00.000Z"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def test_poll_inbox_person_url_on_base_request_is_sent_not_dropped(
|
|
153
|
+
fake_http_client: FakeHttpClient,
|
|
154
|
+
) -> None:
|
|
155
|
+
linkedapi = LinkedApi(fake_http_client)
|
|
156
|
+
fake_http_client.queue_response(result={"messages": [], "threads": []})
|
|
157
|
+
|
|
158
|
+
result = linkedapi.poll_inbox(InboxPollRequest(person_url="u"))
|
|
159
|
+
|
|
160
|
+
assert fake_http_client.calls[0] == ("POST", "/inbox/poll", {"personUrl": "u"})
|
|
161
|
+
assert result.data is not None
|
|
162
|
+
assert not isinstance(result.data, list)
|
|
163
|
+
|
|
164
|
+
|
|
111
165
|
def test_poll_inbox_without_request_sends_empty_body(fake_http_client: FakeHttpClient) -> None:
|
|
112
166
|
linkedapi = LinkedApi(fake_http_client)
|
|
113
167
|
fake_http_client.queue_response(result={"messages": []})
|
|
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
|