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

@ -546,6 +546,32 @@ export type AssetMetadataResponseDto = {
export type AssetMetadataUpsertDto = {
items: AssetMetadataUpsertItemDto[];
};
export type AssetOcrResponseDto = {
assetId: string;
/** Confidence score for text detection box */
boxScore: number;
id: string;
/** Recognized text */
text: string;
/** Confidence score for text recognition */
textScore: number;
/** Normalized x coordinate of box corner 1 (0-1) */
x1: number;
/** Normalized x coordinate of box corner 2 (0-1) */
x2: number;
/** Normalized x coordinate of box corner 3 (0-1) */
x3: number;
/** Normalized x coordinate of box corner 4 (0-1) */
x4: number;
/** Normalized y coordinate of box corner 1 (0-1) */
y1: number;
/** Normalized y coordinate of box corner 2 (0-1) */
y2: number;
/** Normalized y coordinate of box corner 3 (0-1) */
y3: number;
/** Normalized y coordinate of box corner 4 (0-1) */
y4: number;
};
export type AssetMediaReplaceDto = {
assetData: Blob;
deviceAssetId: string;
@ -2390,6 +2416,19 @@ export function getAssetMetadataByKey({ id, key }: {
...opts
}));
}
/**
* This endpoint requires the `asset.read` permission.
*/
export function getAssetOcr({ id }: {
id: string;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: AssetOcrResponseDto[];
}>(`/assets/${encodeURIComponent(id)}/ocr`, {
...opts
}));
}
/**
* This endpoint requires the `asset.download` permission.
*/