@availity/api-axios

Wraps @availity/api-core with Axios

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@availity/api-axios
Minified + gzip package size for @availity/api-axios in KB

Readme

api-axios

A package wrapping @availity/api-core with axios and native ES6 Promise.

Version

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

// complete example
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();

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.