// AUTO-GENERATED FILE, DO NOT MODIFY! // part of openapi.api; class FacesApi { FacesApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; static const ApiVersion getFacesAddedIn = .new(1, 0, 0); static const ApiState getFacesState = .stable; static const ApiVersion createFaceAddedIn = .new(1, 0, 0); static const ApiState createFaceState = .stable; static const ApiVersion deleteFaceAddedIn = .new(1, 0, 0); static const ApiState deleteFaceState = .stable; static const ApiVersion reassignFacesByIdAddedIn = .new(1, 0, 0); static const ApiState reassignFacesByIdState = .stable; /// Retrieve faces for asset /// /// Retrieve all faces belonging to an asset. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future getFacesWithHttpInfo({required String id, Future? abortTrigger}) async { final apiPath = r'/faces'; Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; queryParams.addAll(_queryParams('', 'id', id)); const contentTypes = []; return apiClient.invokeAPI( apiPath, r'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Retrieve faces for asset /// /// Retrieve all faces belonging to an asset. /// /// Available since server v1.0.0. Future> getFaces({required String id, Future? abortTrigger}) async { final response = await getFacesWithHttpInfo(id: id, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, r'List') as List) .cast() .toList(growable: false); } throw ApiException(response.statusCode, r'Unexpected empty response body'); } /// Create a face /// /// Create a new face that has not been discovered by facial recognition. The content of the bounding box is considered a face. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future createFaceWithHttpInfo(AssetFaceCreateDto assetFaceCreateDto, {Future? abortTrigger}) async { final apiPath = r'/faces'; Object? postBody = assetFaceCreateDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'POST', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Create a face /// /// Create a new face that has not been discovered by facial recognition. The content of the bounding box is considered a face. /// /// Available since server v1.0.0. Future createFace(AssetFaceCreateDto assetFaceCreateDto, {Future? abortTrigger}) async { final response = await createFaceWithHttpInfo(assetFaceCreateDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Delete a face /// /// Delete a face identified by the id. Optionally can be force deleted. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future deleteFaceWithHttpInfo( String id, AssetFaceDeleteDto assetFaceDeleteDto, { Future? abortTrigger, }) async { final apiPath = r'/faces/{id}'.replaceAll('{id}', id); Object? postBody = assetFaceDeleteDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'DELETE', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Delete a face /// /// Delete a face identified by the id. Optionally can be force deleted. /// /// Available since server v1.0.0. Future deleteFace(String id, AssetFaceDeleteDto assetFaceDeleteDto, {Future? abortTrigger}) async { final response = await deleteFaceWithHttpInfo(id, assetFaceDeleteDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Re-assign a face to another person /// /// Re-assign the face provided in the body to the person identified by the id in the path parameter. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future reassignFacesByIdWithHttpInfo(String id, FaceDto faceDto, {Future? abortTrigger}) async { final apiPath = r'/faces/{id}'.replaceAll('{id}', id); Object? postBody = faceDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'PUT', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Re-assign a face to another person /// /// Re-assign the face provided in the body to the person identified by the id in the path parameter. /// /// Available since server v1.0.0. Future reassignFacesById(String id, FaceDto faceDto, {Future? abortTrigger}) async { final response = await reassignFacesByIdWithHttpInfo(id, faceDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), r'PersonResponseDto') as PersonResponseDto; } throw ApiException(response.statusCode, r'Unexpected empty response body'); } }