added pagination
This commit is contained in:
@@ -49,7 +49,8 @@ const queryOptions = {
|
||||
remoteFilter: 'remote',
|
||||
salary: '100000',
|
||||
experienceLevel: 'entry level',
|
||||
limit: '10'
|
||||
limit: '10',
|
||||
page: "0",
|
||||
};
|
||||
|
||||
linkedIn.query(queryOptions).then(response => {
|
||||
@@ -72,7 +73,7 @@ query() accepts a _queryOptions_ object and returns an array of _Job_ objects.
|
||||
| experienceLevel | "" | _string_ - `internship`, `entry level`, `associate`, `senior`, `director`, `executive` |
|
||||
| limit | "" | _string_ - Number of jobs returned: (i.e. '1', '10', '100', etc) |
|
||||
| sortBy | "" | _string_ - `recent`, `relevant` |
|
||||
|
||||
| page | "0" | _string_ - `0`, `1`, `2` .... |
|
||||
## Job Objects
|
||||
|
||||
| Paramter | Description (Default: null) |
|
||||
|
||||
6
index.js
6
index.js
@@ -19,6 +19,7 @@ function Query(queryObj) {
|
||||
this.experienceLevel = queryObj.experienceLevel || "";
|
||||
this.sortBy = queryObj.sortBy || "";
|
||||
this.limit = Number(queryObj.limit) || 0;
|
||||
this.page = Number(queryObj.page) || 0;
|
||||
}
|
||||
|
||||
Query.prototype.getDateSincePosted = function () {
|
||||
@@ -74,6 +75,9 @@ Query.prototype.getSalary = function () {
|
||||
return salaryRange[this.salary.toLowerCase()] ?? "";
|
||||
};
|
||||
|
||||
Query.prototype.getPage = function () {
|
||||
return this.page * 25;
|
||||
};
|
||||
Query.prototype.url = function (start) {
|
||||
let query = `https://${this.host}/jobs-guest/jobs/api/seeMoreJobPostings/search?`;
|
||||
if (this.keyword !== "") query += `keywords=${this.keyword}`;
|
||||
@@ -85,7 +89,7 @@ Query.prototype.url = function (start) {
|
||||
query += `&f_E=${this.getExperienceLevel()}`;
|
||||
if (this.getRemoteFilter() !== "") query += `&f_WT=${this.getRemoteFilter()}`;
|
||||
if (this.getJobType() !== "") query += `&f_JT=${this.getJobType()}`;
|
||||
query += `&start=${start}`;
|
||||
if (this.getPage() !== "") query += `&start=${start + this.getPage()};`;
|
||||
if (this.sortBy == "recent" || this.sortBy == "relevant") {
|
||||
let sortMethod = "R";
|
||||
if (this.sortBy == "recent") sortMethod = "DD";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "linkedin-jobs-api",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "advanced node.js package for getting job listings from LinkedIn",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user