linkedapi 1.0.0__py3-none-any.whl
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/__init__.py +127 -0
- linkedapi/admin/__init__.py +13 -0
- linkedapi/admin/accounts.py +91 -0
- linkedapi/admin/admin.py +22 -0
- linkedapi/admin/http_client.py +73 -0
- linkedapi/admin/limits.py +70 -0
- linkedapi/admin/subscription.py +69 -0
- linkedapi/client.py +160 -0
- linkedapi/config.py +10 -0
- linkedapi/core/__init__.py +4 -0
- linkedapi/core/operation.py +89 -0
- linkedapi/core/polling.py +48 -0
- linkedapi/errors.py +119 -0
- linkedapi/http/__init__.py +4 -0
- linkedapi/http/base.py +22 -0
- linkedapi/http/linked_api_http_client.py +74 -0
- linkedapi/mappers/__init__.py +16 -0
- linkedapi/mappers/array.py +49 -0
- linkedapi/mappers/base.py +70 -0
- linkedapi/mappers/simple.py +56 -0
- linkedapi/mappers/then.py +175 -0
- linkedapi/mappers/void.py +33 -0
- linkedapi/operations/__init__.py +58 -0
- linkedapi/operations/check_connection_status.py +15 -0
- linkedapi/operations/comment_on_post.py +12 -0
- linkedapi/operations/create_post.py +15 -0
- linkedapi/operations/custom_workflow.py +22 -0
- linkedapi/operations/fetch_company.py +35 -0
- linkedapi/operations/fetch_person.py +43 -0
- linkedapi/operations/fetch_post.py +33 -0
- linkedapi/operations/nv_fetch_company.py +33 -0
- linkedapi/operations/nv_fetch_person.py +23 -0
- linkedapi/operations/nv_search_companies.py +15 -0
- linkedapi/operations/nv_search_people.py +15 -0
- linkedapi/operations/nv_send_message.py +12 -0
- linkedapi/operations/nv_sync_conversation.py +12 -0
- linkedapi/operations/react_to_post.py +12 -0
- linkedapi/operations/remove_connection.py +12 -0
- linkedapi/operations/retrieve_connections.py +15 -0
- linkedapi/operations/retrieve_pending_requests.py +15 -0
- linkedapi/operations/retrieve_performance.py +15 -0
- linkedapi/operations/retrieve_ssi.py +15 -0
- linkedapi/operations/search_companies.py +15 -0
- linkedapi/operations/search_people.py +15 -0
- linkedapi/operations/send_connection_request.py +12 -0
- linkedapi/operations/send_message.py +12 -0
- linkedapi/operations/sync_conversation.py +12 -0
- linkedapi/operations/withdraw_connection_request.py +12 -0
- linkedapi/py.typed +1 -0
- linkedapi/types/__init__.py +336 -0
- linkedapi/types/account.py +8 -0
- linkedapi/types/admin/__init__.py +91 -0
- linkedapi/types/admin/accounts.py +71 -0
- linkedapi/types/admin/config.py +8 -0
- linkedapi/types/admin/limits.py +77 -0
- linkedapi/types/admin/subscription.py +58 -0
- linkedapi/types/base.py +47 -0
- linkedapi/types/company.py +140 -0
- linkedapi/types/connection.py +86 -0
- linkedapi/types/message.py +48 -0
- linkedapi/types/params.py +15 -0
- linkedapi/types/person.py +105 -0
- linkedapi/types/post.py +119 -0
- linkedapi/types/responses.py +18 -0
- linkedapi/types/search_companies.py +72 -0
- linkedapi/types/search_people.py +46 -0
- linkedapi/types/statistics.py +27 -0
- linkedapi/types/workflow.py +55 -0
- linkedapi-1.0.0.dist-info/METADATA +125 -0
- linkedapi-1.0.0.dist-info/RECORD +72 -0
- linkedapi-1.0.0.dist-info/WHEEL +4 -0
- linkedapi-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.base import LinkedApiModel
|
|
6
|
+
|
|
7
|
+
SubscriptionStatusValue = Literal["active", "trialing", "past_due", "canceled"]
|
|
8
|
+
SeatType = Literal["core", "plus"]
|
|
9
|
+
BillingPeriod = Literal["month", "year"]
|
|
10
|
+
Currency = Literal["usd", "eur"]
|
|
11
|
+
SetSeatsStatus = Literal["complete", "processing"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SubscriptionStatus(LinkedApiModel):
|
|
15
|
+
status: SubscriptionStatusValue | None = None
|
|
16
|
+
eligible_for_trial: bool | None = None
|
|
17
|
+
cancel_at_period_end: bool | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SubscriptionSeat(LinkedApiModel):
|
|
21
|
+
seat_type: SeatType | None = None
|
|
22
|
+
quantity: int | None = None
|
|
23
|
+
billing_period: BillingPeriod | None = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SubscriptionProduct(LinkedApiModel):
|
|
27
|
+
id: str | None = None
|
|
28
|
+
seat_type: SeatType | None = None
|
|
29
|
+
billing_period: BillingPeriod | None = None
|
|
30
|
+
unit_price: int | None = None
|
|
31
|
+
currency: Currency | None = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class SetSeatsParams(LinkedApiModel):
|
|
35
|
+
quantity: int
|
|
36
|
+
seat_type: SeatType
|
|
37
|
+
billing_period: BillingPeriod
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SetSeatsResult(LinkedApiModel):
|
|
41
|
+
status: SetSeatsStatus | None = None
|
|
42
|
+
payment_link: str | None = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BillingLinkResult(LinkedApiModel):
|
|
46
|
+
stripe_link: str | None = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CancelResult(LinkedApiModel):
|
|
50
|
+
cancel_at_date: str | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class SubscriptionSeatsResult(LinkedApiModel):
|
|
54
|
+
seats: list[SubscriptionSeat] | None = None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SubscriptionPricingResult(LinkedApiModel):
|
|
58
|
+
products: list[SubscriptionProduct] | None = None
|
linkedapi/types/base.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def to_camel(value: str) -> str:
|
|
9
|
+
parts = value.split("_")
|
|
10
|
+
return parts[0] + "".join(part.capitalize() for part in parts[1:])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class LinkedApiModel(BaseModel):
|
|
14
|
+
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def serialize_value(value: Any) -> Any:
|
|
18
|
+
if isinstance(value, BaseModel):
|
|
19
|
+
return value.model_dump(by_alias=True, exclude_none=True)
|
|
20
|
+
if isinstance(value, list):
|
|
21
|
+
return [serialize_value(item) for item in value]
|
|
22
|
+
if isinstance(value, tuple):
|
|
23
|
+
return [serialize_value(item) for item in value]
|
|
24
|
+
if isinstance(value, dict):
|
|
25
|
+
return {key: serialize_value(item) for key, item in value.items() if item is not None}
|
|
26
|
+
return value
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def serialize_model(value: Any) -> dict[str, Any]:
|
|
30
|
+
serialized = serialize_value(value)
|
|
31
|
+
if serialized is None:
|
|
32
|
+
return {}
|
|
33
|
+
if isinstance(serialized, dict):
|
|
34
|
+
return serialized
|
|
35
|
+
msg = "Expected object-like parameters"
|
|
36
|
+
raise TypeError(msg)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def dump_model_by_name(value: Any) -> dict[str, Any]:
|
|
40
|
+
if value is None:
|
|
41
|
+
return {}
|
|
42
|
+
if isinstance(value, BaseModel):
|
|
43
|
+
return value.model_dump(by_alias=False, exclude_none=True)
|
|
44
|
+
if isinstance(value, dict):
|
|
45
|
+
return {str(key): item for key, item in value.items() if item is not None}
|
|
46
|
+
msg = "Expected object-like parameters"
|
|
47
|
+
raise TypeError(msg)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal, TypeAlias
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from linkedapi.types.base import LinkedApiModel
|
|
8
|
+
from linkedapi.types.params import BaseActionParams, LimitParams, LimitSinceParams
|
|
9
|
+
from linkedapi.types.person import YearsOfExperience
|
|
10
|
+
from linkedapi.types.post import Post
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class StCompanyEmployee(LinkedApiModel):
|
|
14
|
+
name: str | None = None
|
|
15
|
+
public_url: str | None = None
|
|
16
|
+
headline: str | None = None
|
|
17
|
+
location: str | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class StCompanyDm(LinkedApiModel):
|
|
21
|
+
name: str | None = None
|
|
22
|
+
public_url: str | None = None
|
|
23
|
+
headline: str | None = None
|
|
24
|
+
location: str | None = None
|
|
25
|
+
country_code: str | None = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Company(LinkedApiModel):
|
|
29
|
+
name: str | None = None
|
|
30
|
+
public_url: str | None = None
|
|
31
|
+
description: str | None = None
|
|
32
|
+
location: str | None = None
|
|
33
|
+
headquarters: str | None = None
|
|
34
|
+
industry: str | None = None
|
|
35
|
+
specialties: str | None = None
|
|
36
|
+
website: str | None = None
|
|
37
|
+
employees_count: int | None = None
|
|
38
|
+
year_founded: int | None = None
|
|
39
|
+
venture_financing: bool | None = None
|
|
40
|
+
jobs_count: int | None = None
|
|
41
|
+
employees: list[StCompanyEmployee] | None = None
|
|
42
|
+
dms: list[StCompanyDm] | None = None
|
|
43
|
+
posts: list[Post] | None = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class BaseFetchCompanyParams(BaseActionParams):
|
|
47
|
+
company_url: str
|
|
48
|
+
retrieve_employees: bool | None = None
|
|
49
|
+
retrieve_dms: bool | None = Field(default=None, alias="retrieveDMs")
|
|
50
|
+
retrieve_posts: bool | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class BaseFetchCompanyParamsWide(BaseFetchCompanyParams):
|
|
54
|
+
retrieve_employees: Literal[True] = True
|
|
55
|
+
retrieve_dms: Literal[True] = Field(default=True, alias="retrieveDMs")
|
|
56
|
+
retrieve_posts: Literal[True] = True
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class StCompanyEmployeesFilter(LinkedApiModel):
|
|
60
|
+
first_name: str | None = None
|
|
61
|
+
last_name: str | None = None
|
|
62
|
+
position: str | None = None
|
|
63
|
+
locations: list[str] | None = None
|
|
64
|
+
industries: list[str] | None = None
|
|
65
|
+
schools: list[str] | None = None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class StCompanyEmployeesRetrievalConfig(LimitParams):
|
|
69
|
+
filter: StCompanyEmployeesFilter | None = None
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class FetchCompanyParams(BaseFetchCompanyParams):
|
|
73
|
+
employees_retrieval_config: StCompanyEmployeesRetrievalConfig | None = None
|
|
74
|
+
dms_retrieval_config: LimitParams | None = Field(default=None, alias="dmsRetrievalConfig")
|
|
75
|
+
posts_retrieval_config: LimitSinceParams | None = None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
FetchCompanyResult: TypeAlias = Company
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class NvCompanyEmployee(LinkedApiModel):
|
|
82
|
+
name: str | None = None
|
|
83
|
+
hashed_url: str | None = None
|
|
84
|
+
position: str | None = None
|
|
85
|
+
location: str | None = None
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class NvCompanyDm(LinkedApiModel):
|
|
89
|
+
name: str | None = None
|
|
90
|
+
hashed_url: str | None = None
|
|
91
|
+
position: str | None = None
|
|
92
|
+
location: str | None = None
|
|
93
|
+
country_code: str | None = None
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class NvCompany(LinkedApiModel):
|
|
97
|
+
name: str | None = None
|
|
98
|
+
public_url: str | None = None
|
|
99
|
+
description: str | None = None
|
|
100
|
+
location: str | None = None
|
|
101
|
+
headquarters: str | None = None
|
|
102
|
+
industry: str | None = None
|
|
103
|
+
website: str | None = None
|
|
104
|
+
employees_count: int | None = None
|
|
105
|
+
year_founded: int | None = None
|
|
106
|
+
employees: list[NvCompanyEmployee] | None = None
|
|
107
|
+
dms: list[NvCompanyDm] | None = None
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class NvBaseFetchCompanyParams(BaseActionParams):
|
|
111
|
+
company_hashed_url: str
|
|
112
|
+
retrieve_employees: bool | None = None
|
|
113
|
+
retrieve_dms: bool | None = Field(default=None, alias="retrieveDMs")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class NvBaseFetchCompanyParamsWide(NvBaseFetchCompanyParams):
|
|
117
|
+
retrieve_employees: Literal[True] = True
|
|
118
|
+
retrieve_dms: Literal[True] = Field(default=True, alias="retrieveDMs")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class NvCompanyEmployeeFilter(LinkedApiModel):
|
|
122
|
+
first_name: str | None = None
|
|
123
|
+
last_name: str | None = None
|
|
124
|
+
positions: list[str] | None = None
|
|
125
|
+
locations: list[str] | None = None
|
|
126
|
+
industries: list[str] | None = None
|
|
127
|
+
schools: list[str] | None = None
|
|
128
|
+
years_of_experiences: list[YearsOfExperience] | None = None
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class NvCompanyEmployeeRetrievalConfig(LimitParams):
|
|
132
|
+
filter: NvCompanyEmployeeFilter | None = None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class NvFetchCompanyParams(NvBaseFetchCompanyParams):
|
|
136
|
+
employees_retrieval_config: NvCompanyEmployeeRetrievalConfig | None = None
|
|
137
|
+
dms_retrieval_config: LimitParams | None = Field(default=None, alias="dmsRetrievalConfig")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
NvFetchCompanyResult: TypeAlias = NvCompany
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.base import LinkedApiModel
|
|
6
|
+
from linkedapi.types.params import BaseActionParams, LimitParams
|
|
7
|
+
|
|
8
|
+
ConnectionStatus = Literal["connected", "pending", "notConnected"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ConnectionPerson(LinkedApiModel):
|
|
12
|
+
name: str | None = None
|
|
13
|
+
public_url: str | None = None
|
|
14
|
+
headline: str | None = None
|
|
15
|
+
location: str | None = None
|
|
16
|
+
profile_image_url: str | None = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SendConnectionRequestParams(BaseActionParams):
|
|
20
|
+
person_url: str
|
|
21
|
+
note: str | None = None
|
|
22
|
+
email: str | None = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CheckConnectionStatusParams(BaseActionParams):
|
|
26
|
+
person_url: str
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CheckConnectionStatusResult(LinkedApiModel):
|
|
30
|
+
connection_status: ConnectionStatus | None = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class WithdrawConnectionRequestParams(BaseActionParams):
|
|
34
|
+
person_url: str
|
|
35
|
+
unfollow: bool | None = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class RetrievePendingRequestsResult(LinkedApiModel):
|
|
39
|
+
name: str | None = None
|
|
40
|
+
public_url: str | None = None
|
|
41
|
+
headline: str | None = None
|
|
42
|
+
sent_time: str | None = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RetrieveConnectionsFilter(LinkedApiModel):
|
|
46
|
+
first_name: str | None = None
|
|
47
|
+
last_name: str | None = None
|
|
48
|
+
position: str | None = None
|
|
49
|
+
locations: list[str] | None = None
|
|
50
|
+
industries: list[str] | None = None
|
|
51
|
+
current_companies: list[str] | None = None
|
|
52
|
+
previous_companies: list[str] | None = None
|
|
53
|
+
schools: list[str] | None = None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class RetrieveConnectionsParams(LimitParams):
|
|
57
|
+
since: str | None = None
|
|
58
|
+
filter: RetrieveConnectionsFilter | None = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class RetrieveConnectionsResult(LinkedApiModel):
|
|
62
|
+
name: str | None = None
|
|
63
|
+
public_url: str | None = None
|
|
64
|
+
headline: str | None = None
|
|
65
|
+
location: str | None = None
|
|
66
|
+
connected_at: str | None = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class RemoveConnectionParams(BaseActionParams):
|
|
70
|
+
person_url: str
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class NvOpenPersonPageParams(BaseActionParams):
|
|
74
|
+
person_hashed_url: str
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class NvOpenPersonPageResult(LinkedApiModel):
|
|
78
|
+
name: str | None = None
|
|
79
|
+
public_url: str | None = None
|
|
80
|
+
hashed_url: str | None = None
|
|
81
|
+
headline: str | None = None
|
|
82
|
+
location: str | None = None
|
|
83
|
+
country_code: str | None = None
|
|
84
|
+
position: str | None = None
|
|
85
|
+
company_name: str | None = None
|
|
86
|
+
company_hashed_url: str | None = None
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.base import LinkedApiModel
|
|
6
|
+
from linkedapi.types.params import BaseActionParams
|
|
7
|
+
|
|
8
|
+
ConversationType = Literal["st", "nv"]
|
|
9
|
+
MessageSender = Literal["us", "them"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SendMessageParams(BaseActionParams):
|
|
13
|
+
person_url: str
|
|
14
|
+
text: str
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SyncConversationParams(BaseActionParams):
|
|
18
|
+
person_url: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class NvSendMessageParams(BaseActionParams):
|
|
22
|
+
person_url: str
|
|
23
|
+
text: str
|
|
24
|
+
subject: str
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class NvSyncConversationParams(BaseActionParams):
|
|
28
|
+
person_url: str
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ConversationPollRequest(LinkedApiModel):
|
|
32
|
+
person_url: str
|
|
33
|
+
type: ConversationType
|
|
34
|
+
since: str | None = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Message(LinkedApiModel):
|
|
38
|
+
id: str | None = None
|
|
39
|
+
sender: MessageSender | None = None
|
|
40
|
+
text: str | None = None
|
|
41
|
+
time: str | None = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ConversationPollResult(LinkedApiModel):
|
|
45
|
+
person_url: str | None = None
|
|
46
|
+
type: ConversationType | None = None
|
|
47
|
+
messages: list[Message] | None = None
|
|
48
|
+
since: str | None = None
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from linkedapi.types.base import LinkedApiModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BaseActionParams(LinkedApiModel):
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LimitParams(LinkedApiModel):
|
|
11
|
+
limit: int | None = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LimitSinceParams(LimitParams):
|
|
15
|
+
since: str | None = None
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal, TypeAlias
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.params import BaseActionParams, LimitSinceParams
|
|
6
|
+
from linkedapi.types.post import Comment, Post, Reaction
|
|
7
|
+
|
|
8
|
+
EmploymentType = Literal[
|
|
9
|
+
"fullTime",
|
|
10
|
+
"partTime",
|
|
11
|
+
"selfEmployed",
|
|
12
|
+
"freelance",
|
|
13
|
+
"contract",
|
|
14
|
+
"internship",
|
|
15
|
+
"apprenticeship",
|
|
16
|
+
"seasonal",
|
|
17
|
+
]
|
|
18
|
+
LocationType = Literal["onSite", "remote", "hybrid"]
|
|
19
|
+
LanguageProficiency = Literal[
|
|
20
|
+
"elementary",
|
|
21
|
+
"limitedWorking",
|
|
22
|
+
"professionalWorking",
|
|
23
|
+
"fullProfessional",
|
|
24
|
+
"nativeOrBilingual",
|
|
25
|
+
]
|
|
26
|
+
YearsOfExperience = Literal["lessThanOne", "oneToTwo", "threeToFive", "sixToTen", "moreThanTen"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class BaseFetchPersonParams(BaseActionParams):
|
|
30
|
+
person_url: str
|
|
31
|
+
retrieve_experience: bool | None = None
|
|
32
|
+
retrieve_education: bool | None = None
|
|
33
|
+
retrieve_skills: bool | None = None
|
|
34
|
+
retrieve_languages: bool | None = None
|
|
35
|
+
retrieve_posts: bool | None = None
|
|
36
|
+
retrieve_comments: bool | None = None
|
|
37
|
+
retrieve_reactions: bool | None = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class BaseFetchPersonParamsWide(BaseFetchPersonParams):
|
|
41
|
+
retrieve_experience: Literal[True] = True
|
|
42
|
+
retrieve_education: Literal[True] = True
|
|
43
|
+
retrieve_skills: Literal[True] = True
|
|
44
|
+
retrieve_languages: Literal[True] = True
|
|
45
|
+
retrieve_posts: Literal[True] = True
|
|
46
|
+
retrieve_comments: Literal[True] = True
|
|
47
|
+
retrieve_reactions: Literal[True] = True
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class FetchPersonParams(BaseFetchPersonParams):
|
|
51
|
+
posts_retrieval_config: LimitSinceParams | None = None
|
|
52
|
+
comments_retrieval_config: LimitSinceParams | None = None
|
|
53
|
+
reactions_retrieval_config: LimitSinceParams | None = None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class PersonExperience(BaseActionParams):
|
|
57
|
+
position: str | None = None
|
|
58
|
+
company_name: str | None = None
|
|
59
|
+
company_hashed_url: str | None = None
|
|
60
|
+
employment_type: EmploymentType | None = None
|
|
61
|
+
location_type: LocationType | None = None
|
|
62
|
+
description: str | None = None
|
|
63
|
+
duration: int | None = None
|
|
64
|
+
start_time: str | None = None
|
|
65
|
+
end_time: str | None = None
|
|
66
|
+
location: str | None = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class PersonEducation(BaseActionParams):
|
|
70
|
+
school_name: str | None = None
|
|
71
|
+
school_hashed_url: str | None = None
|
|
72
|
+
details: str | None = None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class PersonSkill(BaseActionParams):
|
|
76
|
+
name: str | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class PersonLanguage(BaseActionParams):
|
|
80
|
+
name: str | None = None
|
|
81
|
+
proficiency: LanguageProficiency | None = None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class Person(BaseActionParams):
|
|
85
|
+
name: str | None = None
|
|
86
|
+
public_url: str | None = None
|
|
87
|
+
hashed_url: str | None = None
|
|
88
|
+
headline: str | None = None
|
|
89
|
+
location: str | None = None
|
|
90
|
+
country_code: str | None = None
|
|
91
|
+
position: str | None = None
|
|
92
|
+
company_name: str | None = None
|
|
93
|
+
company_hashed_url: str | None = None
|
|
94
|
+
followers_count: int | None = None
|
|
95
|
+
about: str | None = None
|
|
96
|
+
experiences: list[PersonExperience] | None = None
|
|
97
|
+
education: list[PersonEducation] | None = None
|
|
98
|
+
skills: list[PersonSkill] | None = None
|
|
99
|
+
languages: list[PersonLanguage] | None = None
|
|
100
|
+
posts: list[Post] | None = None
|
|
101
|
+
comments: list[Comment] | None = None
|
|
102
|
+
reactions: list[Reaction] | None = None
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
FetchPersonResult: TypeAlias = Person
|
linkedapi/types/post.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
|
|
8
|
+
PostType = Literal["original", "repost"]
|
|
9
|
+
ReactionType = Literal["like", "celebrate", "support", "love", "insightful", "funny"]
|
|
10
|
+
PostCommenterType = Literal["person", "company"]
|
|
11
|
+
PostEngagerType = Literal["person", "company"]
|
|
12
|
+
PostCommentsSort = Literal["mostRelevant", "mostRecent"]
|
|
13
|
+
AttachmentType = Literal["image", "video", "document"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Reaction(LinkedApiModel):
|
|
17
|
+
post_url: str | None = None
|
|
18
|
+
time: str | None = None
|
|
19
|
+
reaction_type: ReactionType | None = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Comment(LinkedApiModel):
|
|
23
|
+
post_url: str | None = None
|
|
24
|
+
time: str | None = None
|
|
25
|
+
text: str | None = None
|
|
26
|
+
image: str | None = None
|
|
27
|
+
reactions_count: int | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ReactToPostParams(BaseActionParams):
|
|
31
|
+
post_url: str
|
|
32
|
+
type: ReactionType
|
|
33
|
+
company_url: str | None = None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class CommentOnPostParams(BaseActionParams):
|
|
37
|
+
post_url: str
|
|
38
|
+
text: str
|
|
39
|
+
company_url: str | None = None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class PostComment(LinkedApiModel):
|
|
43
|
+
commenter_url: str | None = None
|
|
44
|
+
commenter_name: str | None = None
|
|
45
|
+
commenter_headline: str | None = None
|
|
46
|
+
commenter_type: PostCommenterType | None = None
|
|
47
|
+
time: str | None = None
|
|
48
|
+
text: str | None = None
|
|
49
|
+
image: str | None = None
|
|
50
|
+
is_reply: bool | None = None
|
|
51
|
+
reactions_count: int | None = None
|
|
52
|
+
replies_count: int | None = None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class PostReaction(LinkedApiModel):
|
|
56
|
+
engager_url: str | None = None
|
|
57
|
+
engager_name: str | None = None
|
|
58
|
+
engager_headline: str | None = None
|
|
59
|
+
engager_type: PostEngagerType | None = None
|
|
60
|
+
type: ReactionType | None = None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Post(LinkedApiModel):
|
|
64
|
+
url: str | None = None
|
|
65
|
+
time: str | None = None
|
|
66
|
+
type: PostType | None = None
|
|
67
|
+
repost_text: str | None = None
|
|
68
|
+
text: str | None = None
|
|
69
|
+
images: list[str] | None = None
|
|
70
|
+
has_video: bool | None = None
|
|
71
|
+
has_poll: bool | None = None
|
|
72
|
+
reactions_count: int | None = None
|
|
73
|
+
comments_count: int | None = None
|
|
74
|
+
reposts_count: int | None = None
|
|
75
|
+
comments: list[PostComment] | None = None
|
|
76
|
+
reactions: list[PostReaction] | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class PostCommentsRetrievalConfig(LimitParams):
|
|
80
|
+
replies: bool | None = None
|
|
81
|
+
sort: PostCommentsSort | None = None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
PostReactionsRetrievalConfig: TypeAlias = LimitParams
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class BaseFetchPostParams(BaseActionParams):
|
|
88
|
+
post_url: str
|
|
89
|
+
retrieve_comments: bool | None = None
|
|
90
|
+
retrieve_reactions: bool | None = None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class BaseFetchPostParamsWide(BaseFetchPostParams):
|
|
94
|
+
retrieve_comments: Literal[True] = True
|
|
95
|
+
retrieve_reactions: Literal[True] = True
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class FetchPostParams(BaseFetchPostParams):
|
|
99
|
+
comments_retrieval_config: PostCommentsRetrievalConfig | None = None
|
|
100
|
+
reactions_retrieval_config: PostReactionsRetrievalConfig | None = None
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
FetchPostResult: TypeAlias = Post
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class CreatePostAttachment(LinkedApiModel):
|
|
107
|
+
url: str
|
|
108
|
+
type: AttachmentType
|
|
109
|
+
name: str | None = None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class CreatePostParams(BaseActionParams):
|
|
113
|
+
text: str
|
|
114
|
+
attachments: list[CreatePostAttachment] | None = None
|
|
115
|
+
company_url: str | None = None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class CreatePostResult(LinkedApiModel):
|
|
119
|
+
post_url: str | None = None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Generic, TypeVar
|
|
4
|
+
|
|
5
|
+
from linkedapi.types.base import LinkedApiModel
|
|
6
|
+
|
|
7
|
+
TResult = TypeVar("TResult")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LinkedApiRequestError(LinkedApiModel):
|
|
11
|
+
type: str
|
|
12
|
+
message: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class LinkedApiResponse(LinkedApiModel, Generic[TResult]):
|
|
16
|
+
success: bool
|
|
17
|
+
result: TResult | None = None
|
|
18
|
+
error: LinkedApiRequestError | None = None
|