feat: getAssetOcr endpoint (#23331)

* feat: getAssetOcr endpoint

* pr feedback
This commit is contained in:
Alex 2025-10-28 15:57:03 -05:00 committed by GitHub
parent 8d25f81bec
commit 9098717c55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 560 additions and 0 deletions

View file

@ -532,6 +532,62 @@ class AssetsApi {
return null;
}
/// This endpoint requires the `asset.read` permission.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] id (required):
Future<Response> getAssetOcrWithHttpInfo(String id,) async {
// ignore: prefer_const_declarations
final apiPath = r'/assets/{id}/ocr'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
apiPath,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// This endpoint requires the `asset.read` permission.
///
/// Parameters:
///
/// * [String] id (required):
Future<List<AssetOcrResponseDto>?> getAssetOcr(String id,) async {
final response = await getAssetOcrWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _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.isNotEmpty && response.statusCode != HttpStatus.noContent) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<AssetOcrResponseDto>') as List)
.cast<AssetOcrResponseDto>()
.toList(growable: false);
}
return null;
}
/// This endpoint requires the `asset.statistics` permission.
///
/// Note: This method returns the HTTP [Response].