/// <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 <SettingEntity> ApiSettingByIdGetAsync(this IHomeAutomationAPI operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiSettingByIdGetWithHttpMessagesAsync(id, 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 <IList <LocationEntity> > ApiLocationGetAsync(this IHomeAutomationAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiLocationGetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Posts Device to server /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='deviceEntity'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <DeviceEntity> ApiDevicePostAsync(this IHomeAutomationAPI operations, DeviceEntity deviceEntity = default(DeviceEntity), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiDevicePostWithHttpMessagesAsync(deviceEntity, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
private void ConfigureDevice(IHomeAutomationAPI homeAutomationAPI, DeviceConfig deviceConfig) { var locations = homeAutomationAPI.ApiLocationGet(); var deviceTypes = homeAutomationAPI.ApiDeviceGet(); var sensors = homeAutomationAPI.ApiSensorGet(); var devices = homeAutomationAPI.ApiDeviceGet(); LocationEntity location = null; if (!locations.Where(x => x.Name == deviceConfig.Location).Any()) { // Create Location } DeviceTypeEntity deviceType = null; if (!deviceTypes.Where(x => x.Name == deviceConfig.DeviceTypeName).Any()) { // Create DeviceType } List <SensorEntity> sensorList = new List <SensorEntity>(); foreach (var sensor in deviceConfig.Sensors) { if (!sensors.Where(x => x.Name == sensor).Any()) { // Create Sensor } } if (!devices.Where(x => x.Name == deviceConfig.Name).Any()) { // Create Device } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IHomeAutomationAPI homeAutomationAPI, IOptions <DeviceConfig> deviceConfig) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); }
/// <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 ApiSettingByIdDeleteAsync(this IHomeAutomationAPI operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ApiSettingByIdDeleteWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> public static void ApiSettingByIdDelete(this IHomeAutomationAPI operations, int id) { operations.ApiSettingByIdDeleteAsync(id).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='settingEntity'> /// </param> public static void ApiSettingByIdPut(this IHomeAutomationAPI operations, int id, SettingEntity settingEntity = default(SettingEntity)) { operations.ApiSettingByIdPutAsync(id, settingEntity).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='settingEntity'> /// </param> public static SettingEntity ApiSettingPost(this IHomeAutomationAPI operations, SettingEntity settingEntity = default(SettingEntity)) { return(operations.ApiSettingPostAsync(settingEntity).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task AccountLogoutPostAsync(this IHomeAutomationAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.AccountLogoutPostWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='sensorEntity'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task ApiSensorByIdPutAsync(this IHomeAutomationAPI operations, int id, SensorEntity sensorEntity = default(SensorEntity), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ApiSensorByIdPutWithHttpMessagesAsync(id, sensorEntity, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='locationEntity'> /// </param> public static void ApiLocationByIdPut(this IHomeAutomationAPI operations, int id, LocationEntity locationEntity = default(LocationEntity)) { operations.ApiLocationByIdPutAsync(id, locationEntity).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='locationEntity'> /// </param> public static LocationEntity ApiLocationPost(this IHomeAutomationAPI operations, LocationEntity locationEntity = default(LocationEntity)) { return(operations.ApiLocationPostAsync(locationEntity).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <DeviceEntity> ApiDeviceGet(this IHomeAutomationAPI operations) { return(operations.ApiDeviceGetAsync().GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='deviceTypeEntity'> /// </param> public static void ApiDeviceTypeByIdPut(this IHomeAutomationAPI operations, int id, DeviceTypeEntity deviceTypeEntity = default(DeviceTypeEntity)) { operations.ApiDeviceTypeByIdPutAsync(id, deviceTypeEntity).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> public static DeviceEntity ApiDeviceByIdGet(this IHomeAutomationAPI operations, int id) { return(operations.ApiDeviceByIdGetAsync(id).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <SettingEntity> ApiSettingGet(this IHomeAutomationAPI operations) { return(operations.ApiSettingGetAsync().GetAwaiter().GetResult()); }
/// <summary> /// Posts Device to server /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='deviceEntity'> /// </param> public static DeviceEntity ApiDevicePost(this IHomeAutomationAPI operations, DeviceEntity deviceEntity = default(DeviceEntity)) { return(operations.ApiDevicePostAsync(deviceEntity).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static void AccountLogoutPost(this IHomeAutomationAPI operations) { operations.AccountLogoutPostAsync().GetAwaiter().GetResult(); }