node-linkedin-v2
Advanced tools
Comparing version 0.0.7 to 0.0.8
'use strict'; | ||
module.exports = require('./lib/LinkedInAPI'); |
@@ -47,3 +47,17 @@ 'use strict'; | ||
} | ||
/** | ||
* Retrieve current member's email | ||
* | ||
* @param access_token | ||
* @returns {Promise<Object>} | ||
*/ | ||
async getCurrentMemberEmail(access_token) { | ||
if (!access_token) throw new Error('Access code cannot be empty'); | ||
const url = `${this.url}/emailAddress?q=members&projection=(elements*(handle~))`; | ||
return this.invoke('GET', url, undefined, undefined, { withAuth: true, access_token }); | ||
} | ||
/** | ||
@@ -126,3 +140,3 @@ * Find Total Number of Connections | ||
*/ | ||
async getSharesByOwner(type, id, start = 0, count = 50, shares_per_owner = 1000, access_token) { | ||
async getSharesByOwner(type, id, start = 0, count = 50, shares_per_owner = 1000, access_token = '') { | ||
if (!type) throw new Error('Parameter "type" cannot be empty'); | ||
@@ -171,3 +185,3 @@ if (type !== 'organization' && type !== 'person') throw new Error('Parameter "type" must be "person" or "organization"'); | ||
* @param {object} headers - The HTTP headers (i.e. {'random-header-name': 'random-header-value', 'content-type': 'application/json'}) | ||
* @param {object} body - The JSON data to POST if applicable, or null | ||
* @param {object} reqBody - The JSON data to POST if applicable, or null | ||
* @param {object} auth - An object to pass to make a call which requires authorization, example { withAuth: true, access_token: 'access_token' } | ||
@@ -177,7 +191,7 @@ * | ||
*/ | ||
invoke(method, url, headers = { 'Content-Type': 'Application/json' }, body = {}, auth = { withAuth: false, access_token: null }) { | ||
invoke(method, url, headers = { 'Content-Type': 'Application/json' }, reqBody = {}, auth = { withAuth: false, access_token: null }) { | ||
return new Promise((resolve, reject) => { | ||
let options; | ||
try { | ||
options = this.generateOptions(method, url, headers, body, auth); | ||
options = this.generateOptions(method, url, headers, reqBody, auth); | ||
} catch (err) { | ||
@@ -184,0 +198,0 @@ return reject(err); |
{ | ||
"name": "node-linkedin-v2", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Client for LinkedIn API v2", | ||
@@ -13,6 +13,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"chai-http": "^4.0.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.0.1" | ||
"chai": "^4.2.0", | ||
"chai-http": "^4.3.0", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "engines": { |
@@ -0,0 +0,0 @@ # node-linkedin |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -22,3 +22,3 @@ 'use strict'; | ||
try { | ||
const url = linkedInAPI.getAuthorizationUrl('r_basicprofile,r_basicprofile_2', 'state'); | ||
linkedInAPI.getAuthorizationUrl('r_basicprofile,r_basicprofile_2', 'state'); | ||
} catch (err) { | ||
@@ -28,2 +28,2 @@ expect(err.message).to.be.equal('Scope must be an array'); | ||
}); | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
14529
300