444 lines
14 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 AutomationApi {
AutomationApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Create an automation
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required):
/// Automation to create
Future<Response> automationCreateWithHttpInfo(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async {
// Verify required params are set.
if (automationCreateOrUpdateDetailDTO == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: automationCreateOrUpdateDetailDTO');
}
final path = r'/api/automation';
Object postBody = automationCreateOrUpdateDetailDTO;
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 an automation
///
/// Parameters:
///
/// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required):
/// Automation to create
Future<AutomationDTO> automationCreate(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async {
final response = await automationCreateWithHttpInfo(automationCreateOrUpdateDetailDTO);
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), 'AutomationDTO') as AutomationDTO;
}
return Future<AutomationDTO>.value(null);
}
/// Delete an automation
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] automationId (required):
/// Id of automation to delete
Future<Response> automationDeleteWithHttpInfo(String automationId) async {
// Verify required params are set.
if (automationId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: automationId');
}
final path = r'/api/automation/{automationId}'
.replaceAll('{' + 'automationId' + '}', automationId.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 an automation
///
/// Parameters:
///
/// * [String] automationId (required):
/// Id of automation to delete
Future<String> automationDelete(String automationId) async {
final response = await automationDeleteWithHttpInfo(automationId);
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 automation for a specified
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<Response> automationDeleteAllForUserWithHttpInfo(String userId) async {
// Verify required params are set.
if (userId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: userId');
}
final path = r'/api/automation/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 automation for a specified
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<String> automationDeleteAllForUser(String userId) async {
final response = await automationDeleteAllForUserWithHttpInfo(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 automations for the specified user
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<Response> automationGetAllWithHttpInfo(String userId) async {
// Verify required params are set.
if (userId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: userId');
}
final path = r'/api/automation/{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 automations for the specified user
///
/// Parameters:
///
/// * [String] userId (required):
/// Id of user
Future<List<RoomSummaryDTO>> automationGetAll(String userId) async {
final response = await automationGetAllWithHttpInfo(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 automation
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] automationId (required):
/// automation id
Future<Response> automationGetDetailWithHttpInfo(String automationId) async {
// Verify required params are set.
if (automationId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: automationId');
}
final path = r'/api/automation/detail/{automationId}'
.replaceAll('{' + 'automationId' + '}', automationId.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 automation
///
/// Parameters:
///
/// * [String] automationId (required):
/// automation id
Future<AutomationDetailDTO> automationGetDetail(String automationId) async {
final response = await automationGetDetailWithHttpInfo(automationId);
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), 'AutomationDetailDTO') as AutomationDetailDTO;
}
return Future<AutomationDetailDTO>.value(null);
}
/// Update an automation
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required):
/// automation to update
Future<Response> automationUpdateWithHttpInfo(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async {
// Verify required params are set.
if (automationCreateOrUpdateDetailDTO == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: automationCreateOrUpdateDetailDTO');
}
final path = r'/api/automation';
Object postBody = automationCreateOrUpdateDetailDTO;
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 an automation
///
/// Parameters:
///
/// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required):
/// automation to update
Future<AutomationCreateOrUpdateDetailDTO> automationUpdate(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async {
final response = await automationUpdateWithHttpInfo(automationCreateOrUpdateDetailDTO);
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), 'AutomationCreateOrUpdateDetailDTO') as AutomationCreateOrUpdateDetailDTO;
}
return Future<AutomationCreateOrUpdateDetailDTO>.value(null);
}
}