mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 17:51:20 +00:00
855 lines
26 KiB
Dart
855 lines
26 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 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<Response> 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 = <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 device
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [DeviceDetailDTO] deviceDetailDTO (required):
|
|
/// Device to create
|
|
Future<DeviceDetailDTO> 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<DeviceDetailDTO>.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<Response> 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 = <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 devices from provider
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// User Id
|
|
///
|
|
/// * [String] providerId (required):
|
|
/// Id of Provider
|
|
Future<List<DeviceDetailDTO>> 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<DeviceDetailDTO>') as List)
|
|
.cast<DeviceDetailDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<DeviceDetailDTO>>.value(null);
|
|
}
|
|
|
|
/// Delete a device
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
/// Id of device to delete
|
|
Future<Response> 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 = <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 device
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
/// Id of device to delete
|
|
Future<MultipartFile> 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<MultipartFile>.value(null);
|
|
}
|
|
|
|
/// Delete all device for a specified
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<Response> 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 = <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 device for a specified
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<MultipartFile> 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<MultipartFile>.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<Response> 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 = <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 devices from provider
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// User Id
|
|
///
|
|
/// * [String] providerId (required):
|
|
/// Id of Provider
|
|
Future<MultipartFile> 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<MultipartFile>.value(null);
|
|
}
|
|
|
|
/// Get all devices summary
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<Response> 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 = <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 devices summary
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// Id of user
|
|
Future<List<DeviceSummaryDTO>> 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<DeviceSummaryDTO>') as List)
|
|
.cast<DeviceSummaryDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<DeviceSummaryDTO>>.value(null);
|
|
}
|
|
|
|
/// Get a specific device info
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
/// id of device
|
|
Future<Response> 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 = <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 a specific device info
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
/// id of device
|
|
Future<DeviceDetailDTO> 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<DeviceDetailDTO>.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<Response> 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 = <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 devices from a type
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// user Id
|
|
///
|
|
/// * [DeviceType] type (required):
|
|
/// device type
|
|
Future<List<DeviceDetailDTO>> 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<DeviceDetailDTO>') as List)
|
|
.cast<DeviceDetailDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<DeviceDetailDTO>>.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<Response> 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 = <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 devices from provider
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// User Id
|
|
///
|
|
/// * [String] providerId (required):
|
|
/// Id of Provider
|
|
Future<List<DeviceDetailDTO>> 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<DeviceDetailDTO>') as List)
|
|
.cast<DeviceDetailDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<DeviceDetailDTO>>.value(null);
|
|
}
|
|
|
|
/// Get all zigbee2Mqtt devices
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// User Id
|
|
Future<Response> 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 = <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 devices
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] userId (required):
|
|
/// User Id
|
|
Future<List<DeviceDetailDTO>> 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<DeviceDetailDTO>') as List)
|
|
.cast<DeviceDetailDTO>()
|
|
.toList(growable: false);
|
|
}
|
|
return Future<List<DeviceDetailDTO>>.value(null);
|
|
}
|
|
|
|
/// Update a device
|
|
///
|
|
/// Note: This method returns the HTTP [Response].
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
///
|
|
/// * [DeviceDetailDTO] deviceDetailDTO (required):
|
|
/// Device to update
|
|
Future<Response> 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 = <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 device
|
|
///
|
|
/// Parameters:
|
|
///
|
|
/// * [String] deviceId (required):
|
|
///
|
|
/// * [DeviceDetailDTO] deviceDetailDTO (required):
|
|
/// Device to update
|
|
Future<DeviceDetailDTO> 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<DeviceDetailDTO>.value(null);
|
|
}
|
|
}
|