754 lines
23 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 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<Response> 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 = <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 group
///
/// Parameters:
///
/// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required):
/// Group to create
Future<GroupDetailDTO> 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<GroupDetailDTO>.value(null);
}
/// Create groups from provider
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// User Id
Future<Response> 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 = <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,
'POST',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// Create groups from provider
///
/// Parameters:
///
/// * [String] userId (required):
/// User Id
Future<List<GroupDetailDTO>> 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<GroupDetailDTO>') as List)
.cast<GroupDetailDTO>()
.toList(growable: false);
}
return Future<List<GroupDetailDTO>>.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<Response> 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 = <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 group
///
/// Parameters:
///
/// * [String] deviceId (required):
/// Id of device to delete from the group
///
/// * [String] groupId (required):
/// Id of group
Future<String> 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<String>.value(null);
}
/// Delete a group
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] groupId (required):
/// Id of group
Future<Response> 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 = <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 group
///
/// Parameters:
///
/// * [String] groupId (required):
/// Id of group
Future<String> 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<String>.value(null);
}
/// Delete all group for a specified
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<Response> 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 = <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 group for a specified
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<String> 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<String>.value(null);
}
/// Get all groups for the specified user
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<Response> 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 = <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 groups for the specified user
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<List<GroupSummaryDTO>> 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<GroupSummaryDTO>') as List)
.cast<GroupSummaryDTO>()
.toList(growable: false);
}
return Future<List<GroupSummaryDTO>>.value(null);
}
/// Get detail info of a specified group
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] groupId (required):
/// groupid
Future<Response> 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 = <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 detail info of a specified group
///
/// Parameters:
///
/// * [String] groupId (required):
/// groupid
Future<GroupDetailDTO> 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<GroupDetailDTO>.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<Response> 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 = <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 list of group from a type
///
/// Parameters:
///
/// * [String] userId (required):
/// user Id
///
/// * [String] type (required):
/// group type
Future<List<GroupSummaryDTO>> 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<GroupSummaryDTO>') as List)
.cast<GroupSummaryDTO>()
.toList(growable: false);
}
return Future<List<GroupSummaryDTO>>.value(null);
}
/// Get all zigbee2Mqtt groups
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// User Id
Future<Response> 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 = <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 zigbee2Mqtt groups
///
/// Parameters:
///
/// * [String] userId (required):
/// User Id
Future<List<GroupDetailDTO>> 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<GroupDetailDTO>') as List)
.cast<GroupDetailDTO>()
.toList(growable: false);
}
return Future<List<GroupDetailDTO>>.value(null);
}
/// Update a group
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required):
/// group to update
Future<Response> 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 = <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 group
///
/// Parameters:
///
/// * [GroupCreateOrUpdateDetailDTO] groupCreateOrUpdateDetailDTO (required):
/// group to update
Future<GroupCreateOrUpdateDetailDTO> 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<GroupCreateOrUpdateDetailDTO>.value(null);
}
}