From 5e91e32387700c0c852878e84c2098af794d2ac7 Mon Sep 17 00:00:00 2001
From: jlacoche <jeremy.lacoche@orange.com>
Date: Sat, 13 Jul 2024 00:53:58 +0200
Subject: [PATCH] add sync methods for trackables world anchors and links
 request

---
 Runtime/Scripts/REST/TrackableRequest.cs   | 10 ++++++++++
 Runtime/Scripts/REST/WorldAnchorRequest.cs |  9 +++++++++
 Runtime/Scripts/REST/WorldLinkRequest.cs   |  9 +++++++++
 3 files changed, 28 insertions(+)

diff --git a/Runtime/Scripts/REST/TrackableRequest.cs b/Runtime/Scripts/REST/TrackableRequest.cs
index cd65c94..044ea21 100644
--- a/Runtime/Scripts/REST/TrackableRequest.cs
+++ b/Runtime/Scripts/REST/TrackableRequest.cs
@@ -45,6 +45,16 @@ namespace ETSI.ARF.WorldStorage.REST
             return ro;
         }
 
+        static public List<Trackable> GetTrackablesSync(WorldStorageServer ws)
+        {
+            wsServer = ws;
+            var httpClient = new BasicHTTPClient(ws.URI);
+            apiClient = new WorldStorageClient(httpClient);
+
+            Debug.Log("[REST] Request Trackables...");
+            return apiClient.GetTrackables(token);
+        }
+
         static public ResponseObject<List<Trackable>> GetTrackablesAsync(WorldStorageServer ws, Action<ResponseObject<List<Trackable>>> func)
         {
             wsServer = ws;
diff --git a/Runtime/Scripts/REST/WorldAnchorRequest.cs b/Runtime/Scripts/REST/WorldAnchorRequest.cs
index 1c19e53..34ba629 100644
--- a/Runtime/Scripts/REST/WorldAnchorRequest.cs
+++ b/Runtime/Scripts/REST/WorldAnchorRequest.cs
@@ -46,6 +46,15 @@ namespace ETSI.ARF.WorldStorage.REST
             return ro;
         }
 
+        static public List<WorldAnchor> GetWorldAnchorsSync(WorldStorageServer ws)
+        {
+            wsServer = ws;
+            var httpClient = new BasicHTTPClient(ws.URI);
+            apiClient = new WorldStorageClient(httpClient);
+
+            return apiClient.GetWorldAnchors(token);
+        }
+
         static public ResponseObject<List<WorldAnchor>> GetWorldAnchorsAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldAnchor>>> func)
         {
             wsServer = ws;
diff --git a/Runtime/Scripts/REST/WorldLinkRequest.cs b/Runtime/Scripts/REST/WorldLinkRequest.cs
index e7be11e..7350dde 100644
--- a/Runtime/Scripts/REST/WorldLinkRequest.cs
+++ b/Runtime/Scripts/REST/WorldLinkRequest.cs
@@ -45,6 +45,15 @@ namespace ETSI.ARF.WorldStorage.REST
             return ro;
         }
 
+        static public List<WorldLink> GetWorldLinksSync(WorldStorageServer ws)
+        {
+            wsServer = ws;
+            var httpClient = new BasicHTTPClient(ws.URI);
+            apiClient = new WorldStorageClient(httpClient);
+
+            return apiClient.GetWorldLinks(token);
+        }
+
         static public ResponseObject<List<WorldLink>> GetWorldLinksAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldLink>>> func)
         {
             wsServer = ws;
-- 
GitLab