@otr-app/shared-backend-generated-client
TypeScript icon, indicating that this package has built-in type declarations

2.3.272 • Public • Published

Import

In your app.js, inject the otrBackendService module

angular.module("otr-console", [
    'ngAnimate',
    'ngCookies',
    'ngStorage',
    'ngRetina',
    ...
    'otrBackendService'
]);

Instantiation

  • Inject OtrService into your controller/bizLogic
  • Create an OtrService variable in the scope of the controller/bizLogic
  • You can inject the domain via constructor injection.
...
var otrService = new OtrService({domain: ENV.apiEndpoint})
...

Usage

  • The methods generated in the OtrService component are the java methodName + "Using" + httpMethod
  • E.g. getCaseUsingGET, confirmBookingUsingPOST, and etc...
let responseSuccess = await otrService.getCaseUsingGET({caseId: caseId});

Error Handling

  • Sample Code
try {
    await otrService.getCaseUsingGET({caseId: caseId})
} catch(error) {
    const uiErrorMsg = error.body.error.uiErrorMsg;
}

How to upgrade the generated AngularJS client

  1. Make sure you are authenticated with npm under the @otr-app organization
    1. npm login --scope=@otr-app
  2. Generate the JSON models and endpoints from devo npm run generate:devo
    1. OR generate the JSON models and endpoints from local server npm run generate:local
  3. Optional: Sanity check the differences in otrBackendService.js
    1. git diff HEAD dist/otrBackendService.js
  4. Update version number in package.json
    1. npm version patch
  5. Commit the changes and push to github
  6. Execute npm publish
  7. Done.

Dependencies (5)

Dev Dependencies (14)

Package Sidebar

Install

npm i @otr-app/shared-backend-generated-client

Weekly Downloads

235

Version

2.3.272

License

none

Unpacked Size

7.1 MB

Total Files

2737

Last publish

Collaborators

  • melissascmi
  • skona306
  • alexguirguis
  • jsteinotr
  • morkos