From 6f1e544c2c2ee63d7e1c02c599d3fc0df0738319 Mon Sep 17 00:00:00 2001 From: Sylvain Renault Date: Mon, 16 Sep 2024 13:52:42 +0200 Subject: [PATCH] Bug fixed for the issue related to the new response format. Bug fixed for the issue with the header token (added a function in the IHttpInterface). --- Editor/Scripts/Graph/ARFGraphView.cs | 7 +- Editor/Scripts/Windows/GraphEditorWindow.cs | 6 +- Editor/Scripts/Windows/TrackableWindow.cs | 4 +- Editor/Scripts/Windows/WorldAnchorWindow.cs | 4 +- Editor/Scripts/Windows/WorldLinkWindow.cs | 4 +- Editor/Scripts/Windows/WorldStorageWindow.cs | 14 +- Runtime/Scenes/OpenAPITest.cs | 14 +- .../GraphEditor/WorldStorageRequest.cs | 8 +- .../OpenAPI/Generated/WorldStorageOpenAPI.cs | 845 ++++++++++++------ .../OpenAPI/UnityWebRequestHttpClient.cs | 29 +- .../REST/RelocalizationInformationRequest.cs | 28 +- Runtime/Scripts/REST/RequestBase.cs | 57 +- Runtime/Scripts/REST/TrackableRequest.cs | 34 +- Runtime/Scripts/REST/WorldAnchorRequest.cs | 32 +- Runtime/Scripts/REST/WorldLinkRequest.cs | 32 +- 15 files changed, 767 insertions(+), 351 deletions(-) diff --git a/Editor/Scripts/Graph/ARFGraphView.cs b/Editor/Scripts/Graph/ARFGraphView.cs index e81b954..7053c84 100644 --- a/Editor/Scripts/Graph/ARFGraphView.cs +++ b/Editor/Scripts/Graph/ARFGraphView.cs @@ -562,7 +562,7 @@ namespace ETSI.ARF.WorldStorage.UI TrackableRequest.CreateTrackableAsync(worldStorageServer, trackable, (response) => { //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid - String uuid = response.result; + String uuid = response.result.Message; uuid = uuid.Replace("\"", ""); foreach (ARFEdgeLink edge in aRFNodeTrackable.portIn.connections) @@ -592,8 +592,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldAnchorRequest.CreateWorldAnchorAsync(worldStorageServer, worldAnchor, (response) => { - - String uuid = response.result; + String uuid = response.result.Message; //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid uuid = uuid.Replace("\"", ""); foreach (ARFEdgeLink edge in aRFNodeWorldAnchor.portIn.connections) @@ -659,7 +658,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldLink worldLink = aRFEdgeLink.worldLink; WorldLinkRequest.CreateWorldLinkAsync(worldStorageServer, worldLink, (response) => { - string uuid = response.result; + string uuid = response.result.Message; uuid = uuid.Replace("\"", ""); aRFEdgeLink.worldLink.UUID = Guid.Parse(uuid); diff --git a/Editor/Scripts/Windows/GraphEditorWindow.cs b/Editor/Scripts/Windows/GraphEditorWindow.cs index d1d7aaf..33d15ae 100644 --- a/Editor/Scripts/Windows/GraphEditorWindow.cs +++ b/Editor/Scripts/Windows/GraphEditorWindow.cs @@ -524,7 +524,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows WorldAnchorRequest.CreateWorldAnchorAsync(SaveInfo.instance.worldStorageServer, worldAnchor, (response) => { - String uuid = response.result; + String uuid = response.result.Message; //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid uuid = uuid.Replace("\"", ""); @@ -977,7 +977,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows trackable.KeyvalueTags["unityAuthoringPosY"] = posY; TrackableRequest.CreateTrackableAsync(SaveInfo.instance.worldStorageServer, trackable, (response) => { - String uuid = response.result; + String uuid = response.result.Message; //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid uuid = uuid.Replace("\"", ""); @@ -1239,7 +1239,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows { WorldLinkRequest.CreateWorldLinkAsync(SaveInfo.instance.worldStorageServer, worldLink, (response) => { - String uuid = response.result; + String uuid = response.result.Message; //Add the newly saved WorldLink to the SaveInfo singleton uuid = uuid.Replace("\"", ""); diff --git a/Editor/Scripts/Windows/TrackableWindow.cs b/Editor/Scripts/Windows/TrackableWindow.cs index 6360d7a..38b7bf6 100644 --- a/Editor/Scripts/Windows/TrackableWindow.cs +++ b/Editor/Scripts/Windows/TrackableWindow.cs @@ -166,7 +166,7 @@ namespace ETSI.ARF.WorldStorage.UI Trackable obj = GenerateObject(); TrackableRequest.UpdateTrackableAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value if (WorldStorageWindow.WorldStorageWindowSingleton != null) @@ -313,7 +313,7 @@ namespace ETSI.ARF.WorldStorage.UI Trackable obj = GenerateObject(); TrackableRequest.CreateTrackableAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); }); diff --git a/Editor/Scripts/Windows/WorldAnchorWindow.cs b/Editor/Scripts/Windows/WorldAnchorWindow.cs index 2fb8dd0..5e95874 100644 --- a/Editor/Scripts/Windows/WorldAnchorWindow.cs +++ b/Editor/Scripts/Windows/WorldAnchorWindow.cs @@ -163,7 +163,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldAnchor obj = GenerateObject(); WorldAnchorRequest.UpdateWorldAnchorAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value if (WorldStorageWindow.WorldStorageWindowSingleton != null) @@ -291,7 +291,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldAnchor obj = GenerateObject(); WorldAnchorRequest.CreateWorldAnchorAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); }); diff --git a/Editor/Scripts/Windows/WorldLinkWindow.cs b/Editor/Scripts/Windows/WorldLinkWindow.cs index 147417b..0dbb9be 100644 --- a/Editor/Scripts/Windows/WorldLinkWindow.cs +++ b/Editor/Scripts/Windows/WorldLinkWindow.cs @@ -275,7 +275,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldLink obj = GenerateObject(); WorldLinkRequest.UpdateWorldLinkAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value if (WorldStorageWindow.WorldStorageWindowSingleton != null) @@ -469,7 +469,7 @@ namespace ETSI.ARF.WorldStorage.UI WorldLink obj = GenerateObject(); WorldLinkRequest.CreateWorldLinkAsync(worldStorageServer, obj, (response) => { - UUID = response.result; + UUID = response.result.Message; UUID = UUID.Trim('"'); //Bugfix: remove " from server return value WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); }); diff --git a/Editor/Scripts/Windows/WorldStorageWindow.cs b/Editor/Scripts/Windows/WorldStorageWindow.cs index d8d036e..2230159 100644 --- a/Editor/Scripts/Windows/WorldStorageWindow.cs +++ b/Editor/Scripts/Windows/WorldStorageWindow.cs @@ -545,14 +545,16 @@ namespace ETSI.ARF.WorldStorage.UI return text.Split('[', ']')[1]; } } + public void GetCreators() { // Get all objects Debug.Log("Get all creators id"); TrackableRequest.GetTrackablesAsync(worldStorageServer, (response) => { + // Workaround creators.Clear(); - foreach (var item in response.result) + foreach (var item in response.result.Trackables) { if (!creators.Contains(item.CreatorUUID.ToString())) creators.Add(item.CreatorUUID.ToString()); } @@ -585,8 +587,8 @@ namespace ETSI.ARF.WorldStorage.UI repaint = true; TrackableRequest.GetTrackablesAsync(worldStorageServer, (response) => { - Debug.Log("Get objects num = " + response.result.Count); - foreach (var item in response.result) + Debug.Log("Get objects num = " + response.result.Trackables.Count); + foreach (var item in response.result.Trackables) { if (filterByKeyValueTag != "") { @@ -608,7 +610,8 @@ namespace ETSI.ARF.WorldStorage.UI repaint = true; WorldAnchorRequest.GetWorldAnchorsAsync(worldStorageServer, (response) => { - foreach (var item in response.result) + Debug.Log("Get objects num = " + response.result.WorldAnchors.Count); + foreach (var item in response.result.WorldAnchors) { if (filterByKeyValueTag != "") { @@ -630,7 +633,8 @@ namespace ETSI.ARF.WorldStorage.UI repaint = true; WorldLinkRequest.GetWorldLinksAsync(worldStorageServer, (response) => { - foreach (var item in response.result) + Debug.Log("Get objects num = " + response.result.WorldLinks.Count); + foreach (var item in response.result.WorldLinks) { links.Add(item.UUID.ToString()); } diff --git a/Runtime/Scenes/OpenAPITest.cs b/Runtime/Scenes/OpenAPITest.cs index b3fa21c..e4298c6 100644 --- a/Runtime/Scenes/OpenAPITest.cs +++ b/Runtime/Scenes/OpenAPITest.cs @@ -119,7 +119,7 @@ public class OpenAPITest : MonoBehaviour return; } - ResponseObject> token = TrackableRequest.GetTrackablesAsync(server, (response) => + ResponseObject token = TrackableRequest.GetTrackablesAsync(server, (response) => { handleResponseQ.Enqueue(response); }); @@ -136,9 +136,9 @@ public class OpenAPITest : MonoBehaviour Trackable tr = new Trackable(DateTime.Now.ToFileTime().ToString()); tr.TrackableType = TrackableType.OTHER; - ResponseObject token = TrackableRequest.CreateTrackableAsync(server, tr, (response) => + ResponseObject token = TrackableRequest.CreateTrackableAsync(server, tr, (response) => { - lastUUID = Guid.Parse(response.result); + lastUUID = Guid.Parse(response.result.Message); handleResponseQ.Enqueue(response); }); lastUUID = Guid.Empty; @@ -161,9 +161,9 @@ public class OpenAPITest : MonoBehaviour ResponseObject token = TrackableRequest.GetTrackableAsync(server, lastUUID, (response) => { response.result.Name += "'"; - ResponseObject token = TrackableRequest.UpdateTrackableAsync(server, response.result, (response) => + ResponseObject token = TrackableRequest.UpdateTrackableAsync(server, response.result, (response) => { - handleResponseQ.Enqueue(response); + handleResponseQ.Enqueue(response.result.Message); }); }); } @@ -182,9 +182,9 @@ public class OpenAPITest : MonoBehaviour return; } - ResponseObject token = TrackableRequest.DeleteTrackableAsync(server, lastUUID, (response) => + ResponseObject token = TrackableRequest.DeleteTrackableAsync(server, lastUUID, (response) => { - handleResponseQ.Enqueue(response); + handleResponseQ.Enqueue(response.result.Message); lastUUID = Guid.Empty; }); } diff --git a/Runtime/Scripts/GraphEditor/WorldStorageRequest.cs b/Runtime/Scripts/GraphEditor/WorldStorageRequest.cs index a770667..4b6999f 100644 --- a/Runtime/Scripts/GraphEditor/WorldStorageRequest.cs +++ b/Runtime/Scripts/GraphEditor/WorldStorageRequest.cs @@ -124,17 +124,17 @@ namespace ETSI.ARF.WorldStorage //public Task GetNumOfAssets() => apiClient.NumOfAssetsAsync(); //public bool IsAssetExists(Guid id) => apiClient.IsAssetId(id); - public ResponseObject AddTrackableAsync(Action> func, Trackable trackable) + public ResponseObject AddTrackableAsync(Action> func, Trackable trackable) { return TrackableRequest.CreateTrackableAsync(wsServer, trackable, func); } - public ResponseObject DeleteTrackableAsync(Action> func, Guid id) + public ResponseObject DeleteTrackableAsync(Action> func, Guid id) { return TrackableRequest.DeleteTrackableAsync(wsServer, id, func); } - public ResponseObject ModifyTrackableAsync(Action> func, Trackable trackable) + public ResponseObject ModifyTrackableAsync(Action> func, Trackable trackable) { return TrackableRequest.UpdateTrackableAsync(wsServer, trackable, func); } @@ -144,7 +144,7 @@ namespace ETSI.ARF.WorldStorage return TrackableRequest.GetTrackableAsync(wsServer, id, func); } - public ResponseObject> GetTrackableListAsync(Action>> func, int? max = 1) + public ResponseObject GetTrackableListAsync(Action> func, int? max = 1) { return TrackableRequest.GetTrackablesAsync(wsServer, func); } diff --git a/Runtime/Scripts/OpenAPI/Generated/WorldStorageOpenAPI.cs b/Runtime/Scripts/OpenAPI/Generated/WorldStorageOpenAPI.cs index ba07b09..df77043 100644 --- a/Runtime/Scripts/OpenAPI/Generated/WorldStorageOpenAPI.cs +++ b/Runtime/Scripts/OpenAPI/Generated/WorldStorageOpenAPI.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //---------------------- @@ -8,6 +8,7 @@ #pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." #pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' #pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" #pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... #pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." #pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" @@ -15,23 +16,25 @@ #pragma warning disable 8603 // Disable "CS8603 Possible null reference return" #pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" #pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." namespace ETSI.ARF.OpenAPI.WorldStorage { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WorldStorageClient { private ETSI.ARF.OpenAPI.WorldStorage.IHttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private Newtonsoft.Json.JsonSerializerSettings _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public WorldStorageClient(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient httpClient) #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { _httpClient = httpClient; + Initialize(); } private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() @@ -41,10 +44,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage return settings; } - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + partial void Initialize(); + partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpResponseMessage response); @@ -329,7 +334,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// the list of all trackables and his encoding structure associated representing the supported data of the User /// Successful operation. /// A server side error occurred. - public virtual System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities) + public virtual System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities) { return GetRelocalizationInformationAsync(token, uuids, capabilities, System.Threading.CancellationToken.None); } @@ -341,7 +346,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// the list of all trackables and his encoding structure associated representing the supported data of the User /// Successful operation. /// A server side error occurred. - public virtual Response GetRelocalizationInformation(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities) + public virtual RelocalizationInformations GetRelocalizationInformation(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities) { return System.Threading.Tasks.Task.Run(async () => await GetRelocalizationInformationAsync(token, uuids, capabilities, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -354,7 +359,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// the list of all trackables and his encoding structure associated representing the supported data of the User /// Successful operation. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities, System.Threading.CancellationToken cancellationToken) { if (uuids == null) throw new System.ArgumentNullException("uuids"); @@ -408,7 +413,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -418,16 +423,32 @@ namespace ETSI.ARF.OpenAPI.WorldStorage else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -462,7 +483,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// The Trackable to be added to the world storage. /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task AddTrackableAsync(string token, Trackable body) + public virtual System.Threading.Tasks.Task AddTrackableAsync(string token, Trackable body) { return AddTrackableAsync(token, body, System.Threading.CancellationToken.None); } @@ -476,7 +497,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// The Trackable to be added to the world storage. /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string AddTrackable(string token, Trackable body) + public virtual Success AddTrackable(string token, Trackable body) { return System.Threading.Tasks.Task.Run(async () => await AddTrackableAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -491,7 +512,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// The Trackable to be added to the world storage. /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AddTrackableAsync(string token, Trackable body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task AddTrackableAsync(string token, Trackable body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -505,12 +526,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -542,30 +563,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 400) + if (status_ == 409) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID, id must be a Nil value.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 409) + if (status_ == 511) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID, id must be a Nil value.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -598,9 +631,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing Trackable given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The Trackable to be modified in the world storage. - /// OK, return the UUID of the modified Trackable. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task ModifyTrackableAsync(string token, Trackable body) + public virtual System.Threading.Tasks.Task ModifyTrackableAsync(string token, Trackable body) { return ModifyTrackableAsync(token, body, System.Threading.CancellationToken.None); } @@ -612,9 +645,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing Trackable given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The Trackable to be modified in the world storage. - /// OK, return the UUID of the modified Trackable. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string ModifyTrackable(string token, Trackable body) + public virtual Success ModifyTrackable(string token, Trackable body) { return System.Threading.Tasks.Task.Run(async () => await ModifyTrackableAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -627,9 +660,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing Trackable given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The Trackable to be modified in the world storage. - /// OK, return the UUID of the modified Trackable. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ModifyTrackableAsync(string token, Trackable body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task ModifyTrackableAsync(string token, Trackable body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -643,12 +676,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -680,23 +713,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -730,7 +782,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the Trackables defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task> GetTrackablesAsync(string token) + public virtual System.Threading.Tasks.Task GetTrackablesAsync(string token) { return GetTrackablesAsync(token, System.Threading.CancellationToken.None); } @@ -743,7 +795,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the Trackables defined by the world storage. /// A server side error occurred. - public virtual System.Collections.Generic.List GetTrackables(string token) + public virtual TrackablesResponse GetTrackables(string token) { return System.Threading.Tasks.Task.Run(async () => await GetTrackablesAsync(token, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -757,7 +809,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the Trackables defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> GetTrackablesAsync(string token, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task GetTrackablesAsync(string token, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -801,7 +853,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -809,11 +861,24 @@ namespace ETSI.ARF.OpenAPI.WorldStorage return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 401) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Null response.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -935,16 +1000,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -973,9 +1064,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single Trackable stored in the world storage from its ID. /// /// Trackable UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual System.Threading.Tasks.Task DeleteTrackableAsync(string token, System.Guid trackableUUID) + public virtual System.Threading.Tasks.Task DeleteTrackableAsync(string token, System.Guid trackableUUID) { return DeleteTrackableAsync(token, trackableUUID, System.Threading.CancellationToken.None); } @@ -987,9 +1078,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single Trackable stored in the world storage from its ID. /// /// Trackable UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual string DeleteTrackable(string token, System.Guid trackableUUID) + public virtual Success DeleteTrackable(string token, System.Guid trackableUUID) { return System.Threading.Tasks.Task.Run(async () => await DeleteTrackableAsync(token, trackableUUID, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1002,9 +1093,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single Trackable stored in the world storage from its ID. /// /// Trackable UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task DeleteTrackableAsync(string token, System.Guid trackableUUID, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task DeleteTrackableAsync(string token, System.Guid trackableUUID, System.Threading.CancellationToken cancellationToken) { if (trackableUUID == null) throw new System.ArgumentNullException("trackableUUID"); @@ -1019,7 +1110,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("DELETE"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1052,23 +1143,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1097,9 +1207,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Anchor from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Anchor. /// /// The World Anchor to be added to the world storage. - /// OK, return the UUID of the World Anchor defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task AddWorldAnchorAsync(string token, WorldAnchor body) + public virtual System.Threading.Tasks.Task AddWorldAnchorAsync(string token, WorldAnchor body) { return AddWorldAnchorAsync(token, body, System.Threading.CancellationToken.None); } @@ -1111,9 +1221,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Anchor from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Anchor. /// /// The World Anchor to be added to the world storage. - /// OK, return the UUID of the World Anchor defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string AddWorldAnchor(string token, WorldAnchor body) + public virtual Success AddWorldAnchor(string token, WorldAnchor body) { return System.Threading.Tasks.Task.Run(async () => await AddWorldAnchorAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1126,9 +1236,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Anchor from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Anchor. /// /// The World Anchor to be added to the world storage. - /// OK, return the UUID of the World Anchor defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AddWorldAnchorAsync(string token, WorldAnchor body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task AddWorldAnchorAsync(string token, WorldAnchor body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -1142,12 +1252,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1179,30 +1289,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 400) + if (status_ == 409) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID, id must be a Nil value.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 409) + if (status_ == 511) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID, id must be a Nil value.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1235,9 +1357,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Anchor given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Anchor to be modified in the world storage. - /// OK, return the UUID of the modified World Anchor. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task ModifyWorldAnchorAsync(string token, WorldAnchor body) + public virtual System.Threading.Tasks.Task ModifyWorldAnchorAsync(string token, WorldAnchor body) { return ModifyWorldAnchorAsync(token, body, System.Threading.CancellationToken.None); } @@ -1249,9 +1371,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Anchor given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Anchor to be modified in the world storage. - /// OK, return the UUID of the modified World Anchor. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string ModifyWorldAnchor(string token, WorldAnchor body) + public virtual Success ModifyWorldAnchor(string token, WorldAnchor body) { return System.Threading.Tasks.Task.Run(async () => await ModifyWorldAnchorAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1264,9 +1386,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Anchor given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Anchor to be modified in the world storage. - /// OK, return the UUID of the modified World Anchor. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ModifyWorldAnchorAsync(string token, WorldAnchor body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task ModifyWorldAnchorAsync(string token, WorldAnchor body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -1280,12 +1402,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1317,23 +1439,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1367,7 +1508,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the World Anchors defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task> GetWorldAnchorsAsync(string token) + public virtual System.Threading.Tasks.Task GetWorldAnchorsAsync(string token) { return GetWorldAnchorsAsync(token, System.Threading.CancellationToken.None); } @@ -1380,7 +1521,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the World Anchors defined by the world storage. /// A server side error occurred. - public virtual System.Collections.Generic.List GetWorldAnchors(string token) + public virtual WorldAnchorsResponse GetWorldAnchors(string token) { return System.Threading.Tasks.Task.Run(async () => await GetWorldAnchorsAsync(token, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1394,7 +1535,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK, return all the World Anchors defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> GetWorldAnchorsAsync(string token, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task GetWorldAnchorsAsync(string token, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -1438,7 +1579,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1446,24 +1587,37 @@ namespace ETSI.ARF.OpenAPI.WorldStorage return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 401) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Null response.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else + if (status_ == 511) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } - throw new ApiException("Unexpected error.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } - } - finally - { + else + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Unexpected error.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + } + finally + { if (disposeResponse_) response_.Dispose(); } @@ -1572,16 +1726,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1610,9 +1790,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Anchor stored in the world storage from its ID. /// /// World Anchor UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual System.Threading.Tasks.Task DeleteWorldAnchorAsync(string token, System.Guid worldAnchorUUID) + public virtual System.Threading.Tasks.Task DeleteWorldAnchorAsync(string token, System.Guid worldAnchorUUID) { return DeleteWorldAnchorAsync(token, worldAnchorUUID, System.Threading.CancellationToken.None); } @@ -1624,9 +1804,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Anchor stored in the world storage from its ID. /// /// World Anchor UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual string DeleteWorldAnchor(string token, System.Guid worldAnchorUUID) + public virtual Success DeleteWorldAnchor(string token, System.Guid worldAnchorUUID) { return System.Threading.Tasks.Task.Run(async () => await DeleteWorldAnchorAsync(token, worldAnchorUUID, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1639,9 +1819,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Anchor stored in the world storage from its ID. /// /// World Anchor UUID to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task DeleteWorldAnchorAsync(string token, System.Guid worldAnchorUUID, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task DeleteWorldAnchorAsync(string token, System.Guid worldAnchorUUID, System.Threading.CancellationToken cancellationToken) { if (worldAnchorUUID == null) throw new System.ArgumentNullException("worldAnchorUUID"); @@ -1656,7 +1836,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("DELETE"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1689,23 +1869,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1734,9 +1933,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Link from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Link. /// /// The link to be added to the world storage. - /// OK, return the UUID of the World Link defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task AddWorldLinkAsync(string token, WorldLink body) + public virtual System.Threading.Tasks.Task AddWorldLinkAsync(string token, WorldLink body) { return AddWorldLinkAsync(token, body, System.Threading.CancellationToken.None); } @@ -1748,9 +1947,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Link from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Link. /// /// The link to be added to the world storage. - /// OK, return the UUID of the World Link defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string AddWorldLink(string token, WorldLink body) + public virtual Success AddWorldLink(string token, WorldLink body) { return System.Threading.Tasks.Task.Run(async () => await AddWorldLinkAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1763,9 +1962,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Create a new World Link from a json object containing all the required information and add it to the world storage. <br>As a result you will get the ID of the newly created World Link. /// /// The link to be added to the world storage. - /// OK, return the UUID of the World Link defined by the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AddWorldLinkAsync(string token, WorldLink body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task AddWorldLinkAsync(string token, WorldLink body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -1779,12 +1978,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1816,30 +2015,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 400) + if (status_ == 409) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID, id must be a Nil value.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else - if (status_ == 409) + if (status_ == 511) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID, id must be a Nil value.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -1872,9 +2083,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Link given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Link to be modified in the world storage. - /// OK, return the UUID of the modified World Link. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task ModifyWorldLinkAsync(string token, WorldLink body) + public virtual System.Threading.Tasks.Task ModifyWorldLinkAsync(string token, WorldLink body) { return ModifyWorldLinkAsync(token, body, System.Threading.CancellationToken.None); } @@ -1886,9 +2097,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Link given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Link to be modified in the world storage. - /// OK, return the UUID of the modified World Link. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual string ModifyWorldLink(string token, WorldLink body) + public virtual Success ModifyWorldLink(string token, WorldLink body) { return System.Threading.Tasks.Task.Run(async () => await ModifyWorldLinkAsync(token, body, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -1901,9 +2112,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Modify an existing World Link given a json object containing all the required information. <br> **Please note that ID of the object is required in the JSON** /// /// The World Link to be modified in the world storage. - /// OK, return the UUID of the modified World Link. + /// OK, return the UUID of the Trackable defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ModifyWorldLinkAsync(string token, WorldLink body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task ModifyWorldLinkAsync(string token, WorldLink body, System.Threading.CancellationToken cancellationToken) { if (body == null) throw new System.ArgumentNullException("body"); @@ -1917,12 +2128,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -1954,23 +2165,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Bad request.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad request.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -2004,7 +2234,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK return all the World Links defined by the world storage. /// A server side error occurred. - public virtual System.Threading.Tasks.Task> GetWorldLinksAsync(string token) + public virtual System.Threading.Tasks.Task GetWorldLinksAsync(string token) { return GetWorldLinksAsync(token, System.Threading.CancellationToken.None); } @@ -2017,7 +2247,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK return all the World Links defined by the world storage. /// A server side error occurred. - public virtual System.Collections.Generic.List GetWorldLinks(string token) + public virtual WorldLinksResponse GetWorldLinks(string token) { return System.Threading.Tasks.Task.Run(async () => await GetWorldLinksAsync(token, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -2031,7 +2261,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// OK return all the World Links defined by the world storage. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> GetWorldLinksAsync(string token, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task GetWorldLinksAsync(string token, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -2075,7 +2305,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2083,11 +2313,24 @@ namespace ETSI.ARF.OpenAPI.WorldStorage return objectResponse_.Object; } else - if (status_ == 201) + if (status_ == 401) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Null response.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -2209,16 +2452,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Null response.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 511) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("The secret token is not valid. Please ask an ISG ARF team member for a valid token.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -2247,9 +2516,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Link stored in the world storage from its ID. /// /// World Link id to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual System.Threading.Tasks.Task DeleteWorldLinkAsync(string token, System.Guid worldLinkUUID) + public virtual System.Threading.Tasks.Task DeleteWorldLinkAsync(string token, System.Guid worldLinkUUID) { return DeleteWorldLinkAsync(token, worldLinkUUID, System.Threading.CancellationToken.None); } @@ -2261,9 +2530,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Link stored in the world storage from its ID. /// /// World Link id to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual string DeleteWorldLink(string token, System.Guid worldLinkUUID) + public virtual Success DeleteWorldLink(string token, System.Guid worldLinkUUID) { return System.Threading.Tasks.Task.Run(async () => await DeleteWorldLinkAsync(token, worldLinkUUID, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); } @@ -2276,9 +2545,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// Delete a single World Link stored in the world storage from its ID. /// /// World Link id to delete. - /// OK, delete successful. + /// Success request. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task DeleteWorldLinkAsync(string token, System.Guid worldLinkUUID, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task DeleteWorldLinkAsync(string token, System.Guid worldLinkUUID, System.Threading.CancellationToken cancellationToken) { if (worldLinkUUID == null) throw new System.ArgumentNullException("worldLinkUUID"); @@ -2293,7 +2562,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage if (token != null) request_.Headers.TryAddWithoutValidation("token", ConvertToString(token, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("DELETE"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -2326,23 +2595,32 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - return result_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Invalid UUID supplied.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); - throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Not found, could not find UUID in database.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -2479,7 +2757,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An element representing all information needed in relation with a Trackable or a WorldAnchor. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class RelocalizationInformation { /// @@ -2512,7 +2790,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An element representing a Trackable object in the real world. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Trackable { /// @@ -2576,7 +2854,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An element describing a pose in the world graph. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WorldAnchor { /// @@ -2624,7 +2902,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An object holding the info of a transform between two elements. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WorldLink { /// @@ -2683,7 +2961,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// List of additional parameters to be stored with the object. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class KeyvalueTagList : System.Collections.Generic.Dictionary> { @@ -2692,7 +2970,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An object representing a supported capability of the World Analysis and its associated metadata /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Capability { [Newtonsoft.Json.JsonProperty("trackableType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -2734,7 +3012,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// An object holding the info of a Trackable`'`s encoding information `:` the data format and the version. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class EncodingInformationStructure { /// @@ -2761,13 +3039,10 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Error { - [Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Always)] - public int Code { get; set; } - - [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Message { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -2784,7 +3059,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// Mode representing the context of the relocalization information (AR device to WorldAnchor/Trackable or WorldAnchor/Trackable to AR device) /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public enum Mode_WorldStorage { @@ -2799,16 +3074,33 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// Size object in format {width, length, depth}. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Size : System.Collections.ObjectModel.Collection { } + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Success + { + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Message { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + /// /// Type for trackable /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public enum TrackableType { @@ -2835,7 +3127,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// Coordinate reference system of the world anchor, a 4*4 matrix (rowmajor) represented by a float vector. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Transform3D : System.Collections.ObjectModel.Collection { @@ -2844,7 +3136,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// Trackable or Anchor /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public enum TypeWorldStorage { @@ -2862,7 +3154,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// Unit of length. /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public enum UnitSystem { @@ -2901,8 +3193,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Anonymous + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UuidAndMode { [Newtonsoft.Json.JsonProperty("uuid", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Guid Uuid { get; set; } @@ -2922,8 +3214,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RelocalizationInformations { [Newtonsoft.Json.JsonProperty("RelocInfo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection RelocInfo { get; set; } @@ -2939,7 +3231,58 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TrackablesResponse + { + [Newtonsoft.Json.JsonProperty("trackables", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Trackables { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorldAnchorsResponse + { + [Newtonsoft.Json.JsonProperty("worldAnchors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection WorldAnchors { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class WorldLinksResponse + { + [Newtonsoft.Json.JsonProperty("worldLinks", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection WorldLinks { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class RelocObjects { [Newtonsoft.Json.JsonProperty("trackable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -2963,7 +3306,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public enum EncodingInformationStructureDataFormat { @@ -2989,7 +3332,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ApiException : System.Exception { public int StatusCode { get; private set; } @@ -3012,7 +3355,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ApiException : ApiException { public TResult Result { get; private set; } diff --git a/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs b/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs index a119a03..43fd7f0 100644 --- a/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs +++ b/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: June 2024 +// Last change: September 2024 // // Depends on UniTask to support cancellation token and GetAwaiter: https://github.com/Cysharp/UniTask @@ -55,10 +55,10 @@ namespace ETSI.ARF.OpenAPI.WorldStorage public BasicHTTPClient(string baseUri) { BaseAddress = new Uri(baseUri); - _httpClient.BaseAddress = BaseAddress; + _httpClient.BaseAddress = BaseAddress; } - public BasicHTTPClient (Uri baseUri) + public BasicHTTPClient(Uri baseUri) { BaseAddress = baseUri; _httpClient.BaseAddress = BaseAddress; @@ -71,10 +71,10 @@ namespace ETSI.ARF.OpenAPI.WorldStorage public async Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, CancellationToken token) { - return await _httpClient.SendAsync(message, option, token); + return await _httpClient.SendAsync(message, option, token); } - public void Dispose() + public void Dispose() { _httpClient.Dispose(); DefaultRequestHeaders.Clear(); @@ -101,6 +101,21 @@ namespace ETSI.ARF.OpenAPI.WorldStorage private readonly HttpClient _httpClient = new HttpClient(); + private void AppendARFHeaders(HttpRequestMessage message, UnityWebRequest webRequest) + { + // Add some ARF headers + foreach (var item in message.Headers) + { + try + { + List li = item.Value as List; + if (item.Key == "token") webRequest.SetRequestHeader(item.Key, li[0].ToString()); // add it + if (item.Key == "sessionID") webRequest.SetRequestHeader(item.Key, li[0].ToString()); // add it + } + catch { } // ignore it + } + } + public async Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, CancellationToken token) { var content = await (message.Content?.ReadAsStringAsync() ?? Task.FromResult("")); @@ -108,6 +123,9 @@ namespace ETSI.ARF.OpenAPI.WorldStorage AppendHeaders(webRequest); + // Add the ARF API headers + AppendARFHeaders(message, webRequest); + Debug.Log("[HTTP] Request " + webRequest.uri.ToString()); try { @@ -178,6 +196,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var (key, value) = enumerator.Current; webRequest.SetRequestHeader(key, value.First()); } + } private HttpResponseMessage CreateHttpResponseMessage(UnityWebRequest webRequest) diff --git a/Runtime/Scripts/REST/RelocalizationInformationRequest.cs b/Runtime/Scripts/REST/RelocalizationInformationRequest.cs index 5223399..1113d6a 100644 --- a/Runtime/Scripts/REST/RelocalizationInformationRequest.cs +++ b/Runtime/Scripts/REST/RelocalizationInformationRequest.cs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: May 2024 +// Last change: September 2024 // using System; using System.Collections.Generic; @@ -25,53 +25,53 @@ using Newtonsoft.Json; namespace ETSI.ARF.WorldStorage.REST { - public class RelocalizationInformationRequest : RequestBase + public class RelocalizationInformationRequest : RequestBase { - static public ResponseObject GetRelocalizationInformationAsync(WorldStorageServer ws, List uuids, List modes, List capabilities, Action> func) + static public ResponseObject GetRelocalizationInformationAsync(WorldStorageServer ws, List uuids, List modes, List capabilities, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new MyWorldStorageClient(httpClient); - ResponseObject ro = new ResponseObject("Request Reloc Information ", func); + ResponseObject ro = new ResponseObject("Request Reloc Information ", func); - List anonymous = new List(); + List anonymous = new List(); for (int i = 0; i< uuids.Count; i++) { // Check same size or give anonymous as parameter? - Anonymous newOne = new Anonymous(); + UuidAndMode newOne = new UuidAndMode(); newOne.Uuid = uuids[i]; newOne.Mode = modes[i]; anonymous.Add(newOne); } - apiClient.GetRelocalizationInformationAsync(token, anonymous, capabilities, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + apiClient.GetRelocalizationInformationAsync(token, anonymous, capabilities, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } - static public Response GetRelocalizationInformation(WorldStorageServer ws, List uuids, List modes, List capabilities) + static public RelocalizationInformations GetRelocalizationInformation(WorldStorageServer ws, List uuids, List modes, List capabilities) { return GetRelocalizationInformationSync(ws, uuids, modes, capabilities); } - static public Response GetRelocalizationInformationSync(WorldStorageServer ws, List uuids, List modes, List capabilities) + static public RelocalizationInformations GetRelocalizationInformationSync(WorldStorageServer ws, List uuids, List modes, List capabilities) { wsServer = ws; var httpClient = new BasicHTTPClient(ws.URI); apiClient = new MyWorldStorageClient(httpClient); - List anonymous = new List(); + List anonymous = new List(); for (int i = 0; i < uuids.Count; i++) { // Check same size or give anonymous as parameter? - Anonymous newOne = new Anonymous(); + UuidAndMode newOne = new UuidAndMode(); newOne.Uuid = uuids[i]; newOne.Mode = modes[i]; anonymous.Add(newOne); } - Response ro = apiClient.GetRelocalizationInformation(token, anonymous, capabilities); + RelocalizationInformations ro = apiClient.GetRelocalizationInformation(token, anonymous, capabilities); return ro; } } @@ -125,7 +125,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage /// /// /// - public override async System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities, System.Threading.CancellationToken cancellationToken) + public override async System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities, System.Threading.CancellationToken cancellationToken) { if (uuids == null) throw new System.ArgumentNullException("uuids"); @@ -178,7 +178,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); diff --git a/Runtime/Scripts/REST/RequestBase.cs b/Runtime/Scripts/REST/RequestBase.cs index 776541f..8a369f5 100644 --- a/Runtime/Scripts/REST/RequestBase.cs +++ b/Runtime/Scripts/REST/RequestBase.cs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: March 2024 +// Last change: September 2024 // using System; @@ -33,7 +33,7 @@ namespace ETSI.ARF.WorldStorage.REST static protected WorldStorageServer wsServer; static protected WorldStorageClient apiClient; - static protected string token = "ARF_Permission"; + static protected string token = "dev"; // only for development // Cache the current list static public Dictionary listOfObjects = new Dictionary(); @@ -56,7 +56,58 @@ namespace ETSI.ARF.WorldStorage.REST else Debug.Log("[REST] OpenAPI Timeout!"); } - static protected void OnReceiveListOfObjects(Task> t, object id) where TObj : IModel + static protected void OnReceiveListOfObjects(Task t, object id) // where TObj : IModel + { + if (t.IsCompleted) + { + ResponseObject o = (ResponseObject)id; + o.responseTime = DateTime.Now; + o.result = t.Result; + Debug.Log($"[REST] " + o.result.GetType()); + + // Adapation for new API, SylR + int cnt = 0; + + // Remember the new list + listOfObjects.Clear(); + + // Get the new list + if (o.result.GetType() == typeof(TrackablesResponse)) + { + Debug.Log($"[REST] TR"); + TrackablesResponse res = o.result as TrackablesResponse; + foreach (var item in res.Trackables) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + else if (o.GetType() == typeof(WorldAnchorsResponse)) + { + WorldAnchorsResponse res = o as WorldAnchorsResponse; + foreach (var item in res.WorldAnchors) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + else if (o.GetType() == typeof(WorldLinksResponse)) + { + WorldLinksResponse res = o as WorldLinksResponse; + foreach (var item in res.WorldLinks) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + + Debug.Log($"[REST] Server Response = Got {cnt} entrie(s) (ID={o.transactionId}, Msg={o.message})"); + o.callback?.Invoke(o); + } + else Debug.Log("[REST] OpenAPI Timeout!"); + } + + static protected void old_OnReceiveListOfObjects(Task> t, object id) where TObj : IModel { if (t.IsCompleted) { diff --git a/Runtime/Scripts/REST/TrackableRequest.cs b/Runtime/Scripts/REST/TrackableRequest.cs index 9aa9adf..ec208b3 100644 --- a/Runtime/Scripts/REST/TrackableRequest.cs +++ b/Runtime/Scripts/REST/TrackableRequest.cs @@ -60,20 +60,20 @@ namespace ETSI.ARF.WorldStorage.REST wsServer = ws; var httpClient = new BasicHTTPClient(ws.URI); apiClient = new WorldStorageClient(httpClient); - + Debug.Log("[REST] Request Trackables..."); - return apiClient.GetTrackables(token); + return apiClient.GetTrackables(token).Trackables as List; } - static public ResponseObject> GetTrackablesAsync(WorldStorageServer ws, Action>> func) + static public ResponseObject GetTrackablesAsync(WorldStorageServer ws, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request Trackables..."); - ResponseObject> ro = new ResponseObject>("Request Trackables", func); - apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); + ResponseObject ro = new ResponseObject("Request Trackables", func); + apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); return ro; } @@ -88,10 +88,10 @@ namespace ETSI.ARF.WorldStorage.REST if (trackable.CreatorUUID == Guid.Empty) trackable.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013"); Debug.Log($"[REST] Create Trackable {trackable.UUID}..."); - return apiClient.AddTrackable(token, trackable); + return apiClient.AddTrackable(token, trackable).Message; } - static public ResponseObject CreateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action> func) + static public ResponseObject CreateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); @@ -103,8 +103,8 @@ namespace ETSI.ARF.WorldStorage.REST Debug.Log($"[REST] Create Trackable {trackable.UUID}..."); - ResponseObject ro = new ResponseObject("Create Trackable " + trackable.Name + " (no UUID)", func); - apiClient.AddTrackableAsync(token, trackable, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Create Trackable " + trackable.Name + " (no UUID)", func); + apiClient.AddTrackableAsync(token, trackable, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -115,18 +115,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update Trackable {trackable.UUID}..."); - return apiClient.ModifyTrackable(token, trackable); + return apiClient.ModifyTrackable(token, trackable).Message; } - static public ResponseObject UpdateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action> func) + static public ResponseObject UpdateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update Trackable {trackable.UUID}..."); - ResponseObject ro = new ResponseObject("Update Trackable " + trackable.UUID.ToString(), func); - apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Update Trackable " + trackable.UUID.ToString(), func); + apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -137,18 +137,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete Trackable {UUID}..."); - return apiClient.DeleteTrackable(token, UUID); + return apiClient.DeleteTrackable(token, UUID).Message; } - static public ResponseObject DeleteTrackableAsync(WorldStorageServer ws, Guid UUID, Action> func) + static public ResponseObject DeleteTrackableAsync(WorldStorageServer ws, Guid UUID, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete Trackable {UUID}..."); - ResponseObject ro = new ResponseObject("Delete Trackable " + UUID.ToString(), func); - apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Delete Trackable " + UUID.ToString(), func); + apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } } diff --git a/Runtime/Scripts/REST/WorldAnchorRequest.cs b/Runtime/Scripts/REST/WorldAnchorRequest.cs index d6b2c95..07495de 100644 --- a/Runtime/Scripts/REST/WorldAnchorRequest.cs +++ b/Runtime/Scripts/REST/WorldAnchorRequest.cs @@ -63,18 +63,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldAnchors..."); - return apiClient.GetWorldAnchors(token); + return apiClient.GetWorldAnchors(token).WorldAnchors as List; } - static public ResponseObject> GetWorldAnchorsAsync(WorldStorageServer ws, Action>> func) + static public ResponseObject GetWorldAnchorsAsync(WorldStorageServer ws, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldAnchors..."); - ResponseObject> ro = new ResponseObject>("Request WorldAnchors", func); - apiClient.GetWorldAnchorsAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); + ResponseObject ro = new ResponseObject("Request WorldAnchors", func); + apiClient.GetWorldAnchorsAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); return ro; } @@ -89,10 +89,10 @@ namespace ETSI.ARF.WorldStorage.REST if (worldAnchor.CreatorUUID == Guid.Empty) worldAnchor.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013"); Debug.Log($"[REST] Create WorldAnchor {worldAnchor.UUID}..."); - return apiClient.AddWorldAnchor(token, worldAnchor); + return apiClient.AddWorldAnchor(token, worldAnchor).Message; } - static public ResponseObject CreateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action> func) + static public ResponseObject CreateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); @@ -103,8 +103,8 @@ namespace ETSI.ARF.WorldStorage.REST if (worldAnchor.CreatorUUID == Guid.Empty) worldAnchor.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013"); Debug.Log($"[REST] Create WorldAnchor {worldAnchor.UUID}..."); - ResponseObject ro = new ResponseObject("Create WorldAnchor " + worldAnchor.Name + " (no UUID)", func); - apiClient.AddWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Create WorldAnchor " + worldAnchor.Name + " (no UUID)", func); + apiClient.AddWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -115,18 +115,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update WorldAnchor {worldAnchor.UUID}..."); - return apiClient.ModifyWorldAnchor(token, worldAnchor); + return apiClient.ModifyWorldAnchor(token, worldAnchor).Message; } - static public ResponseObject UpdateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action> func) + static public ResponseObject UpdateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update WorldAnchor {worldAnchor.UUID}..."); - ResponseObject ro = new ResponseObject("Update WorldAnchor " + worldAnchor.UUID.ToString(), func); - apiClient.ModifyWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Update WorldAnchor " + worldAnchor.UUID.ToString(), func); + apiClient.ModifyWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -137,18 +137,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete WorldAnchor {UUID}..."); - return apiClient.DeleteWorldAnchor(token, UUID); + return apiClient.DeleteWorldAnchor(token, UUID).Message; } - static public ResponseObject DeleteWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action> func) + static public ResponseObject DeleteWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete WorldAnchor {UUID}..."); - ResponseObject ro = new ResponseObject("Delete WorldAnchor " + UUID.ToString(), func); - apiClient.DeleteWorldAnchorAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Delete WorldAnchor " + UUID.ToString(), func); + apiClient.DeleteWorldAnchorAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } } diff --git a/Runtime/Scripts/REST/WorldLinkRequest.cs b/Runtime/Scripts/REST/WorldLinkRequest.cs index 44b489f..d38e1d5 100644 --- a/Runtime/Scripts/REST/WorldLinkRequest.cs +++ b/Runtime/Scripts/REST/WorldLinkRequest.cs @@ -62,18 +62,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldLinks..."); - return apiClient.GetWorldLinks(token); + return apiClient.GetWorldLinks(token).WorldLinks as List; } - static public ResponseObject> GetWorldLinksAsync(WorldStorageServer ws, Action>> func) + static public ResponseObject GetWorldLinksAsync(WorldStorageServer ws, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log("[REST] Request WorldLinks..."); - ResponseObject> ro = new ResponseObject>("Request WorldLinks", func); - apiClient.GetWorldLinksAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); + ResponseObject ro = new ResponseObject("Request WorldLinks", func); + apiClient.GetWorldLinksAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects, ro); return ro; } @@ -88,10 +88,10 @@ namespace ETSI.ARF.WorldStorage.REST if (worldLink.CreatorUUID == Guid.Empty) worldLink.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013"); Debug.Log($"[REST] Create WorldLink {worldLink.UUID}..."); - return apiClient.AddWorldLink(token, worldLink); + return apiClient.AddWorldLink(token, worldLink).Message; } - static public ResponseObject CreateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action> func) + static public ResponseObject CreateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); @@ -102,8 +102,8 @@ namespace ETSI.ARF.WorldStorage.REST if (worldLink.CreatorUUID == Guid.Empty) worldLink.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013"); Debug.Log($"[REST] Create WorldLink {worldLink.UUID}..."); - ResponseObject ro = new ResponseObject("Create WorldLink (no UUID)", func); - apiClient.AddWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Create WorldLink (no UUID)", func); + apiClient.AddWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -114,18 +114,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update WorldLink {worldLink.UUID}..."); - return apiClient.ModifyWorldLink(token, worldLink); + return apiClient.ModifyWorldLink(token, worldLink).Message; } - static public ResponseObject UpdateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action> func) + static public ResponseObject UpdateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Update WorldLink {worldLink.UUID}..."); - ResponseObject ro = new ResponseObject("Update WorldLink " + worldLink.UUID.ToString(), func); - apiClient.ModifyWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Update WorldLink " + worldLink.UUID.ToString(), func); + apiClient.ModifyWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } @@ -136,18 +136,18 @@ namespace ETSI.ARF.WorldStorage.REST apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete WorldLink {UUID}..."); - return apiClient.DeleteWorldLink(token, UUID); + return apiClient.DeleteWorldLink(token, UUID).Message; } - static public ResponseObject DeleteWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action> func) + static public ResponseObject DeleteWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action> func) { wsServer = ws; var httpClient = new UnityWebRequestHttpClient(ws.URI); apiClient = new WorldStorageClient(httpClient); Debug.Log($"[REST] Delete WorldLink {UUID}..."); - ResponseObject ro = new ResponseObject("Delete WorldLink " + UUID.ToString(), func); - apiClient.DeleteWorldLinkAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); + ResponseObject ro = new ResponseObject("Delete WorldLink " + UUID.ToString(), func); + apiClient.DeleteWorldLinkAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject, ro); return ro; } } -- GitLab