Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@availity/api-core
Advanced tools
Base API definitions for the Availity REST API.
AvApi
is a class that wraps a provided http service with helper functions.
import AvApi from '@availity/api-core';
new AvApi(http, promise, options);
http
Either Angular's $http
service or Axios (or compatible lib).
promise
Either Angular $q
or equivalent Promise
object.
config
Either Angular $http
or axios
config object
config.api
Default true
. When true
, the url is built out by joining path
, version
, and name
or just url
if no name is defined. The id
is also added when appropriate. When api
is false
, all calls just use url
. URL pattern: path/version/name
config.url
This is used for requests when config.api
is false or name
is undefined;
config.path
Used for url building when config.api
is true. URL pattern path/version/name
config.version
Default v1
. Used for url building when config.api
is true. URL pattern path/version/name
config.name
The name of the resource. Used for url building when api
is true. (path/version/name
)
config.cacheBust
Disable caching for every request by adding a cacheBust
parameter to the call.
Accepts a boolean, function, or some value:
true
, a timestamp is generated and usedconfig.pageBust
Bust the browser cache on page load, and keep its value for lifecycle of the page. Same behavior as cacheBust
except if true, a value is only generated once and re-used. A hard refresh of page resets the pageBust
value. To manually set the pageBust
value call without changing the config, use setPageBust(value)
which will set the it to value
or if undefined generate a timestamp.
config.sessionBust
Default true
. Attempts to read a value in local storage that is generated at login. This forces the browser to bust the cache when a new session has started. If the local storage value is not found, uses the pageBust
value.
config.polling
Default true
. If true and rest services return 202
statuc code, AvApi
will attempt to poll on predefined internvals until the retries are exhausted or the api returns non 202
response.
config.pollingIntervals
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.
config.getHeader
Used for polling, if the http
service used has special logic to get a header value, then define this function to handle that logic. If defined, it is called with (response, headerKey)
.
If not defined, attempts to get key
from response.headers[key]
.
Each method can use an after function, (ex. afterGet
with get
). These are available to modify the response before it is resolved. Each method that has data available has a before function in order to modify data before the call is made.
All methods accept a config object, which is merged into the resources config for that call only.
Makes HTTP POST
request.
create(data, config);
// or
post(data, config);
Makes HTTP POST
using X-HTTP-Method-Override = 'GET'
. There server must support override methods for the request to succeed.
postGet(data, config);
Retrieves an entity by ID. Makes HTTP GET
call with /id
in url.
get(id, config);
The query function is designed to fetch collections and search the API. Makes HTTP GET
request with query params.
query(config);
Update an entity with a PUT call. When an id is passed in, /id
is added to the url.
update(id, data, config);
// or wihthout id
update(data, config);
// or
put(id, data, config);
// or or without it
put(data, config);
Remove an entity with a DELETE call. When an id is passed in, /id
is added to the url. If the first parameter is a string or number, it is treated as an ID, otherwise data.
remove(id, config);
// or without id
remove(data, config);
// or
delete(data, config);
// or without id
delete(config);
1.0.0-alpha.7 (2018-01-03)
<a name="1.0.0-alpha.6"></a>
FAQs
Base API definitions for the Availity REST API
The npm package @availity/api-core receives a total of 286 weekly downloads. As such, @availity/api-core popularity was classified as not popular.
We found that @availity/api-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.