Socket
Book a DemoInstallSign in
Socket

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

Package Overview
Dependencies
Maintainers
5
Versions
672
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Generate client-side and service-side code using swagger CLI

2.5.52
latest
Source
npmnpm
Version published
Weekly downloads
1.2K
71.31%
Maintainers
5
Weekly downloads
 
Created
Source

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

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

FAQs

Package last updated on 02 Sep 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.