// // 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 RoomApi { RoomApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; /// Create a room /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [RoomCreateOrUpdateDetailDTO] roomCreateOrUpdateDetailDTO (required): /// Room to create Future roomCreateWithHttpInfo(RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetailDTO) async { // Verify required params are set. if (roomCreateOrUpdateDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomCreateOrUpdateDetailDTO'); } final path = r'/api/room'; Object postBody = roomCreateOrUpdateDetailDTO; 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 room /// /// Parameters: /// /// * [RoomCreateOrUpdateDetailDTO] roomCreateOrUpdateDetailDTO (required): /// Room to create Future roomCreate(RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetailDTO) async { final response = await roomCreateWithHttpInfo(roomCreateOrUpdateDetailDTO); 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), 'RoomDetailDTO') as RoomDetailDTO; } return Future.value(null); } /// Delete device from a room /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete from the room /// /// * [String] roomId (required): /// Id of room Future roomDeleteWithHttpInfo(String deviceId, String roomId) async { // Verify required params are set. if (deviceId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: deviceId'); } if (roomId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomId'); } final path = r'/api/room/{roomId}/device/{deviceId}' .replaceAll('{' + 'deviceId' + '}', deviceId.toString()) .replaceAll('{' + 'roomId' + '}', roomId.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 room /// /// Parameters: /// /// * [String] deviceId (required): /// Id of device to delete from the room /// /// * [String] roomId (required): /// Id of room Future roomDelete(String deviceId, String roomId) async { final response = await roomDeleteWithHttpInfo(deviceId, roomId); 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 room /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] roomId (required): /// Id of room Future roomDelete2WithHttpInfo(String roomId) async { // Verify required params are set. if (roomId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomId'); } final path = r'/api/room/{roomId}' .replaceAll('{' + 'roomId' + '}', roomId.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 room /// /// Parameters: /// /// * [String] roomId (required): /// Id of room Future roomDelete2(String roomId) async { final response = await roomDelete2WithHttpInfo(roomId); 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 room for a specified user /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future roomDeleteAllForUserWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/room/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 room for a specified user /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future roomDeleteAllForUser(String userId) async { final response = await roomDeleteAllForUserWithHttpInfo(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 rooms for the specified user /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future roomGetAllWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); } final path = r'/api/room/{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 rooms for the specified user /// /// Parameters: /// /// * [String] userId (required): /// Id of user Future> roomGetAll(String userId) async { final response = await roomGetAllWithHttpInfo(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 room /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [String] roomId (required): /// room id /// /// * [String] userId: /// user id Future roomGetDetailWithHttpInfo(String roomId, { String userId }) async { // Verify required params are set. if (roomId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomId'); } final path = r'/api/room/detail/{roomId}' .replaceAll('{' + 'roomId' + '}', roomId.toString()); Object postBody; final queryParams = []; final headerParams = {}; final formParams = {}; if (userId != null) { queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId)); } 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 room /// /// Parameters: /// /// * [String] roomId (required): /// room id /// /// * [String] userId: /// user id Future roomGetDetail(String roomId, { String userId }) async { final response = await roomGetDetailWithHttpInfo(roomId, userId: 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), 'RoomDetailDTO') as RoomDetailDTO; } return Future.value(null); } /// Update a room /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// /// * [RoomCreateOrUpdateDetailDTO] roomCreateOrUpdateDetailDTO (required): /// room to update Future roomUpdateWithHttpInfo(RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetailDTO) async { // Verify required params are set. if (roomCreateOrUpdateDetailDTO == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomCreateOrUpdateDetailDTO'); } final path = r'/api/room'; Object postBody = roomCreateOrUpdateDetailDTO; 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 room /// /// Parameters: /// /// * [RoomCreateOrUpdateDetailDTO] roomCreateOrUpdateDetailDTO (required): /// room to update Future roomUpdate(RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetailDTO) async { final response = await roomUpdateWithHttpInfo(roomCreateOrUpdateDetailDTO); 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), 'RoomCreateOrUpdateDetailDTO') as RoomCreateOrUpdateDetailDTO; } return Future.value(null); } }