Socket
Socket
Sign inDemoInstall

@donniekim/rest-client

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.2

79

index.js

@@ -1,4 +0,75 @@

module.exports = {
company: 'Matrix Jobs',
project: 'Rest API Client'
};
const axios = require('axios')
function RestClient(config) {
this.config = config || {}
if (!this.config.baseURL) {
this.config.baseURL = 'https://api.justjobs.io'
}
if (!this.config.domain) {
this.config.domain = process.env.DOMAIN || 'https://careerfactory.net'
}
this.client = axios.create({
baseURL: this.config.baseURL
})
}
RestClient.prototype.setConfig = function(config, replace = false) {
if (replace) {
this.config = config
} else {
Object.assign(this.config, config)
}
this.client = axios.create({
baseURL: this.config.baseURL || "https://api.justjobs.io"
})
}
RestClient.prototype.search = function(payload) {
const params = {
limit: 20,
q: '',
l: '',
page: 1,
placement: 'job_board',
site: this.config.domain,
co: 'us',
distance: 30
}
Object.assign(params, payload)
if (payload.category) {
params.c0 = payload.category
}
let query = querystring.stringify(params)
let url = `/api/es_search?${query}`
return this.client.get(url).then(resp => resp.data)
}
RestClient.prototype.locationSearch = function(country, term, size) {
let url = `/api/suggestions/location?co=${country}&term=${term}&size=${size}`
return this.client.get(url).then(resp => resp.data)
}
RestClient.prototype.ipLookup = function(ip) {
let url = `/api/ip-lookup?ip=${ip}`
return this.client.get(url).then(resp => resp.data)
}
RestClient.prototype.getChain = function(location, trackInfo) {
let params = Object.assign(trackInfo, {
l: location,
chain_name: "dynamic_cf",
site: process.env.DOMAIN
})
let query = querystring.stringify(trackInfo)
let url = `/api/chain?${query}`
return this.client.get(url).then(resp => resp.data)
}
RestClient.prototype.trackImpression = function(payload) {
let url = `/api/impression`
return this.client.post(url, payload).then(resp => resp.data)
}
module.exports = RestClient;

9

package.json
{
"name": "@donniekim/rest-client",
"version": "1.0.0",
"version": "1.0.2",
"description": "Rest Client for MatrixJobs API",

@@ -19,7 +19,10 @@ "main": "index.js",

"author": "Donnie Kim",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/matrix-media/jobs-search-engine-js-client/issues"
},
"homepage": "https://gitlab.com/matrix-media/jobs-search-engine-js-client#readme"
"homepage": "https://gitlab.com/matrix-media/jobs-search-engine-js-client#readme",
"dependencies": {
"axios": "^0.19.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc