AiTmed gRPC SDK
common
Module
common
module contains several necessary systems:
- Code system ('common.codes'): enums
- Error system ('common.error'): customized error, error codes
- Type system ('common.types'): Type definitions
Usage
import { common } from 'aitmed-grpc-sdk'
// types
let a: common.types.JSONString = ""
// Error
const error = common.error
const f = () => {
throw new error.AitError("This is a test.")
}
// Codes
const etypes = common.codes.EtypeCode
const CreateUserEtype = etypes.CREATE_USER
grpc
Module
grpc
includes APIs to establish gRPC connections/API calls.
Usage
import { gprc } from 'aitmed-grpc-sdk'
// call v1beta1 createEdge()
import { common } from 'aitmed-grpc-sdk'
const EdgeType = common.types.Edge
let myEdge: common.types.Edge | null = null
grpc.v1beta1.createEdge(common.codes.EtypeCode.CREATE_USER, 'v1beta1', '', '', (edge, err) => {
if (err) {
console.log(err.getMessage())
} else if (edge) {
myEdge = edge
}
})