README
Discovery api wrapper
Dependencies
- node 12+
- npm 6.x
How to deploy to npm registry
- If you already have verified account. goto second point.
Create account on npm registry and verify the account via email. (make sure to verify the account. )
After creating and verifying the account. run
npm login
in terminal and provide the account credential. To check if you logged in. Runnpm whoami
the output will be username.Before publishing the package. Make sure to delete the
dist
folder in the directory if it is present. change the package name to unique name in thepackage.json
, to avoid conflicts with other package.Run
npm publish
to publish the package.If got any error or 403 error. Make sure that you have verified your account before publishing and your package name is unique in your package.json file.
Lint
$ npm run lint
Installing the package after publishing
$ npm install <package_name>
Note
- The package uses axios as a base for request configuration and making http request.the response will have same schema as axios response
Creating an instance
You can create a instance with custome config.
MetricsApi.create([config])
const instance = MetricsApi.create({
baseURL: '<BASE_URL>', #Required
timeout: 1000, #optional
headers: <HEADERS> #optional
})
Instance methods
The available instance methods are listed below
Clients api
- <instance_name>.clients.createClients(body)
- <instance_name>.clients.downloadClients(params)
- <instance_name>.clients.getClients(params)
AssetsAllocationCard api
- <instance_name>.assetallocationcard.createAssetAllocationCard(body)
- <instance_name>.assetallocationcard.downloadAssetAllocationCard(params)
- <instance_name>.assetallocationcard.getAssetAllocationCard(params)
CardLoading api
- <instance_name>.cardloading.createCardLoading(body)
- <instance_name>.cardloading.downloadCardLoading(params)
- <instance_name>.cardloading.getCardLoading(params)
DddCalcPlanWorthNnn api
- <instance_name>.dddcalcplan.createCalcPlan(body)
- <instance_name>.dddcalcplan.downloadCalcPlan(params)
- <instance_name>.dddcalcplan.getCalcPlan(params)
DddLinks api
- <instance_name>.dddlinks.createDddLinks(body)
- <instance_name>.dddlinks.downloadDddLinks(params)
- <instance_name>.dddlinks.getDddLinks(params)
Drawers Api
- <instance_name>.drawers.createDrawers(body)
- <instance_name>.drawers.downloadDrawers(params)
- <instance_name>.drawers.getDrawers(params)
FeeAdvisoryServicesCardIterations api
- <instance_name>.feeadvisory.createFeeAdvisoryServices(body)
- <instance_name>.feeadvisory.downloadFeeAdvisoryServices(params)
- <instance_name>.feeadvisory.getFeeAdvisoryServices(params)
PageLoading api
- <instance_name>.pageloading.createPageLoading(body)
- <instance_name>.pageloading.downloadPageLoading(params)
- <instance_name>.pageloading.getPageLoading(params)
PdfReport api
- <instance_name>.pdfreport.createPdfReports(body)
- <instance_name>.pdfreport.downloadPdfReports(params)
- <instance_name>.pdfreport.getPdfReports(params)
Plan api
- <instance_name>.plans.createPlans(body)
- <instance_name>.plans.downloadPlans(params)
- <instance_name>.plans.getPlans(params)
ProspectConvertSingleCreatePlanLink api
- <instance_name>.prospectplanlink.createProspectPlanLink(post)
- <instance_name>.prospectplanlink.downloadProspectPlanLink(params)
- <instance_name>.prospectplanlink.getProspectPlanLink(params)
ScenarioCard api
- <instance_name>.scenariocard.createScenarioCard(body)
- <instance_name>.scenariocard.downloadScenarioCard(params)
- <instance_name>.scenariocard.getScenarioCard(params)
Sessions api
- <instance_name>.sessions.createSessions(body)
- <instance_name>.sessions.downloadSessions(params)
- <instance_name>.sessions.getSessions(params)
Tooltips api
- <instance_name>.tooltips.createTooltips(body)
- <instance_name>.tooltips.downloadTooltips(params)
- <instance_name>.tooltips.getTooltips(params)
Response schema
// `data` is the response that was provided by the server
data: {},
// `status` is the HTTP status code from the server response
status: 200,
// `statusText` is the HTTP status message from the server response
statusText: 'OK',
// `headers` the HTTP headers that the server responded with
// All header names are lower cased and can be accessed using the bracket notation.
// Example: `response.headers['content-type']`
headers: {},
// `config` is the config that was provided to `axios` for the request
config: {},
// `request` is the request that generated this response
// It is the last ClientRequest instance in node.js (in redirects)
// and an XMLHttpRequest instance in the browser
request: {}
Example
const {MetricsApi} = require('<package_name>')
const instance = MetricsApi.create({
baseURL: 'https://api.example.com'
})
const params = {<request_query_params>}
const body = {<request_body>}
instance.clients.getClients(params).then(res => {
console.log(res.data, res.status)
})
instance.clients.createClients(body).then(res => {
console.log(res.data, res.status)
})