// // 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 GroupApi { GroupApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; /// Create a group /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required): /// Group to create Future groupCreateWithHttpInfo(GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetailDTO) async { // Verify required params are set. if (groupCreateOrUpdateDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupCreateOrUpdateDetailDTO'); } final path = r'/api/group'; Object postBody = groupCreateOrUpdateDetailDTO; 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 group /// /// Parameters: /// /// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required): /// Group to create Future groupCreate(GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetailDTO) async { final response = await groupCreateWithHttpInfo(groupCreateOrUpdateDetailDTO); 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), 'GroupDetailDTO') as GroupDetailDTO; } return Future.value(null); } /// Create groups from provider /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id Future groupCreateDevicesFromZigbee2MqttWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/group/{userId}/fromZigbee' .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, 'POST', queryParams, postBody, headerParams, formParams, nullableContentType, authNames, ); } /// Create groups from provider /// /// Parameters: /// /// * [String] userId (required): /// User Id Future> groupCreateDevicesFromZigbee2Mqtt(String userId) async { final response = await groupCreateDevicesFromZigbee2MqttWithHttpInfo(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); } /// Delete device from a group /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete from the group /// /// * [String] groupId (required): /// Id of group Future groupDeleteWithHttpInfo(String deviceId, String groupId) async { // Verify required params are set. if (deviceId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceId'); } if (groupId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupId'); } final path = r'/api/group/{groupId}/device/{deviceId}' .replaceAll('{' + 'deviceId' + '}', deviceId.toString()) .replaceAll('{' + 'groupId' + '}', groupId.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 device from a group /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete from the group /// /// * [String] groupId (required): /// Id of group Future groupDelete(String deviceId, String groupId) async { final response = await groupDeleteWithHttpInfo(deviceId, groupId); 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), 'String') as String; } return Future.value(null); } /// Delete a group /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] groupId (required): /// Id of group Future groupDelete2WithHttpInfo(String groupId) async { // Verify required params are set. if (groupId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupId'); } final path = r'/api/group/{groupId}' .replaceAll('{' + 'groupId' + '}', groupId.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 group /// /// Parameters: /// /// * [String] groupId (required): /// Id of group Future groupDelete2(String groupId) async { final response = await groupDelete2WithHttpInfo(groupId); 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), 'String') as String; } return Future.value(null); } /// Delete all group for a specified /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future groupDeleteAllForUserWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/group/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 group for a specified /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future groupDeleteAllForUser(String userId) async { final response = await groupDeleteAllForUserWithHttpInfo(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), 'String') as String; } return Future.value(null); } /// Get all groups for the specified user /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future groupGetAllWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/group/{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 groups for the specified user /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future> groupGetAll(String userId) async { final response = await groupGetAllWithHttpInfo(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 detail info of a specified group /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] groupId (required): /// groupid Future groupGetDetailWithHttpInfo(String groupId) async { // Verify required params are set. if (groupId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupId'); } final path = r'/api/group/detail/{groupId}' .replaceAll('{' + 'groupId' + '}', groupId.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 detail info of a specified group /// /// Parameters: /// /// * [String] groupId (required): /// groupid Future groupGetDetail(String groupId) async { final response = await groupGetDetailWithHttpInfo(groupId); 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), 'GroupDetailDTO') as GroupDetailDTO; } return Future.value(null); } /// Get list of group from a type /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// user Id /// /// * [String] type (required): /// group type Future groupGetGroupsByTypeWithHttpInfo(String userId, String 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/group/{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 group from a type /// /// Parameters: /// /// * [String] userId (required): /// user Id /// /// * [String] type (required): /// group type Future> groupGetGroupsByType(String userId, String type) async { final response = await groupGetGroupsByTypeWithHttpInfo(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 all zigbee2Mqtt groups /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// User Id Future groupGetGroupsFromZigbee2MqttWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/group/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 groups /// /// Parameters: /// /// * [String] userId (required): /// User Id Future> groupGetGroupsFromZigbee2Mqtt(String userId) async { final response = await groupGetGroupsFromZigbee2MqttWithHttpInfo(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 group /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required): /// group to update Future groupUpdateWithHttpInfo(GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetailDTO) async { // Verify required params are set. if (groupCreateOrUpdateDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupCreateOrUpdateDetailDTO'); } final path = r'/api/group'; Object postBody = groupCreateOrUpdateDetailDTO; 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 group /// /// Parameters: /// /// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required): /// group to update Future groupUpdate(GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetailDTO) async { final response = await groupUpdateWithHttpInfo(groupCreateOrUpdateDetailDTO); 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), 'GroupCreateOrUpdateDetailDTO') as GroupCreateOrUpdateDetailDTO; } return Future.value(null); } }