Comparing version 1.0.49 to 1.0.50
@@ -27,3 +27,4 @@ const csvWriter = require('csv-write-stream'); | ||
class CoaclientAPI { | ||
var CoaclientAPI = { | ||
/** | ||
@@ -35,3 +36,3 @@ * Get refresh, access tokens and expired time by client name from local cache token file | ||
*/ | ||
static getAuthTokens(clientName) { | ||
getAuthTokens(clientName) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -51,3 +52,3 @@ let inputStream = fs.createReadStream(CACHE_DIR_PATH + clientName + AUTH_FILE_SUFFIX, ENCODING_UTF8); | ||
}) | ||
}; | ||
}, | ||
@@ -61,3 +62,3 @@ /** | ||
*/ | ||
static getAccessToken(clientName) { | ||
getAccessToken(clientName) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -84,3 +85,3 @@ let inputStream = fs.createReadStream(CACHE_DIR_PATH + clientName + AUTH_FILE_SUFFIX, ENCODING_UTF8); | ||
}); | ||
}; | ||
}, | ||
@@ -94,3 +95,3 @@ /** | ||
*/ | ||
static getClientConfig(clientIdentifier) { | ||
getClientConfig(clientIdentifier) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -117,3 +118,3 @@ let inputStream = fs.createReadStream(CACHE_DIR_PATH + CONFIG_FILE_NAME, ENCODING_UTF8); | ||
}) | ||
}; | ||
}, | ||
@@ -125,3 +126,3 @@ /** | ||
*/ | ||
static getClientConfigs() { | ||
getClientConfigs() { | ||
return new Promise(function (resolve, reject) { | ||
@@ -148,3 +149,3 @@ let listOfClientConfig = []; | ||
}); | ||
}; | ||
}, | ||
@@ -159,3 +160,3 @@ /** | ||
*/ | ||
static addClientConfig(clientName, clientId, clientSecret, scope) { | ||
addClientConfig(clientName, clientId, clientSecret, scope) { | ||
var self = this; | ||
@@ -181,3 +182,3 @@ if (clientName === '' || clientId === '' || clientSecret === '') { | ||
} | ||
}; | ||
}, | ||
@@ -189,3 +190,3 @@ /** | ||
*/ | ||
static generateAuthTokens(clientName) { | ||
generateAuthTokens(clientName) { | ||
var self = this; | ||
@@ -205,3 +206,3 @@ self.getClientConfig(clientName).then(function (clientConfig) { | ||
}); | ||
}; | ||
}, | ||
@@ -213,3 +214,3 @@ /** | ||
*/ | ||
static deleteClientConfig(clientName) { | ||
deleteClientConfig(clientName) { | ||
var self = this; | ||
@@ -246,3 +247,3 @@ self.getClientConfig(clientName).then(function (result) { | ||
}) | ||
}; | ||
} | ||
} | ||
@@ -249,0 +250,0 @@ |
{ | ||
"name": "coaclient", | ||
"version": "1.0.49", | ||
"version": "1.0.50", | ||
"description": "Execute Node.js library for manage CourseraOAuth2 API tokens", | ||
@@ -5,0 +5,0 @@ "main": "coaclient.js", |
@@ -30,10 +30,7 @@ Coursera OAuth2 client | ||
// import module | ||
const Coaclient = require('coaclient'); | ||
// init it like a normal object | ||
const coaclientAPI = new Coaclient(); | ||
coaclientAPI.addClientConfig(clientName, clientId, clientSecretKey, scope); | ||
coaclientAPI.generateAuthTokens(clientName); | ||
coaclientAPI.getAccessToken(clientName).then(function (tokens) { | ||
var Coaclient = require('coaclient'); | ||
// use static methods | ||
Coaclient.addClientConfig(clientName, clientId, clientSecretKey, scope); | ||
Coaclient.generateAuthTokens(clientName); | ||
Coaclient.getAccessToken(clientName).then(function (tokens) { | ||
// do something with 'tokens'; | ||
@@ -40,0 +37,0 @@ }).catch(function (error) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29585
119