@availity/api-core
Advanced tools
Comparing version 2.5.0 to 2.6.0
{ | ||
"name": "@availity/api-core", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Base API definitions for the Availity REST API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import AvApi from '../api'; | ||
export default class AvSettings extends AvApi { | ||
constructor({ http, promise, merge, config }) { | ||
constructor({ http, promise, merge, avUsers, config }) { | ||
const options = Object.assign( | ||
@@ -9,2 +9,4 @@ { | ||
name: 'settings', | ||
sessionBust: false, | ||
pageBust: true, | ||
}, | ||
@@ -19,3 +21,39 @@ config | ||
}); | ||
this.avUsers = avUsers; | ||
} | ||
getApplication(applicationId, config) { | ||
if (!applicationId) { | ||
throw new Error('must define applicationId'); | ||
} | ||
return this.avUsers.me().then(user => { | ||
const queryConfig = this.addParams( | ||
{ applicationId, userId: user.id }, | ||
config | ||
); | ||
return this.query(queryConfig); | ||
}); | ||
} | ||
setApplication(applicaitonId, data, config) { | ||
if ( | ||
typeof applicaitonId !== 'string' && | ||
typeof applicaitonId !== 'number' | ||
) { | ||
config = data; | ||
data = applicaitonId; | ||
applicaitonId = ''; | ||
} | ||
if (!applicaitonId && (!data.scope || !data.scope.applicationId)) { | ||
throw new Error('must set applicationId in settings call'); | ||
} | ||
return this.avUsers.me().then(user => { | ||
data.scope = data.scope || {}; | ||
data.scope.applicationId = applicaitonId; | ||
data.scope.userId = user.id; | ||
return this.update(data, config); | ||
}); | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
191834
44
2393
1