Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

medisot-hyperledger-client

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medisot-hyperledger-client

Hyperledger client for medisot

  • 3.0.1
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by766.67%
Maintainers
1
Weekly downloads
 
Created
Source


JIMI
A lightweight library that helps establish connection with the chaincode

How to use
To run the application:

  1. Install the library using:
npm install --save medisot-hyperledger-client
  1. Register the connection dependency that's required by medisot-hyperledger-client to connect with BCN:
container.bind<any>(HyperledgerClientTypes.Connection).toConstantValue(Connection);
  1. Register the medisot-hyperledger-client dependency in the application container:
import { HyperledgerClient, TYPES as HyperledgerClientTypes } from "medisot-hyperledger-client";

container.bind<HyperledgerClient>(TYPES.HyperledgerClient).to(HyperledgerClient);
  1. Inject this dependency wherever required and use it's apis:
export default class AppointmentService {
   constructor(@inject(TYPES.HyperledgerClient) private hyperledgerClient: HyperledgerClient) {}

   public async getAppointment(appointmentId: string, loggedInUser: string) {
       return this.hyperledgerClient.InvokeHandler("getAppointmentById", appointmentId, loggedInUser, null, true).then((appointmentResponse: any) => {
           if (appointmentResponse.success) {
               return AppUtils.createGenericServiceResponseObj(appointmentResponse, SERVICE_RESPONSE_STATUS.SUCCESS, null);
           } else {
               return AppUtils.createGenericServiceResponseObj(null, SERVICE_RESPONSE_STATUS.FAILED, appointmentResponse);
           }
       }).catch((err: any) => {
           return AppUtils.createGenericServiceResponseObj(null, SERVICE_RESPONSE_STATUS.FAILED, err);
       })
   }

   public async createAppointment(appointmentObj: any, username: string) {
       return this.hyperledgerClient.InvokeHandler("bookAppointment", JSON.stringify(appointmentObj), username, null, false).then((bookAppointmentResponse: any) => {
           if (bookAppointmentResponse.success) {
               return AppUtils.createGenericServiceResponseObj(bookAppointmentResponse, SERVICE_RESPONSE_STATUS.SUCCESS, null);
           } else {
               return AppUtils.createGenericServiceResponseObj(null, SERVICE_RESPONSE_STATUS.FAILED, bookAppointmentResponse);
           }
       }).catch((err: any) => {
           return AppUtils.createGenericServiceResponseObj(null, SERVICE_RESPONSE_STATUS.FAILED, err);
       })
   }
}

FAQs

Package last updated on 12 Jun 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc