@availity/api-core
Advanced tools
Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7
{ | ||
"name": "@availity/api-core", | ||
"version": "1.0.0-alpha.6", | ||
"description": "Base definitions for Availity API", | ||
"version": "1.0.0-alpha.7", | ||
"description": "Base API definitions for the Availity REST API", | ||
"keywords": [ | ||
@@ -17,6 +17,6 @@ "availity", | ||
"peerDependencies": { | ||
"@availity/localstorage-core": "^1.0.0-alpha.6" | ||
"@availity/localstorage-core": "^1.0.0-alpha.7" | ||
}, | ||
"devDependencies": { | ||
"@availity/localstorage-core": "^1.0.0-alpha.6" | ||
"@availity/localstorage-core": "^1.0.0-alpha.7" | ||
}, | ||
@@ -23,0 +23,0 @@ "publishConfig": { |
# api-core | ||
> Base API definitions for the Availity REST API. | ||
A package providing a base API class as well as several API resources for help in developing against the Availity Rest API. | ||
## AvApi | ||
`AvApi` is a lightweight class that wraps a provided http service with helper functions designed for Availity's REST API. | ||
`AvApi` is a class that wraps a provided http service with helper functions. | ||
@@ -19,3 +18,3 @@ ### Features | ||
new AvApi(http, promise, config); | ||
new AvApi(http, promise, options); | ||
``` | ||
@@ -69,3 +68,3 @@ | ||
##### `config.pollingIntervals` | ||
An array of intervals (in ms) to wait before making another request. | ||
An array of intervals (ms) to wait before making another request. | ||
Default is 1, 2, 5, then 10 seconds. After all the intervals have been used, `AvApi` will stop attempting requests and return the last response. | ||
@@ -136,2 +135,1 @@ | ||
``` | ||
## [Resources](src/resources/README.md) |
@@ -1,2 +0,2 @@ | ||
import AvApi from './resource'; | ||
import AvApi from './api'; | ||
import AvLogMessages from './resources/logs'; | ||
@@ -3,0 +3,0 @@ import AvNavigation from './resources/navigation'; |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvLogMessages extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvNavigation extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvNotification extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvOrganizations extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvPdfs extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvPermissions extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvProviders extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvProxy extends AvApi { |
@@ -5,19 +5,20 @@ # Availity API's | ||
* [Intro](#Intro) | ||
* [AvUser](#AvUser) | ||
* [AvRegions](#AvRegions) | ||
* [AvPermissions](#AvPermissions) | ||
* [AvUserPermissions](#AvUserPermissions) | ||
* [AvNavigation](#AvNavigation) | ||
* [AvSpaces](#AvSpaces) | ||
* [AvOrganizations](#AvOrganizations) | ||
* [AvProviders](#AvProviders) | ||
* [AvLogMessage](#AvLogMessage) | ||
* [Intro](#intro) | ||
* [AvUser](#avuser) | ||
* [AvRegions](#avregions) | ||
* [AvPermissions](#avpermissions) | ||
* [AvUserPermissions](#avuserpermissions) | ||
* [AvNavigation](#avnavigation) | ||
* [AvSpaces](#avspaces) | ||
* [AvOrganizations](#avorganizations) | ||
* [AvProviders](#avproviders) | ||
* [AvLogMessage](#avlogmessage) | ||
* [AvProxy](#avproxy) | ||
## Intro | ||
To see the details for configuring the resources see [AvApi](../README.md). | ||
View [AvApi](../README.md) to see the details for configuring API definitions. | ||
### AvUser | ||
Get information about current logged-in user. | ||
Get information about current logged in user. | ||
@@ -27,6 +28,6 @@ #### Methods | ||
##### `me()` | ||
Helper function that returns information about logged-in user. | ||
Helper function that returns information about logged in user. | ||
### AvRegions | ||
Gets the logged-in user's current selected region as well as the regions the user is associated with. | ||
Gets the logged in user's current selected region as well as the regions the user is associated with. | ||
@@ -36,12 +37,12 @@ #### Methods | ||
##### `getRegions(config)` | ||
Get regions for logged-in user. | ||
Get regions for logged in user. | ||
##### `getCurrentRegion()` | ||
Returns just the current region for the logged-in user. | ||
Returns just the current region for the logged in user. | ||
### AvPermissions | ||
Get permissions belonging to the logged-in user. | ||
Get permissions belonging to the logged in user. | ||
### AvUserPermissions | ||
Get permissions as well as resources of the logged-in user. | ||
Get permissions as well as resources of the logged in user. | ||
@@ -60,7 +61,12 @@ ### AvSpaces | ||
##### `getOrganizations(config)` | ||
Returns organizations belonging to the logged-in user. | ||
Returns organizations belonging to the logged in user. | ||
### AvProviders | ||
Get providers associated to the logged-in user's organization. | ||
Get providers associated to the logged in user's organization. | ||
#### Methods | ||
##### `getProviders(customerId, config)` | ||
Helper method that gets the providers for the `customerId`. | ||
### AvLogMessage | ||
@@ -71,6 +77,18 @@ Create a log message. | ||
All methods take a entries object, remove it's level, and using the level of the function, call create with `{level, entries}`; | ||
* debug | ||
* info | ||
* warn | ||
* error | ||
All methods take a key value object. A key named 'level` determines the log level type in the logs. | ||
##### `debug(keyValue)` | ||
##### `info(keyValue)` | ||
##### `warn(keyValue)` | ||
##### `error(keyValue)` | ||
### AvProxy | ||
Create API definitions for services that are proxied to a tenant's API gateway. | ||
#### Options | ||
##### `tenant` | ||
The Spaces platform customer name which is used as part of the url for API's proxied to 3rd party API gateway. | ||
@@ -1,5 +0,5 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
export default class AvRegions extends AvApi { | ||
constructor(http, promise, AvUsers, config = {}) { | ||
constructor(http, promise, avUsers, config = {}) { | ||
const options = Object.assign( | ||
@@ -15,3 +15,3 @@ { | ||
super(http, promise, options); | ||
this.AvUsers = AvUsers; | ||
this.avUsers = avUsers; | ||
} | ||
@@ -25,3 +25,3 @@ | ||
getRegions(config) { | ||
return this.AvUsers.me().then(user => { | ||
return this.avUsers.me().then(user => { | ||
config.params = config.params || {}; | ||
@@ -28,0 +28,0 @@ config.params.userId = config.params.userId || user.id; |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -33,8 +33,4 @@ export default class AvSpaces extends AvApi { | ||
getSpaceName(spaceId) { | ||
return this.query({ | ||
params: { | ||
id: spaceId, | ||
}, | ||
}).then(response => response.data.name); | ||
return this.get(spaceId).then(response => response.data.name); | ||
} | ||
} |
@@ -0,0 +0,0 @@ import AvNotification from '../notification'; |
@@ -5,3 +5,3 @@ import AvSpaces from '../spaces'; | ||
const query = jest.fn(() => | ||
const get = jest.fn(() => | ||
Promise.resolve({ | ||
@@ -20,3 +20,3 @@ status: 200, | ||
api = new AvSpaces(mockHttp, Promise, {}); | ||
api.query = query; | ||
api.get = get; | ||
}); | ||
@@ -23,0 +23,0 @@ |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvUsers extends AvApi { |
@@ -1,2 +0,2 @@ | ||
import AvApi from '../resource'; | ||
import AvApi from '../api'; | ||
@@ -3,0 +3,0 @@ export default class AvUserPermissions extends AvApi { |
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
56756
31
1595
133
1