@availity/api-angular

4.4.5 • Public • Published

api-angular

A package wrapping @av/api-core with Angular $http.

Version

Install

npm install @availity/api-angular @availity/api-core @availity/localstorage-core --save

Usage

import availityApi from '@availity/api-angular';
angular.module('app', [availityApi]);

Inject one of the predefined API classes in a controller or service:

app.service('myCustomService', avUsersApi => {
    return avUsersApi.me();
});

API Definitions

The services below can be injected into other services or controllers

  • avApiOptions
  • AvMicroserviceApi
  • avLogMessagesApi
  • AvProxyApi
  • avWebQLApi
  • avPdfApi
  • avNavigationApi
  • avNotificationApi
  • avOrganizationsApi
  • avPermissionsApi
  • avProvidersApi
  • avRegionsApi
  • avSpacesApi
  • avUsersApi
  • avUserPermissionsApi
  • avFilesApi
  • avFilesDeliverApi
  • avSettingsApi
  • avCodesApi

Details about each api can be found here

app.service(
    'myCustomService',
    (
        avPdfApi,
        avNavigationApi,
        avNotificationApi,
        avOrganizationsApi,
        avPermissionsApi,
        avProvidersApi,
        AvProxyApi,
        avRegionsApi,
        avSpacesApi,
        avUsersApi,
        avUserPermissionsApi
    ) => {
        // code
    }
);

Options

Configure the default options:

config(avApiOptionsProvider => {
    avApiOptionsProvider.setOptions({
        version: 'v2',
    });
});

Create API Definitions

Create API definitions by extending AvApi. Extending AvApi provides services the behaviors described in @api-core/README#features

function factory(AvApi) {
    class AvExampleResource extends AvApi {
        constructor() {
            super({
                name: 'exampleApi',
            });
        }
    }
    return new AvExampleResource();
}

Create Proxy API Definitions

Create proxy 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.

function factory(AvApiProxy) {
    class AvExampleResource extends AvApiProxy {
        constructor() {
            super({
                tenant: 'myhealthplan',
                name: 'patients',
            });
        }
    }
    return new AvExampleResource();
}

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @availity/api-angular

    Weekly Downloads

    3

    Version

    4.4.5

    License

    MIT

    Unpacked Size

    28.8 kB

    Total Files

    31

    Last publish

    Collaborators

    • lauroxx
    • dznjudo
    • availity-cicd-bot
    • azeigler
    • dnoler
    • jselden
    • cbaker1
    • twarner
    • gregmartdotin
    • hnicbaker
    • chrishavekost
    • jordan-a-young