Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client_example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ require (
github.com/arduino/arduino-cli v0.0.0-20200109150215-ffa84fdaab21
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282 // indirect
google.golang.org/grpc v1.23.0
)
)
24 changes: 24 additions & 0 deletions client_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func main() {
log.Println("calling LibrarySearch(audio)")
callLibSearch(client, instance)

// List the dependencies of the ArduinoIoTCloud library
log.Println("calling LibraryResolveDependencies(ArduinoIoTCloud)")
callLibraryResolveDependencies(client, instance)

// List installed libraries
log.Println("calling LibraryList")
callLibList(client, instance)
Expand Down Expand Up @@ -734,6 +738,26 @@ func callLibSearch(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
}
}

func callLibraryResolveDependencies(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
libraryResolveDependenciesResp, err := client.LibraryResolveDependencies(context.Background(),
&rpc.LibraryResolveDependenciesReq{
Instance: instance,
Name: "ArduinoIoTCloud",
})

if err != nil {
log.Fatalf("Error listing library dependencies: %s", err)
}

for _, resp := range libraryResolveDependenciesResp.GetDependencies() {
log.Printf("Dependency Name: %s", resp.GetName())
log.Printf("Version Required: %s", resp.GetVersionRequired())
if resp.GetVersionInstalled() != "" {
log.Printf("Version Installed: %s\n", resp.GetVersionInstalled())
}
}
}

func callLibList(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
libLstResp, err := client.LibraryList(context.Background(),
&rpc.LibraryListReq{
Expand Down