diff --git a/clients/dotnet/README.md b/clients/dotnet/README.md index 0f4906f..55e8911 100644 --- a/clients/dotnet/README.md +++ b/clients/dotnet/README.md @@ -196,6 +196,28 @@ dotnet run --project clients/dotnet/ZB.MOM.WW.MxGateway.Client.Cli -- galaxy-las dotnet run --project clients/dotnet/ZB.MOM.WW.MxGateway.Client.Cli -- galaxy-discover --endpoint http://localhost:5000 --api-key-env MXGATEWAY_API_KEY ``` +### Browsing lazily + +For UI trees or OPC UA bridges, use `BrowseChildrenAsync` to walk one level at a +time instead of paging the full hierarchy. Pass an empty request for root objects; +subsequent calls supply `ParentGobjectId`, `ParentTagName`, or +`ParentContainedPath`. Each child's `ChildHasChildren[i]` tells you whether to +draw an expand triangle. Filter fields match `DiscoverHierarchy`. See +[Galaxy Repository](../../docs/GalaxyRepository.md#browsechildren) for full +request and filter semantics. + +```csharp +BrowseChildrenReply roots = await repository.BrowseChildrenAsync( + new BrowseChildrenRequest()); + +for (int i = 0; i < roots.Children.Count; i++) +{ + GalaxyObject child = roots.Children[i]; + bool hasChildren = roots.ChildHasChildren[i]; + Console.WriteLine($"{child.TagName} expand={hasChildren}"); +} +``` + ### Watching deploy events `WatchDeployEventsAsync` opens the `WatchDeployEvents` server-streaming RPC. The diff --git a/clients/go/README.md b/clients/go/README.md index 58384b3..ecc6df7 100644 --- a/clients/go/README.md +++ b/clients/go/README.md @@ -121,6 +121,28 @@ reports `present=false` (no deploy recorded). `DiscoverHierarchy` returns the generated `*GalaxyObject` slice with each object's dynamic attributes populated for direct contract access. +### Browsing lazily + +For UI trees or OPC UA bridges, use `BrowseChildren` to walk one level at a +time instead of loading the full hierarchy. Pass an empty request for root +objects; subsequent calls set `ParentGobjectId`, `ParentTagName`, or +`ParentContainedPath`. Filter fields match `DiscoverHierarchy`. Each response +pairs `Children` with `ChildHasChildren` so you know which nodes to expand. See +[Galaxy Repository](../../docs/GalaxyRepository.md#browsechildren) for full +request and filter semantics. + +```go +import pb "gitea.dohertylan.com/dohertj2/mxaccessgw/clients/go/internal/generated/galaxy_repository/v1" + +reply, err := galaxy.BrowseChildren(ctx, &pb.BrowseChildrenRequest{}) +if err != nil { + return err +} +for i, child := range reply.GetChildren() { + fmt.Printf("%s expand=%v\n", child.GetTagName(), reply.GetChildHasChildren()[i]) +} +``` + ### Watching deploy events `WatchDeployEvents` opens a server-streaming subscription. The server emits a diff --git a/clients/java/README.md b/clients/java/README.md index 977beef..8adb867 100644 --- a/clients/java/README.md +++ b/clients/java/README.md @@ -116,6 +116,29 @@ gradle :zb-mom-ww-mxgateway-cli:run --args="galaxy-deploy-time --endpoint localh gradle :zb-mom-ww-mxgateway-cli:run --args="galaxy-discover --endpoint localhost:5000 --api-key-env MXGATEWAY_API_KEY --plaintext --json" ``` +### Browsing lazily + +For UI trees or OPC UA bridges, use `browseChildren` to walk one level at a +time instead of loading the full hierarchy with `discoverHierarchy`. Pass a +default request for root objects; subsequent calls set `parentGobjectId`, +`parentTagName`, or `parentContainedPath`. Filter fields match +`DiscoverHierarchy`. Each response pairs `getChildrenList()` with +`getChildHasChildrenList()` so you know which nodes to expand. See +[Galaxy Repository](../../docs/GalaxyRepository.md#browsechildren) for full +request and filter semantics. This snippet documents the API as it appears once +the Java client is regenerated on the Windows host. + +```java +BrowseChildrenReply reply = galaxy.browseChildren( + BrowseChildrenRequest.newBuilder().build()); + +List children = reply.getChildrenList(); +List hasChildren = reply.getChildHasChildrenList(); +for (int i = 0; i < children.size(); i++) { + System.out.printf("%s expand=%b%n", children.get(i).getTagName(), hasChildren.get(i)); +} +``` + ### Watching deploy events `GalaxyRepository.WatchDeployEvents` is a server-streaming RPC: the gateway diff --git a/clients/python/README.md b/clients/python/README.md index 43a8e1e..d126bc2 100644 --- a/clients/python/README.md +++ b/clients/python/README.md @@ -138,6 +138,25 @@ The methods return native Python types (`bool`, `datetime | None`, and a into the hierarchy without learning the underlying stub class. The service requires the `metadata:read` scope on the API key. +### Browsing lazily + +For UI trees or OPC UA bridges, use `browse_children` to walk one level at a +time instead of loading the full hierarchy with `discover_hierarchy`. Pass an +empty request for root objects; subsequent calls set `parent_gobject_id`, +`parent_tag_name`, or `parent_contained_path`. Filter fields match +`DiscoverHierarchy`. Each response pairs `children` with `child_has_children` so +you know which nodes to expand. See +[Galaxy Repository](../../docs/GalaxyRepository.md#browsechildren) for full +request and filter semantics. + +```python +from zb_mom_ww_mxgateway.generated import galaxy_repository_pb2 as galaxy_pb2 + +reply = await galaxy.browse_children(galaxy_pb2.BrowseChildrenRequest()) +for child, has_children in zip(reply.children, reply.child_has_children): + print(child.tag_name, "expand=" + str(has_children)) +``` + ### Watching deploy events `GalaxyRepositoryClient.watch_deploy_events` opens a server-streaming diff --git a/clients/rust/README.md b/clients/rust/README.md index a52c23d..8eca189 100644 --- a/clients/rust/README.md +++ b/clients/rust/README.md @@ -138,6 +138,25 @@ cargo run -p mxgw-cli -- galaxy last-deploy-time --endpoint http://localhost:500 cargo run -p mxgw-cli -- galaxy discover-hierarchy --endpoint http://localhost:5000 --api-key-env MXGATEWAY_API_KEY --json ``` +### Browsing lazily + +For UI trees or OPC UA bridges, use `browse_children` to walk one level at a +time instead of paging the full hierarchy. Pass a default request for root +objects; subsequent calls set `parent_gobject_id`, `parent_tag_name`, or +`parent_contained_path`. Filter fields match `discover_hierarchy`. Each response +pairs `children` with `child_has_children` so you know which nodes to expand. See +[Galaxy Repository](../../docs/GalaxyRepository.md#browsechildren) for full +request and filter semantics. + +```rust +use zb_mom_ww_mxgateway_client::generated::galaxy_repository::v1::BrowseChildrenRequest; + +let reply = galaxy.browse_children(BrowseChildrenRequest::default()).await?.into_inner(); +for (child, has_children) in reply.children.iter().zip(reply.child_has_children.iter()) { + println!("{} expand={}", child.tag_name, has_children); +} +``` + ### Watching deploy events `watch_deploy_events` opens the `WatchDeployEvents` server stream. The diff --git a/gateway.md b/gateway.md index f350767..4db6d7a 100644 --- a/gateway.md +++ b/gateway.md @@ -65,6 +65,9 @@ Detailed follow-up docs: - `docs/GalaxyRepository.md` covers the read-only Galaxy Repository browse RPCs that let clients enumerate the deployed object hierarchy and dynamic attributes before subscribing via the MXAccess gateway service. + `DiscoverHierarchy` returns paged flat results; `BrowseChildren` returns + the direct children of one parent for OPC UA-style lazy tree walks — see + [Galaxy Repository](docs/GalaxyRepository.md#browsechildren). Implementation style guides: