api-axios
A package wrapping @av/api-core with axios and native ES6 Promise.
Install
NPM
$ npm install @availity/api-axios @availity/api-core
Yarn
$ yarn add @availity/api-axios @availity/api-core
Polyfill Promise
if needed:
NPM
$ npm install es6-promise
Yarn
$ yarn add es6-promise
Usage
import { userApi } from '@availity/api-axios'
function async getUser() {
const user = await userApi.me();
}
API Definitions
AvMicroserviceApi
AvProxyApi
avCodesApi
avDisclaimersApi
avFilesApi
avFilesDeliveryApi
avLogMessagesApi
avNavigationApi
avNotificationApi
avOrganizationsApi
avPdfApi
avPermissionsApi
avProvidersApi
avRegionsApi
avSettingsApi
avSlotMachineApi
avSpacesApi
avUserApi
avUserPermissionsApi
avWebQLApi
Details about each api can be found here
import AvApi, {
AvMicroserviceApi,
AvProxyApi,
avCodesApi,
avDisclaimersApi
avFilesApi,
avFilesDeliveryApi,
avLogMessagesApi,
avNavigationApi,
avNotificationApi,
avOrganizationsApi,
avPdfApi,
avPermissionsApi,
avProvidersApi,
avRegionsApi,
avSettingsApi,
avSlotMachineApi,
avSpacesApi,
avUserApi,
avUserPermissionsApi,
avWebQLApi,
} from '@availity/api-axios';
Create API Definitions
Create new API definitions by extending AvApi
. Extending AvApi
provides services the behaviors described in @api-core/README#features
import AvApi from '@availity/api-axios';
class AvExampleResource extends AvApi {
constructor() {
super({
name: 'exampleApi',
});
}
}
export default new AvExampleResource();
Create Proxy API Definitions
Create new API definitions by extending AvApiProxy
. Extending AvApiProxy
provides services the behaviors described in @api-core/README#features as well as building the url to match your tenant's proxy REST conventions.
import { AvApiProxy } from '@availity/api-axios';
class AvExampleResource extends AvApiProxy {
constructor() {
super({
tenant: 'myhealthplan',
name: 'patients',
});
}
}
export default new AvExampleResource();