Skip to content
Snippets Groups Projects
Commit 81d04700 authored by Patrik Paško's avatar Patrik Paško
Browse files

generic methods added

parent e7359347
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......

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);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment