Loading Runtime/Scripts/REST/AdminRequest.cs +3 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Ping..."); Debug.Log("[REST] Request Ping..."); ResponseObject<string> ro = new ResponseObject<string>("Request Ping", func); apiClient.GetPingAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -60,7 +60,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Admin..."); Debug.Log("[REST] Request Admin..."); ResponseObject<string> ro = new ResponseObject<string>("Request Admin", func); apiClient.GetAdminAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -72,7 +72,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Version..."); Debug.Log("[REST] Request Version..."); ResponseObject<string> ro = new ResponseObject<string>("Request Version", func); apiClient.GetVersionAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading Runtime/Scripts/REST/RequestBase.cs +2 −2 Original line number Diff line number Diff line Loading @@ -49,11 +49,11 @@ namespace ETSI.ARF.WorldStorage.REST ResponseObject<TObj> o = (ResponseObject<TObj>)id; o.responseTime = DateTime.Now; o.result = t.Result; Debug.Log($"Server Response = {o.result} (ID={o.transactionId}, Msg={o.message})"); Debug.Log($"[REST] Server Response = {o.result.ToString()} (ID={o.transactionId}, Msg={o.message})"); o.callback?.Invoke(o); } else Debug.Log("OpenAPI Timeout!"); else Debug.Log("[REST] OpenAPI Timeout!"); } static protected void OnReceiveListOfObjects<TObj>(Task<List<TObj>> t, object id) where TObj : IModel Loading Runtime/Scripts/REST/TrackableRequest.cs +7 −9 Original line number Diff line number Diff line Loading @@ -15,18 +15,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: March 2024 // Last change: June 2024 // #define USING_OPENAPI_GENERATOR // alt. is Swagger using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; namespace ETSI.ARF.WorldStorage.REST { Loading @@ -41,7 +39,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request 1 Trackable..."); Debug.Log("[REST] Request 1 Trackable..."); ResponseObject<Trackable> ro = new ResponseObject<Trackable>("Request Trackable " + UUID.ToString(), func); apiClient.GetTrackableByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<Trackable>, ro); return ro; Loading @@ -53,7 +51,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Trackables..."); Debug.Log("[REST] Request Trackables..."); ResponseObject<List<Trackable>> ro = new ResponseObject<List<Trackable>>("Request Trackables", func); apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<Trackable>, ro); return ro; Loading @@ -65,7 +63,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Create 1 Trackable..."); Debug.Log("[REST] Create 1 Trackable..."); // Add some management stuffs trackable.UUID = Guid.NewGuid(); Loading @@ -82,7 +80,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Update Trackable..."); Debug.Log("[REST] Update Trackable..."); ResponseObject<string> ro = new ResponseObject<string>("Update Trackable " + trackable.UUID.ToString(), func); apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -93,7 +91,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Delete 1 Trackable..."); Debug.Log("[REST] Delete 1 Trackable..."); ResponseObject<string> ro = new ResponseObject<string>("Delete Trackable " + UUID.ToString(), func); apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; Loading Runtime/Scripts/REST/WorldAnchorRequest.cs +66 −36 Original line number Diff line number Diff line Loading @@ -18,55 +18,85 @@ // Last change: March 2024 // using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; //#if UNITY_EDITOR namespace ETSI.ARF.WorldStorage.REST { public class WorldAnchorRequest public class WorldAnchorRequest : RequestBase<WorldAnchor> { //static public string AddWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) //{ // Debug.Log("Posting Add World Anchor to Server"); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // string result = api.AddWorldAnchor(anchor); // Debug.Log(result); // return result; //} // // Wrapper for the endpoints // static public ResponseObject<WorldAnchor> GetWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldAnchor>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request 1 WorldAnchor..."); ResponseObject<WorldAnchor> ro = new ResponseObject<WorldAnchor>("Request WorldAnchor " + UUID.ToString(), func); apiClient.GetWorldAnchorByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldAnchor>, ro); return ro; } static public ResponseObject<List<WorldAnchor>> GetWorldAnchorsAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldAnchor>>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldAnchors..."); ResponseObject<List<WorldAnchor>> ro = new ResponseObject<List<WorldAnchor>>("Request WorldAnchors", func); apiClient.GetWorldAnchorsAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldAnchor>, ro); return ro; } //static public string UpdateWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) //{ // Debug.Log("Posting Add World Anchor to Server"); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // string result = api.ModifyWorldAnchor(anchor); // Debug.Log(result); // return result; //} static public ResponseObject<string> CreateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Create 1 WorldAnchor..."); //static public List<WorldAnchor> GetAllWorldAnchors(WorldStorageServer ws) //{ // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // List<WorldAnchor> result = api.GetWorldAnchors(); // return result; //} // Add some management stuffs worldAnchor.UUID = Guid.NewGuid(); worldAnchor.CreatorUUID = Guid.Empty; //static public WorldAnchor GetWorldAnchor(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // WorldAnchor result = api.GetWorldAnchorById(_uuid); // return result; //} ResponseObject<string> ro = new ResponseObject<string>("Create WorldAnchor " + worldAnchor.Name + " (no UUID)", func); apiClient.AddWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> UpdateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); //static public void DeleteWorldAnchor(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // api.DeleteWorldAnchor(_uuid); //} Debug.Log("[REST] Update WorldAnchor..."); ResponseObject<string> ro = new ResponseObject<string>("Update WorldAnchor " + worldAnchor.UUID.ToString(), func); apiClient.ModifyWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> DeleteWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Delete 1 WorldAnchor..."); ResponseObject<string> ro = new ResponseObject<string>("Delete WorldAnchor " + UUID.ToString(), func); apiClient.DeleteWorldAnchorAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } } } //#endif No newline at end of file Runtime/Scripts/REST/WorldLinkRequest.cs +67 −38 Original line number Diff line number Diff line Loading @@ -15,58 +15,87 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: March 2024 // Last change: June 2024 // using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; //#if UNITY_EDITOR namespace ETSI.ARF.WorldStorage.REST { public class WorldLinkRequest public class WorldLinkRequest : RequestBase<WorldLink> { //static public string AddWorldLink(WorldStorageServer ws, WorldLink link) //{ // Debug.Log("Posting Add Trackable to Server"); // WorldLinksApi api = new WorldLinksApi(ws.URI); // string result = api.AddWorldLink(link); // Debug.Log(result); // return result; //} // // Wrapper for the endpoints // static public ResponseObject<WorldLink> GetWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldLink>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request 1 WorldLink..."); ResponseObject<WorldLink> ro = new ResponseObject<WorldLink>("Request WorldLink " + UUID.ToString(), func); apiClient.GetWorldLinkByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldLink>, ro); return ro; } static public ResponseObject<List<WorldLink>> GetWorldLinksAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldLink>>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldLinks..."); ResponseObject<List<WorldLink>> ro = new ResponseObject<List<WorldLink>>("Request WorldLinks", func); apiClient.GetWorldLinksAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldLink>, ro); return ro; } //static public string UpdateWorldLink(WorldStorageServer ws, WorldLink link) //{ // Debug.Log("Posting Add Trackable to Server"); // WorldLinksApi api = new WorldLinksApi(ws.URI); // string result = api.ModifyWorldLink(link); // Debug.Log(result); // return result; //} static public ResponseObject<string> CreateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Create 1 WorldLink..."); //static public List<WorldLink> GetAllWorldLinks(WorldStorageServer ws) //{ // WorldLinksApi api = new WorldLinksApi(ws.URI); // List<WorldLink> result = api.GetWorldLinks(); // return result; //} // Add some management stuffs worldLink.UUID = Guid.NewGuid(); worldLink.CreatorUUID = Guid.Empty; //static public WorldLink GetWorldLink(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldLinksApi api = new WorldLinksApi(ws.URI); // WorldLink result = api.GetWorldLinkById(_uuid); // return result; //} ResponseObject<string> ro = new ResponseObject<string>("Create WorldLink (no UUID)", func); apiClient.AddWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> UpdateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); //static public void DeleteWorldLink(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldLinksApi api = new WorldLinksApi(ws.URI); // api.DeleteWorldLink(_uuid); //} Debug.Log("[REST] Update WorldLink..."); ResponseObject<string> ro = new ResponseObject<string>("Update WorldLink " + worldLink.UUID.ToString(), func); apiClient.ModifyWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> DeleteWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Delete 1 WorldLink..."); ResponseObject<string> ro = new ResponseObject<string>("Delete WorldLink " + UUID.ToString(), func); apiClient.DeleteWorldLinkAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } } } //#endif No newline at end of file Loading
Runtime/Scripts/REST/AdminRequest.cs +3 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Ping..."); Debug.Log("[REST] Request Ping..."); ResponseObject<string> ro = new ResponseObject<string>("Request Ping", func); apiClient.GetPingAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -60,7 +60,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Admin..."); Debug.Log("[REST] Request Admin..."); ResponseObject<string> ro = new ResponseObject<string>("Request Admin", func); apiClient.GetAdminAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -72,7 +72,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Version..."); Debug.Log("[REST] Request Version..."); ResponseObject<string> ro = new ResponseObject<string>("Request Version", func); apiClient.GetVersionAsync().ContinueWith(OnReceiveObject<string>, ro); return ro; Loading
Runtime/Scripts/REST/RequestBase.cs +2 −2 Original line number Diff line number Diff line Loading @@ -49,11 +49,11 @@ namespace ETSI.ARF.WorldStorage.REST ResponseObject<TObj> o = (ResponseObject<TObj>)id; o.responseTime = DateTime.Now; o.result = t.Result; Debug.Log($"Server Response = {o.result} (ID={o.transactionId}, Msg={o.message})"); Debug.Log($"[REST] Server Response = {o.result.ToString()} (ID={o.transactionId}, Msg={o.message})"); o.callback?.Invoke(o); } else Debug.Log("OpenAPI Timeout!"); else Debug.Log("[REST] OpenAPI Timeout!"); } static protected void OnReceiveListOfObjects<TObj>(Task<List<TObj>> t, object id) where TObj : IModel Loading
Runtime/Scripts/REST/TrackableRequest.cs +7 −9 Original line number Diff line number Diff line Loading @@ -15,18 +15,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: March 2024 // Last change: June 2024 // #define USING_OPENAPI_GENERATOR // alt. is Swagger using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; namespace ETSI.ARF.WorldStorage.REST { Loading @@ -41,7 +39,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request 1 Trackable..."); Debug.Log("[REST] Request 1 Trackable..."); ResponseObject<Trackable> ro = new ResponseObject<Trackable>("Request Trackable " + UUID.ToString(), func); apiClient.GetTrackableByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<Trackable>, ro); return ro; Loading @@ -53,7 +51,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Request Trackables..."); Debug.Log("[REST] Request Trackables..."); ResponseObject<List<Trackable>> ro = new ResponseObject<List<Trackable>>("Request Trackables", func); apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<Trackable>, ro); return ro; Loading @@ -65,7 +63,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Create 1 Trackable..."); Debug.Log("[REST] Create 1 Trackable..."); // Add some management stuffs trackable.UUID = Guid.NewGuid(); Loading @@ -82,7 +80,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Update Trackable..."); Debug.Log("[REST] Update Trackable..."); ResponseObject<string> ro = new ResponseObject<string>("Update Trackable " + trackable.UUID.ToString(), func); apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; Loading @@ -93,7 +91,7 @@ namespace ETSI.ARF.WorldStorage.REST var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("Delete 1 Trackable..."); Debug.Log("[REST] Delete 1 Trackable..."); ResponseObject<string> ro = new ResponseObject<string>("Delete Trackable " + UUID.ToString(), func); apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; Loading
Runtime/Scripts/REST/WorldAnchorRequest.cs +66 −36 Original line number Diff line number Diff line Loading @@ -18,55 +18,85 @@ // Last change: March 2024 // using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; //#if UNITY_EDITOR namespace ETSI.ARF.WorldStorage.REST { public class WorldAnchorRequest public class WorldAnchorRequest : RequestBase<WorldAnchor> { //static public string AddWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) //{ // Debug.Log("Posting Add World Anchor to Server"); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // string result = api.AddWorldAnchor(anchor); // Debug.Log(result); // return result; //} // // Wrapper for the endpoints // static public ResponseObject<WorldAnchor> GetWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldAnchor>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request 1 WorldAnchor..."); ResponseObject<WorldAnchor> ro = new ResponseObject<WorldAnchor>("Request WorldAnchor " + UUID.ToString(), func); apiClient.GetWorldAnchorByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldAnchor>, ro); return ro; } static public ResponseObject<List<WorldAnchor>> GetWorldAnchorsAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldAnchor>>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldAnchors..."); ResponseObject<List<WorldAnchor>> ro = new ResponseObject<List<WorldAnchor>>("Request WorldAnchors", func); apiClient.GetWorldAnchorsAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldAnchor>, ro); return ro; } //static public string UpdateWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) //{ // Debug.Log("Posting Add World Anchor to Server"); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // string result = api.ModifyWorldAnchor(anchor); // Debug.Log(result); // return result; //} static public ResponseObject<string> CreateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Create 1 WorldAnchor..."); //static public List<WorldAnchor> GetAllWorldAnchors(WorldStorageServer ws) //{ // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // List<WorldAnchor> result = api.GetWorldAnchors(); // return result; //} // Add some management stuffs worldAnchor.UUID = Guid.NewGuid(); worldAnchor.CreatorUUID = Guid.Empty; //static public WorldAnchor GetWorldAnchor(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // WorldAnchor result = api.GetWorldAnchorById(_uuid); // return result; //} ResponseObject<string> ro = new ResponseObject<string>("Create WorldAnchor " + worldAnchor.Name + " (no UUID)", func); apiClient.AddWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> UpdateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); //static public void DeleteWorldAnchor(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); // api.DeleteWorldAnchor(_uuid); //} Debug.Log("[REST] Update WorldAnchor..."); ResponseObject<string> ro = new ResponseObject<string>("Update WorldAnchor " + worldAnchor.UUID.ToString(), func); apiClient.ModifyWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> DeleteWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Delete 1 WorldAnchor..."); ResponseObject<string> ro = new ResponseObject<string>("Delete WorldAnchor " + UUID.ToString(), func); apiClient.DeleteWorldAnchorAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } } } //#endif No newline at end of file
Runtime/Scripts/REST/WorldLinkRequest.cs +67 −38 Original line number Diff line number Diff line Loading @@ -15,58 +15,87 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: March 2024 // Last change: June 2024 // using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI.WorldStorage; //#if UNITY_EDITOR namespace ETSI.ARF.WorldStorage.REST { public class WorldLinkRequest public class WorldLinkRequest : RequestBase<WorldLink> { //static public string AddWorldLink(WorldStorageServer ws, WorldLink link) //{ // Debug.Log("Posting Add Trackable to Server"); // WorldLinksApi api = new WorldLinksApi(ws.URI); // string result = api.AddWorldLink(link); // Debug.Log(result); // return result; //} // // Wrapper for the endpoints // static public ResponseObject<WorldLink> GetWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldLink>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request 1 WorldLink..."); ResponseObject<WorldLink> ro = new ResponseObject<WorldLink>("Request WorldLink " + UUID.ToString(), func); apiClient.GetWorldLinkByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldLink>, ro); return ro; } static public ResponseObject<List<WorldLink>> GetWorldLinksAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldLink>>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldLinks..."); ResponseObject<List<WorldLink>> ro = new ResponseObject<List<WorldLink>>("Request WorldLinks", func); apiClient.GetWorldLinksAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldLink>, ro); return ro; } //static public string UpdateWorldLink(WorldStorageServer ws, WorldLink link) //{ // Debug.Log("Posting Add Trackable to Server"); // WorldLinksApi api = new WorldLinksApi(ws.URI); // string result = api.ModifyWorldLink(link); // Debug.Log(result); // return result; //} static public ResponseObject<string> CreateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Create 1 WorldLink..."); //static public List<WorldLink> GetAllWorldLinks(WorldStorageServer ws) //{ // WorldLinksApi api = new WorldLinksApi(ws.URI); // List<WorldLink> result = api.GetWorldLinks(); // return result; //} // Add some management stuffs worldLink.UUID = Guid.NewGuid(); worldLink.CreatorUUID = Guid.Empty; //static public WorldLink GetWorldLink(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldLinksApi api = new WorldLinksApi(ws.URI); // WorldLink result = api.GetWorldLinkById(_uuid); // return result; //} ResponseObject<string> ro = new ResponseObject<string>("Create WorldLink (no UUID)", func); apiClient.AddWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> UpdateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); //static public void DeleteWorldLink(WorldStorageServer ws, string uuid) //{ // System.Guid _uuid = System.Guid.Parse(uuid); // WorldLinksApi api = new WorldLinksApi(ws.URI); // api.DeleteWorldLink(_uuid); //} Debug.Log("[REST] Update WorldLink..."); ResponseObject<string> ro = new ResponseObject<string>("Update WorldLink " + worldLink.UUID.ToString(), func); apiClient.ModifyWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } static public ResponseObject<string> DeleteWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Delete 1 WorldLink..."); ResponseObject<string> ro = new ResponseObject<string>("Delete WorldLink " + UUID.ToString(), func); apiClient.DeleteWorldLinkAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); return ro; } } } //#endif No newline at end of file