mirror of
https://github.com/JuLi0n21/thumbnailservice.git
synced 2026-04-20 00:10:07 +00:00
208 lines
6.7 KiB
JSON
208 lines
6.7 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "thumbnail.proto",
|
|
"version": "version not set"
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "ThumbnailService"
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"paths": {
|
|
"/v1/ocr": {
|
|
"post": {
|
|
"summary": "Performs OCR (Optical Character Recognition) on a provided file.\nAccepts an OCRFileRequest and returns an OCRFileResponse.",
|
|
"operationId": "ThumbnailService_OcrFile",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/thumbnail_serviceOCRFileResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"description": "Request message for OCR processing.\n\nThe file_content must be a base64-encoded file.\nThe cleanUp flag indicates if whitespace normalization and character cleanup\nshould be applied to the extracted text.",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/thumbnail_serviceOCRFileRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"ThumbnailService"
|
|
]
|
|
}
|
|
},
|
|
"/v1/thumbnail": {
|
|
"post": {
|
|
"summary": "Generates a thumbnail image from a given file.\nAccepts a ThumbnailRequest and returns a ThumbnailResponse.",
|
|
"operationId": "ThumbnailService_GenerateThumbnail",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/thumbnail_serviceThumbnailResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"description": "Request message for thumbnail generation.\n\nThe file_content must be a base64-encoded file (image, video, or PDF).\nOptional max_width and max_height can be provided to resize the thumbnail\n(values of 0 mean no resizing constraints).",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/thumbnail_serviceThumbnailRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"ThumbnailService"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"protobufAny": {
|
|
"type": "object",
|
|
"properties": {
|
|
"@type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": {}
|
|
},
|
|
"rpcStatus": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/protobufAny"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"thumbnail_serviceFileType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"FILE_TYPE_UNSPECIFIED",
|
|
"IMAGE",
|
|
"VIDEO",
|
|
"PDF"
|
|
],
|
|
"default": "FILE_TYPE_UNSPECIFIED",
|
|
"description": "Enum representing the supported file types for processing.\n\n - FILE_TYPE_UNSPECIFIED: Default value when file type is not specified.\n - IMAGE: Represents an image file type.\n - VIDEO: Represents a video file type.\n - PDF: Represents a PDF file type."
|
|
},
|
|
"thumbnail_serviceOCRFileRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fileContent": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64-encoded bytes of the file to OCR."
|
|
},
|
|
"fileType": {
|
|
"$ref": "#/definitions/thumbnail_serviceFileType",
|
|
"description": "Type of the file for future extensibility."
|
|
},
|
|
"cleanUp": {
|
|
"type": "boolean",
|
|
"description": "Whether to normalize whitespace and remove unnecessary characters."
|
|
}
|
|
},
|
|
"description": "Request message for OCR processing.\n\nThe file_content must be a base64-encoded file.\nThe cleanUp flag indicates if whitespace normalization and character cleanup\nshould be applied to the extracted text."
|
|
},
|
|
"thumbnail_serviceOCRFileResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string",
|
|
"description": "Status message about the OCR operation."
|
|
},
|
|
"ocrContent": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64-encoded bytes of the OCR processed file."
|
|
},
|
|
"textContent": {
|
|
"type": "string",
|
|
"description": "Extracted text content from the file."
|
|
}
|
|
},
|
|
"description": "Response message for OCR processing.\n\nContains a status message, the OCRed file content as bytes, and\nthe extracted text content as a string."
|
|
},
|
|
"thumbnail_serviceThumbnailRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fileContent": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64-encoded bytes of the file to process."
|
|
},
|
|
"fileType": {
|
|
"$ref": "#/definitions/thumbnail_serviceFileType",
|
|
"description": "Specifies the type of the file."
|
|
},
|
|
"maxWidth": {
|
|
"type": "integer",
|
|
"format": "int32",
|
|
"description": "Maximum width of the generated thumbnail; 0 means no limit."
|
|
},
|
|
"maxHeight": {
|
|
"type": "integer",
|
|
"format": "int32",
|
|
"description": "Maximum height of the generated thumbnail; 0 means no limit."
|
|
}
|
|
},
|
|
"description": "Request message for thumbnail generation.\n\nThe file_content must be a base64-encoded file (image, video, or PDF).\nOptional max_width and max_height can be provided to resize the thumbnail\n(values of 0 mean no resizing constraints)."
|
|
},
|
|
"thumbnail_serviceThumbnailResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string",
|
|
"description": "Status or informational message about the thumbnail generation."
|
|
},
|
|
"thumbnailContent": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64-encoded bytes of the generated thumbnail image."
|
|
}
|
|
},
|
|
"description": "Response message for thumbnail generation.\n\nContains a status message and the generated thumbnail as base64-encoded bytes."
|
|
}
|
|
}
|
|
}
|