/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='name'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Device> > GetDeviceByNameAsync(this ITelldusdeviceAPI operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDeviceByNameWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <string> GetConfigFileAsync(this ITelldusdeviceAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConfigFileWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Device> GetDeviceByIdAsync(this ITelldusdeviceAPI operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDeviceByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <Device> GetAllDevices(this ITelldusdeviceAPI operations) { return(operations.GetAllDevicesAsync().GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static string GetConfigFile(this ITelldusdeviceAPI operations) { return(operations.GetConfigFileAsync().GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='config'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task StoreConfigAsync(this ITelldusdeviceAPI operations, ConfigFile config = default(ConfigFile), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.StoreConfigWithHttpMessagesAsync(config, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='config'> /// </param> public static void StoreConfig(this ITelldusdeviceAPI operations, ConfigFile config = default(ConfigFile)) { operations.StoreConfigAsync(config).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> public static Device GetDeviceById(this ITelldusdeviceAPI operations, int id) { return(operations.GetDeviceByIdAsync(id).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='name'> /// </param> public static IList <Device> GetDeviceByName(this ITelldusdeviceAPI operations, string name) { return(operations.GetDeviceByNameAsync(name).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='device'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task AddDeviceAsync(this ITelldusdeviceAPI operations, Device device = default(Device), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.AddDeviceWithHttpMessagesAsync(device, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='device'> /// </param> public static void AddDevice(this ITelldusdeviceAPI operations, Device device = default(Device)) { operations.AddDeviceAsync(device).GetAwaiter().GetResult(); }
public TelldusService() { _api = new TelldusdeviceAPI(new Uri("http://localhost:5000")); }