mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
535 lines
16 KiB
Dart
535 lines
16 KiB
Dart
//
|
|
// 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<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>['application/json'];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<RoomDetailDTO> 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<RoomDetailDTO>.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<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>[];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<MultipartFile> 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), 'MultipartFile') as MultipartFile;
|
|
}
|
|
return Future<MultipartFile>.value(null);
|
|
}
|
|
|
|
/// Delete a room
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] roomId (required):
|
|
/// Id of room
|
|
Future<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>[];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<MultipartFile> 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), 'MultipartFile') as MultipartFile;
|
|
}
|
|
return Future<MultipartFile>.value(null);
|
|
}
|
|
|
|
/// Delete all room for a specified
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>[];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<MultipartFile> 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), 'MultipartFile') as MultipartFile;
|
|
}
|
|
return Future<MultipartFile>.value(null);
|
|
}
|
|
|
|
/// Get all rooms for the specified user
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>[];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<List<RoomSummaryDTO>> 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<RoomSummaryDTO>') as List)
|
|
.cast<RoomSummaryDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<RoomSummaryDTO>>.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<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
if (userId != null) {
|
|
queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId));
|
|
}
|
|
|
|
final contentTypes = <String>[];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<RoomDetailDTO> 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<RoomDetailDTO>.value(null);
|
|
}
|
|
|
|
/// Update a room
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [RoomCreateOrUpdateDetailDTO] roomCreateOrUpdateDetailDTO (required):
|
|
/// room to update
|
|
Future<Response> 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 = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
final contentTypes = <String>['application/json'];
|
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
|
final authNames = <String>['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<RoomCreateOrUpdateDetailDTO> 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<RoomCreateOrUpdateDetailDTO>.value(null);
|
|
}
|
|
}
|