// // AUTO-GENERATED FILE, DO NOT MODIFY! // // @dart=2.0 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first // ignore_for_file: lines_longer_than_80_chars part of openapi.api; class DeviceApi { DeviceApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; /// Create a device /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [DeviceDetailDTO] deviceDetailDTO (required): /// Device to create Future deviceCreateWithHttpInfo(DeviceDetailDTO deviceDetailDTO) async { // Verify required params are set. if (deviceDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceDetailDTO'); } final path = r'/api/device'; Object postBody = deviceDetailDTO; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = ['application/json']; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'POST', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Create a device /// /// Parameters: /// /// * [DeviceDetailDTO] deviceDetailDTO (required): /// Device to create Future deviceCreate(DeviceDetailDTO deviceDetailDTO) async { final response = await deviceCreateWithHttpInfo(deviceDetailDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'DeviceDetailDTO') as DeviceDetailDTO; } return Future.value(null); } /// Create devices from provider /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future deviceCreateDevicesFromProviderWithHttpInfo(String userId, String providerId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } final path = r'/api/device/{userId}/fromProvider/{providerId}' .replaceAll('{' + 'userId' + '}', userId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'POST', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Create devices from provider /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future> deviceCreateDevicesFromProvider(String userId, String providerId) async { final response = await deviceCreateDevicesFromProviderWithHttpInfo(userId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) .cast() .toList(growable: false); } return Future>.value(null); } /// Delete a device /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete Future deviceDeleteWithHttpInfo(String deviceId) async { // Verify required params are set. if (deviceId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceId'); } final path = r'/api/device/{deviceId}' .replaceAll('{' + 'deviceId' + '}', deviceId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'DELETE', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Delete a device /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete Future deviceDelete(String deviceId) async { final response = await deviceDeleteWithHttpInfo(deviceId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'MultipartFile') as MultipartFile; } return Future.value(null); } /// Delete all device for a specified /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future deviceDeleteAllForUserWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/device/user/{userId}' .replaceAll('{' + 'userId' + '}', userId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'DELETE', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Delete all device for a specified /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future deviceDeleteAllForUser(String userId) async { final response = await deviceDeleteAllForUserWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'MultipartFile') as MultipartFile; } return Future.value(null); } /// Delete devices from provider /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future deviceDeleteDevicesFromProviderWithHttpInfo(String userId, String providerId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } final path = r'/api/device/{userId}/fromProvider/{providerId}' .replaceAll('{' + 'userId' + '}', userId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'DELETE', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Delete devices from provider /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future deviceDeleteDevicesFromProvider(String userId, String providerId) async { final response = await deviceDeleteDevicesFromProviderWithHttpInfo(userId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'MultipartFile') as MultipartFile; } return Future.value(null); } /// Get all devices summary /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future deviceGetAllWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/device/{userId}' .replaceAll('{' + 'userId' + '}', userId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Get all devices summary /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future> deviceGetAll(String userId) async { final response = await deviceGetAllWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) .cast() .toList(growable: false); } return Future>.value(null); } /// Get a specific device info /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] deviceId (required): /// id of device Future deviceGetDetailWithHttpInfo(String deviceId) async { // Verify required params are set. if (deviceId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceId'); } final path = r'/api/device/detail/{deviceId}' .replaceAll('{' + 'deviceId' + '}', deviceId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Get a specific device info /// /// Parameters: /// /// * [String] deviceId (required): /// id of device Future deviceGetDetail(String deviceId) async { final response = await deviceGetDetailWithHttpInfo(deviceId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'DeviceDetailDTO') as DeviceDetailDTO; } return Future.value(null); } /// Get list of devices from a type /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// user Id /// /// * [DeviceType] type (required): /// device type Future deviceGetDevicesByTypeWithHttpInfo(String userId, DeviceType type) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } if (type == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: type'); } final path = r'/api/device/{userId}/type/{type}' .replaceAll('{' + 'userId' + '}', userId.toString()) .replaceAll('{' + 'type' + '}', type.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Get list of devices from a type /// /// Parameters: /// /// * [String] userId (required): /// user Id /// /// * [DeviceType] type (required): /// device type Future> deviceGetDevicesByType(String userId, DeviceType type) async { final response = await deviceGetDevicesByTypeWithHttpInfo(userId, type); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) .cast() .toList(growable: false); } return Future>.value(null); } /// Get devices from provider /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future deviceGetDevicesFromProviderWithHttpInfo(String userId, String providerId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } final path = r'/api/device/{userId}/fromProvider/{providerId}' .replaceAll('{' + 'userId' + '}', userId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Get devices from provider /// /// Parameters: /// /// * [String] userId (required): /// User Id /// /// * [String] providerId (required): /// Id of Provider Future> deviceGetDevicesFromProvider(String userId, String providerId) async { final response = await deviceGetDevicesFromProviderWithHttpInfo(userId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) .cast() .toList(growable: false); } return Future>.value(null); } /// Get all zigbee2Mqtt devices /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id Future deviceGetDevicesFromZigbee2MqttWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/device/zigbee2Mqtt/{userId}' .replaceAll('{' + 'userId' + '}', userId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'GET', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Get all zigbee2Mqtt devices /// /// Parameters: /// /// * [String] userId (required): /// User Id Future> deviceGetDevicesFromZigbee2Mqtt(String userId) async { final response = await deviceGetDevicesFromZigbee2MqttWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) .cast() .toList(growable: false); } return Future>.value(null); } /// Update a device /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] deviceId (required): /// /// * [DeviceDetailDTO] deviceDetailDTO (required): /// Device to update Future deviceUpdateWithHttpInfo(String deviceId, DeviceDetailDTO deviceDetailDTO) async { // Verify required params are set. if (deviceId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceId'); } if (deviceDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceDetailDTO'); } final path = r'/api/device/{deviceId}' .replaceAll('{' + 'deviceId' + '}', deviceId.toString()); Object postBody = deviceDetailDTO; final queryParams = []; final headerParams = {}; final formParams = {}; final contentTypes = ['application/json']; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; if ( nullableContentType != null && nullableContentType.toLowerCase().startsWith('multipart/form-data') ) { bool hasFields = false; final mp = MultipartRequest(null, null); if (hasFields) { postBody = mp; } } else { } return await apiClient.invokeAPI( path, 'PUT', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Update a device /// /// Parameters: /// /// * [String] deviceId (required): /// /// * [DeviceDetailDTO] deviceDetailDTO (required): /// Device to update Future deviceUpdate(String deviceId, DeviceDetailDTO deviceDetailDTO) async { final response = await deviceUpdateWithHttpInfo(deviceId, deviceDetailDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return apiClient.deserialize(_decodeBodyBytes(response), 'DeviceDetailDTO') as DeviceDetailDTO; } return Future.value(null); } }