https://github.com/tidepool-org/devices
A GRPC service that provides info about Tidepool supported CGMs and insulin pumps
https://github.com/tidepool-org/devices
Last synced: 4 months ago
JSON representation
A GRPC service that provides info about Tidepool supported CGMs and insulin pumps
- Host: GitHub
- URL: https://github.com/tidepool-org/devices
- Owner: tidepool-org
- Created: 2020-06-22T20:44:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-22T21:09:13.000Z (5 months ago)
- Last Synced: 2024-11-22T22:19:11.711Z (5 months ago)
- Language: Go
- Size: 135 KB
- Stars: 1
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Devices
A GRPC service which provides info about Tidepool supported devicesThe service also exposes a REST interface that proxies the requests to the GRPC server using [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway).
## Development
You can start the service locally by running `make start`.
### Prerequisites
Multiple components of this service (grpc server stub, grpc client and grpc gateway proxy) are generated from the protobuf service definition `api/api.proto`.
This requires the protocol buffer compiler to be installed on the system. On Mac OS you can install it using `brew`:```
brew install protobuf
```For other operating systems, you can follow the [official installation instructions](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation).
You can install the grpc and grpc-gateway-proxy generation plugins by running:
```
make install
```
### Code generationIf you make any changes to the proto service definition, you can regenerate the client, server stub, server interface and gateway-proxy
by running:
```
make generate
```### Examples
##### List pumps using GRPC
```
grpcurl -plaintext localhost:50051 api.Devices/ListPumps{
"pumps": [
{
"id": "6678c377-928c-49b3-84c1-19e2dafaff8d",
"displayName": "Omnipod Horizon",
"manufacturers": [
"Insulet"
],
"model": "Omnipod Horizon"
}
]
}
```##### Get pump by id using GRPC
```
grpcurl -plaintext -d '{"id":"6678c377-928c-49b3-84c1-19e2dafaff8d"}' localhost:50051 api.Devices/GetPumpById{
"pump": {
"id": "6678c377-928c-49b3-84c1-19e2dafaff8d",
"displayName": "Omnipod Horizon",
"manufacturers": [
"Insulet"
],
"model": "Omnipod Horizon"
}
}
```