Skip to content

Commit 5673fa8

Browse files
update job searching
1 parent e2b231b commit 5673fa8

5 files changed

Lines changed: 58 additions & 2 deletions

File tree

linkedapi/errors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"retrievingNotAllowed",
1717
"connectionNotFound",
1818
"searchingNotAllowed",
19+
"searchInterfaceMismatch",
1920
"companyNotFound",
2021
"postNotFound",
2122
"jobNotFound",
@@ -41,6 +42,7 @@
4142
"retrievingNotAllowed",
4243
"connectionNotFound",
4344
"searchingNotAllowed",
45+
"searchInterfaceMismatch",
4446
"companyNotFound",
4547
"postNotFound",
4648
"jobNotFound",

linkedapi/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@
9696
JobDatePosted,
9797
JobEmploymentType,
9898
JobExperienceLevel,
99+
JobPreferenceEmploymentType,
100+
JobPreferenceExperienceLevel,
99101
JobSalary,
100102
JobWorkplaceType,
101103
SalaryPeriod,
102104
SearchJobResult,
103105
SearchJobsFilter,
104106
SearchJobsParams,
107+
SearchJobsPreferences,
105108
)
106109
from linkedapi.types.message import (
107110
ConversationPollRequest,
@@ -320,6 +323,8 @@
320323
"JobDatePosted",
321324
"JobEmploymentType",
322325
"JobExperienceLevel",
326+
"JobPreferenceEmploymentType",
327+
"JobPreferenceExperienceLevel",
323328
"JobSalary",
324329
"JobWorkplaceType",
325330
"LanguageProficiency",
@@ -419,6 +424,7 @@
419424
"SearchJobResult",
420425
"SearchJobsFilter",
421426
"SearchJobsParams",
427+
"SearchJobsPreferences",
422428
"SearchPeopleFilter",
423429
"SearchPeopleParams",
424430
"SearchPeopleResult",

linkedapi/types/jobs.py

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@
2424
"other",
2525
]
2626
JobWorkplaceType = Literal["onSite", "remote", "hybrid"]
27+
# Experience levels of LinkedIn's AI-powered jobs search. Not a subset of JobExperienceLevel:
28+
# "senior" corresponds to "midSeniorLevel", "manager" has no classic equivalent, and "internship"
29+
# and "associate" are absent here.
30+
JobPreferenceExperienceLevel = Literal[
31+
"entryLevel",
32+
"senior",
33+
"manager",
34+
"director",
35+
"executive",
36+
]
37+
# Same names as JobEmploymentType, minus "temporary" and "other".
38+
JobPreferenceEmploymentType = Literal[
39+
"fullTime",
40+
"partTime",
41+
"contract",
42+
"internship",
43+
"volunteer",
44+
]
2745
SalaryPeriod = Literal["yearly", "monthly", "hourly"]
2846
JobCurrency = Literal[
2947
"usd",
@@ -74,6 +92,12 @@ class JobSalary(LinkedApiModel):
7492

7593

7694
class SearchJobsFilter(LinkedApiModel):
95+
"""Filtering criteria for the classic LinkedIn jobs search.
96+
97+
Every specified field is applied, or the action fails.
98+
"""
99+
100+
# Deprecated: use the top-level "location" of SearchJobsParams instead.
77101
location: str | None = None
78102
date_posted: JobDatePosted | None = None
79103
experience_levels: list[JobExperienceLevel] | None = None
@@ -89,9 +113,32 @@ class SearchJobsFilter(LinkedApiModel):
89113
fair_chance_employer: bool | None = None
90114

91115

116+
class SearchJobsPreferences(LinkedApiModel):
117+
"""Filtering criteria for LinkedIn's AI-powered jobs search.
118+
119+
LinkedIn decides which of them it offers for a given search, and the ones it does not offer are
120+
skipped instead of failing the action.
121+
"""
122+
123+
date_posted: JobDatePosted | None = None
124+
experience_levels: list[JobPreferenceExperienceLevel] | None = None
125+
employment_types: list[JobPreferenceEmploymentType] | None = None
126+
companies: list[str] | None = None
127+
remote: bool | None = None
128+
easy_apply: bool | None = None
129+
under_10_applicants: bool | None = None
130+
in_your_network: bool | None = None
131+
keywords: list[str] | None = None
132+
133+
92134
class SearchJobsParams(BaseActionParams, LimitParams):
93135
term: str | None = None
136+
location: str | None = None
137+
allow_similar_results: bool | None = None
138+
# "filter" and "preferences" are mutually exclusive: "filter" targets the classic LinkedIn jobs
139+
# search, "preferences" the AI-powered one.
94140
filter: SearchJobsFilter | None = None
141+
preferences: SearchJobsPreferences | None = None
95142
custom_search_url: str | None = None
96143

97144

@@ -106,6 +153,7 @@ class SearchJobResult(LinkedApiModel):
106153
salary: JobSalary | None = None
107154
easy_apply: bool | None = None
108155
is_promoted: bool | None = None
156+
is_similar_match: bool | None = None
109157

110158

111159
class FetchJobParams(BaseActionParams):
@@ -118,7 +166,6 @@ class Job(LinkedApiModel):
118166
job_url: str | None = None
119167
title: str | None = None
120168
company_name: str | None = None
121-
company_urn: str | None = None
122169
company_url: str | None = None
123170
location: str | None = None
124171
posted_date: str | None = None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "linkedapi"
7-
version = "1.3.8"
7+
version = "1.3.9"
88
description = "Official synchronous Python SDK for Linked API."
99
readme = "README.md"
1010
requires-python = ">=3.10"

tests/test_errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_error_type_sets_match_node_contract() -> None:
4545
"retrievingNotAllowed",
4646
"connectionNotFound",
4747
"searchingNotAllowed",
48+
"searchInterfaceMismatch",
4849
"companyNotFound",
4950
"postNotFound",
5051
"jobNotFound",

0 commit comments

Comments
 (0)