diff --git a/Main/Program.cs b/Main/Program.cs index e90d304a630ca5806a13ffef70a7d02b9993b568..0cb61f649ae22d30247c61b31350164273d6719e 100644 --- a/Main/Program.cs +++ b/Main/Program.cs @@ -80,7 +80,7 @@ namespace Main Login = "buffer", SensorData = dataList.ToArray(), }; - + // Send sensor with specified data to Twinzo server PostResponseContract[] response = await devkitConnector.AddSensorData(new[] { sensor }); Console.WriteLine(response); diff --git a/SDK/Connection/V3/Utils.cs b/SDK/Connection/V3/Utils.cs index 8905ca41ce7d686374d27244cfdc7ffe5c94fc34..5d0eafa1056bacb551a3814d1954b776bf1b8f52 100644 --- a/SDK/Connection/V3/Utils.cs +++ b/SDK/Connection/V3/Utils.cs @@ -1,6 +1,7 @@  using SDK.Contracts.Data; using SDK.Models; +using System; using System.Threading.Tasks; namespace SDK @@ -51,5 +52,56 @@ namespace SDK return response; } + + /// <summary> + /// Generic GET request + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="subUrl"></param> + /// <returns></returns> + public async Task<T> Get<T>(string subUrl) + { + var response = await GetRequest<T>(subUrl); + + return response; + } + + /// <summary> + /// Generic POST request + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="subUrl"></param> + /// <param name="body"></param> + /// <returns></returns> + public async Task<T> Post<T>(string subUrl, object body) + { + var response = await PostRequest<T>(subUrl, body); + + return response; + } + + /// <summary> + /// Generic PATCH request + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="subUrl"></param> + /// <param name="body"></param> + /// <returns></returns> + public async Task<T> Patch<T>(string subUrl, object body) + { + var response = await PatchRequest<T>(subUrl, body); + + return response; + } + + /// <summary> + /// Generic DELETE request + /// </summary> + /// <param name="subUrl"></param> + /// <returns></returns> + public async Task Delete(string subUrl) + { + await DeleteRequest(subUrl); + } } }