Skip to content

Commit 9210736

Browse files
update job searching
1 parent 2c6df38 commit 9210736

4 files changed

Lines changed: 65 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linkedapi/node",
3-
"version": "2.3.9",
3+
"version": "2.3.10",
44
"description": "Control your LinkedIn accounts and retrieve real-time data, all through this Node.js SDK.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,10 @@ class LinkedApi {
986986
* This method performs a job search on LinkedIn using the standard search interface.
987987
* You can filter by location, date posted, experience level, employment type, workplace type, and more.
988988
*
989+
* LinkedIn serves either a classic or an AI-powered jobs search, and the two do not offer the
990+
* same refinements. Pass `filter` for the classic one or `preferences` for the AI-powered one,
991+
* never both.
992+
*
989993
* @param params - Search parameters including keywords, filters, and pagination options
990994
* @returns Promise resolving to an object containing an array of job search results
991995
*
@@ -995,8 +999,8 @@ class LinkedApi {
995999
* ```typescript
9961000
* const workflow = await linkedapi.searchJobs.execute({
9971001
* term: "product manager",
1002+
* location: "San Francisco, California, United States",
9981003
* filter: {
999-
* location: "San Francisco, California, United States",
10001004
* experienceLevels: ["midSeniorLevel", "director"],
10011005
* workplaceTypes: ["remote", "hybrid"]
10021006
* },

src/types/actions/job.ts

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,35 @@ export const JOB_WORKPLACE_TYPE = {
3636
} as const;
3737
export type TJobWorkplaceType = (typeof JOB_WORKPLACE_TYPE)[keyof typeof JOB_WORKPLACE_TYPE];
3838

39+
/**
40+
* Experience levels of LinkedIn's AI-powered jobs search.
41+
* Not a subset of {@link JOB_EXPERIENCE_LEVEL}: `senior` corresponds to `midSeniorLevel`, `manager`
42+
* has no classic equivalent, and `internship` / `associate` are absent here.
43+
*/
44+
export const JOB_PREFERENCE_EXPERIENCE_LEVEL = {
45+
entryLevel: 'entryLevel',
46+
senior: 'senior',
47+
manager: 'manager',
48+
director: 'director',
49+
executive: 'executive',
50+
} as const;
51+
export type TJobPreferenceExperienceLevel =
52+
(typeof JOB_PREFERENCE_EXPERIENCE_LEVEL)[keyof typeof JOB_PREFERENCE_EXPERIENCE_LEVEL];
53+
54+
/**
55+
* Employment types of LinkedIn's AI-powered jobs search.
56+
* Same names as {@link JOB_EMPLOYMENT_TYPE}, minus `temporary` and `other`.
57+
*/
58+
export const JOB_PREFERENCE_EMPLOYMENT_TYPE = {
59+
fullTime: 'fullTime',
60+
partTime: 'partTime',
61+
contract: 'contract',
62+
internship: 'internship',
63+
volunteer: 'volunteer',
64+
} as const;
65+
export type TJobPreferenceEmploymentType =
66+
(typeof JOB_PREFERENCE_EMPLOYMENT_TYPE)[keyof typeof JOB_PREFERENCE_EMPLOYMENT_TYPE];
67+
3968
export const JOB_SALARY_PERIOD = {
4069
yearly: 'yearly',
4170
monthly: 'monthly',
@@ -91,7 +120,12 @@ export interface TJobSalary {
91120
period: TJobSalaryPeriod | null;
92121
}
93122

123+
/**
124+
* Filtering criteria for the classic LinkedIn jobs search. Every specified field is applied, or the
125+
* action fails.
126+
*/
94127
export interface TJobFilter {
128+
/** @deprecated Use the top-level `location` of {@link TSearchJobsParams} instead. */
95129
location?: string;
96130
datePosted?: TJobDatePosted;
97131
experienceLevels?: TJobExperienceLevel[];
@@ -107,10 +141,32 @@ export interface TJobFilter {
107141
fairChanceEmployer?: boolean;
108142
}
109143

144+
/**
145+
* Filtering criteria for LinkedIn's AI-powered jobs search. LinkedIn decides which of them it
146+
* offers for a given search, and the ones it does not offer are skipped instead of failing the
147+
* action.
148+
*/
149+
export interface TJobPreferences {
150+
datePosted?: TJobDatePosted;
151+
experienceLevels?: TJobPreferenceExperienceLevel[];
152+
employmentTypes?: TJobPreferenceEmploymentType[];
153+
companies?: string[];
154+
remote?: boolean;
155+
easyApply?: boolean;
156+
under10Applicants?: boolean;
157+
inYourNetwork?: boolean;
158+
keywords?: string[];
159+
}
160+
110161
export interface TSearchJobsParams extends TBaseActionParams {
111162
term?: string;
112163
limit?: number;
164+
location?: string;
165+
allowSimilarResults?: boolean;
166+
/** Mutually exclusive with {@link TSearchJobsParams.preferences}. */
113167
filter?: TJobFilter;
168+
/** Mutually exclusive with {@link TSearchJobsParams.filter}. */
169+
preferences?: TJobPreferences;
114170
customSearchUrl?: string;
115171
}
116172

@@ -125,6 +181,7 @@ export interface TSearchJobResult {
125181
salary: TJobSalary | null;
126182
easyApply: boolean;
127183
isPromoted: boolean;
184+
isSimilarMatch: boolean;
128185
}
129186

130187
export interface TBaseFetchJobParams extends TBaseActionParams {
@@ -139,7 +196,6 @@ export interface TJob {
139196
jobUrl: string;
140197
title: string;
141198
companyName: string | null;
142-
companyUrn: string | null;
143199
companyUrl: string | null;
144200
location: string | null;
145201
postedDate: string | null;

src/types/errors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { TOperationName } from '../core';
1818
* - retrievingNotAllowed (retrieveConnections, fetchCompany, nvFetchCompany)
1919
* - connectionNotFound (removeConnection)
2020
* - searchingNotAllowed (searchCompanies, searchPeople, searchJobs, nvSearchCompanies, nvSearchPeople)
21+
* - searchInterfaceMismatch (searchJobs)
2122
* - companyNotFound (fetchCompany, nvFetchCompany)
2223
* - postNotFound (fetchPost, reactToPost, commentOnPost)
2324
* - jobNotFound (fetchJob)
@@ -43,6 +44,7 @@ export const LINKED_API_ACTION_ERROR = {
4344
retrievingNotAllowed: 'retrievingNotAllowed',
4445
connectionNotFound: 'connectionNotFound',
4546
searchingNotAllowed: 'searchingNotAllowed',
47+
searchInterfaceMismatch: 'searchInterfaceMismatch',
4648
companyNotFound: 'companyNotFound',
4749
postNotFound: 'postNotFound',
4850
jobNotFound: 'jobNotFound',

0 commit comments

Comments
 (0)