0.3.0 • Published 3 years ago
@tunadao1/service v0.3.0
Service
Getting Started
1. Install Service
npm i @tunadao1/service --save
2. Import
ES6
import service from '@tunadao1/service';
CommonJS
const service = require('@tunadao1/service').default;
Using
Create a service instance
Service expects to receive 3 parameters:
Name | Type | Obs |
---|---|---|
token | string | |
contractNumber | string | |
environment | string | DEV, HOMOLOG, PROD |
Example:
import service from '@tunadao1/service';
service({
token: '49eaf9775c959416',
contractNumber: '003349338695',
environment: 'HOMOLOG'
})
Access the modules
After creating an instance of service it is possible to access the modules, which are named by the name of each responsible squad or global in the case of global modules.
Example:
import service from '@tunadao1/service';
service({
token: '49eaf9775c959416',
contractNumber: '003349338695',
environment: 'HOMOLOG'
}).Home // Home, Technician, Financial, Global
Access the sub modules
After accessing a module, you will have access to its submodules, which are features of a functionality.
Example:
import service from '@tunadao1/service';
// ...
const response = await service({
token: '49eaf9775c959416',
contractNumber: '003349338695',
environment: 'HOMOLOG'
}).Home.Netflix.getEligibility();
Service uses Axios under the hood, then returns an AxiosPromise.