accredo-map

Accredo Web Service API Mapping Library Generator


Keywords
Accredo, Accredo5, Accredo-Map, Bizex, Web, API
License
ICU
Install
npm install accredo-map@1.0.3

Documentation

#accredo-map

"accredo-map" is a tool of generating accredo related endpoints, functions and actions so developers can bind it into accredo for accessing Accredo data, for more information about the accredo package, please refer: http://github.com/ukalpa/accredo

Please notice: normally you don't need to install it, just execute it by 'npx' command to generate the mapping library:

npx accredo-map --url="https://demo.accredo.co.nz:6569/saturn/odata4/v1/Company('demo')/$metadata?access_token=2fCTQBlFdTqHXBSz"
npx accredo-map --file="./source/metadata.xml" --company="test"

##Installation

$npm i accredo-map

##Generate Mapping Library

There are two types of generating map files, either you can import from a remote $metadata url or the local $metadata file

Generate mapping files according to the remote url

node dist/accredo-map.js --url="http://localhost:6567/saturn/odata4/v1/company('demo')/"

Generate mapping files according to the local file

node dist/accredo-map.js --file="./source/metadata.xml" --company="test"

After executing one of the above commands, the script will generate a new folder with mapping files in the directory "accredo-map"

Parameters

By Url

--url="http://localhost:6567/saturn/odata4/v1/company('demo')/"

By Url with token

--url="https://demo.accredo.co.nz:6569/saturn/odata4/v1/Company('demo')/$metadata?access_token=2fCTQBlFdTqHXBSz"

By File

--file="./source/metadata.xml" --company="test"

Optional, Set Destination Directory, "accredo-map" is the default value.

--dest="./test"

Optional, Set script files syntax, you can set "es5" or "es6", "es5" is the default value.

--es=es5

--es=es5/es6, es5 syntax as default

Usage

  • After executing one of the above commands, the generator will generate the related javascript files to "accredo-map/demo/*"
  • Import it to the accredo instance in your code as below, then you should be able to call all entities, functions and actions
const Accredo = require('accredo').default;
const accredo = new Accredo("http://localhost:6567/saturn/odata4/v1/company('demo')/");
require('./accredo-map/demo')(accredo);

// Start using at here:
accredo.ARCustomer.find("DEMO_CUSTOMER").then(function(customer){
    console.log("Got the customer:", customer, "plain object:", customer.toJSON());
})

For more information and commercial support, welcome to contact admin@bizex.co.nz