From 153b8548ba15cf4aa94f51c6716992aff57b9a55 Mon Sep 17 00:00:00 2001 From: JuLi0n21 Date: Mon, 2 Jun 2025 00:12:40 +0200 Subject: [PATCH] add better description to swagger --- client/proto/thumbnail.pb.go | 55 ++++++++++++++--------- client/proto/thumbnail_grpc.pb.go | 12 ++++- server/proto/thumbnail.pb.go | 55 ++++++++++++++--------- server/proto/thumbnail_grpc.pb.go | 12 ++++- server/swagger/thumbnail.swagger.json | 39 ++++++++-------- thumbnail.proto | 64 +++++++++++++++++---------- 6 files changed, 150 insertions(+), 87 deletions(-) diff --git a/client/proto/thumbnail.pb.go b/client/proto/thumbnail.pb.go index 3a6e842..b636454 100644 --- a/client/proto/thumbnail.pb.go +++ b/client/proto/thumbnail.pb.go @@ -22,14 +22,14 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Enum for the file type +// Enum representing the supported file types for processing. type FileType int32 const ( - FileType_FILE_TYPE_UNSPECIFIED FileType = 0 // Default value for unspecified file type - FileType_IMAGE FileType = 1 // Image file - FileType_VIDEO FileType = 2 // Video file - FileType_PDF FileType = 3 // PDF file + FileType_FILE_TYPE_UNSPECIFIED FileType = 0 // Default value when file type is not specified. + FileType_IMAGE FileType = 1 // Represents an image file type. + FileType_VIDEO FileType = 2 // Represents a video file type. + FileType_PDF FileType = 3 // Represents a PDF file type. ) // Enum value maps for FileType. @@ -75,13 +75,17 @@ func (FileType) EnumDescriptor() ([]byte, []int) { return file_thumbnail_proto_rawDescGZIP(), []int{0} } -// Request message for generating thumbnails +// Request message for thumbnail generation. +// +// The file_content must be a base64-encoded file (image, video, or PDF). +// Optional max_width and max_height can be provided to resize the thumbnail +// (values of 0 mean no resizing constraints). type ThumbnailRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // File content as bytes - FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // File type (image, video, pdf) - MaxWidth int32 `protobuf:"varint,3,opt,name=max_width,json=maxWidth,proto3" json:"max_width,omitempty"` // Optional max width for resizing (0 means no limit) - MaxHeight int32 `protobuf:"varint,4,opt,name=max_height,json=maxHeight,proto3" json:"max_height,omitempty"` // Optional max height for resizing (0 means no limit) + FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // Base64-encoded bytes of the file to process. + FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // Specifies the type of the file. + MaxWidth int32 `protobuf:"varint,3,opt,name=max_width,json=maxWidth,proto3" json:"max_width,omitempty"` // Maximum width of the generated thumbnail; 0 means no limit. + MaxHeight int32 `protobuf:"varint,4,opt,name=max_height,json=maxHeight,proto3" json:"max_height,omitempty"` // Maximum height of the generated thumbnail; 0 means no limit. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -144,11 +148,13 @@ func (x *ThumbnailRequest) GetMaxHeight() int32 { return 0 } -// Response message for the thumbnail generation +// Response message for thumbnail generation. +// +// Contains a status message and the generated thumbnail as base64-encoded bytes. type ThumbnailResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Message indicating success or failure - ThumbnailContent []byte `protobuf:"bytes,2,opt,name=thumbnail_content,json=thumbnailContent,proto3" json:"thumbnail_content,omitempty"` // Thumbnail content as bytes + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status or informational message about the thumbnail generation. + ThumbnailContent []byte `protobuf:"bytes,2,opt,name=thumbnail_content,json=thumbnailContent,proto3" json:"thumbnail_content,omitempty"` // Base64-encoded bytes of the generated thumbnail image. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -197,12 +203,16 @@ func (x *ThumbnailResponse) GetThumbnailContent() []byte { return nil } -// create a ocred version of a document +// Request message for OCR processing. +// +// The file_content must be a base64-encoded file. +// The cleanUp flag indicates if whitespace normalization and character cleanup +// should be applied to the extracted text. type OCRFileRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` //file - FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` //file type for future adding of maybe other stuff? - CleanUp bool `protobuf:"varint,3,opt,name=cleanUp,proto3" json:"cleanUp,omitempty"` // if whitespace should be normalized and cleaned from "useless chars" + FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // Base64-encoded bytes of the file to OCR. + FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // Type of the file for future extensibility. + CleanUp bool `protobuf:"varint,3,opt,name=cleanUp,proto3" json:"cleanUp,omitempty"` // Whether to normalize whitespace and remove unnecessary characters. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -258,12 +268,15 @@ func (x *OCRFileRequest) GetCleanUp() bool { return false } -// Response message of ocred document +// Response message for OCR processing. +// +// Contains a status message, the OCRed file content as bytes, and +// the extracted text content as a string. type OCRFileResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status Message - OcrContent []byte `protobuf:"bytes,2,opt,name=ocr_content,json=ocrContent,proto3" json:"ocr_content,omitempty"` //data of the ocred file - TextContent string `protobuf:"bytes,3,opt,name=text_content,json=textContent,proto3" json:"text_content,omitempty"` //text of the file + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status message about the OCR operation. + OcrContent []byte `protobuf:"bytes,2,opt,name=ocr_content,json=ocrContent,proto3" json:"ocr_content,omitempty"` // Base64-encoded bytes of the OCR processed file. + TextContent string `protobuf:"bytes,3,opt,name=text_content,json=textContent,proto3" json:"text_content,omitempty"` // Extracted text content from the file. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } diff --git a/client/proto/thumbnail_grpc.pb.go b/client/proto/thumbnail_grpc.pb.go index 131b10e..77c7d67 100644 --- a/client/proto/thumbnail_grpc.pb.go +++ b/client/proto/thumbnail_grpc.pb.go @@ -27,9 +27,13 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // -// Service definition +// Service providing thumbnail generation and OCR functionalities. type ThumbnailServiceClient interface { + // Generates a thumbnail image from a given file. + // Accepts a ThumbnailRequest and returns a ThumbnailResponse. GenerateThumbnail(ctx context.Context, in *ThumbnailRequest, opts ...grpc.CallOption) (*ThumbnailResponse, error) + // Performs OCR (Optical Character Recognition) on a provided file. + // Accepts an OCRFileRequest and returns an OCRFileResponse. OcrFile(ctx context.Context, in *OCRFileRequest, opts ...grpc.CallOption) (*OCRFileResponse, error) } @@ -65,9 +69,13 @@ func (c *thumbnailServiceClient) OcrFile(ctx context.Context, in *OCRFileRequest // All implementations must embed UnimplementedThumbnailServiceServer // for forward compatibility. // -// Service definition +// Service providing thumbnail generation and OCR functionalities. type ThumbnailServiceServer interface { + // Generates a thumbnail image from a given file. + // Accepts a ThumbnailRequest and returns a ThumbnailResponse. GenerateThumbnail(context.Context, *ThumbnailRequest) (*ThumbnailResponse, error) + // Performs OCR (Optical Character Recognition) on a provided file. + // Accepts an OCRFileRequest and returns an OCRFileResponse. OcrFile(context.Context, *OCRFileRequest) (*OCRFileResponse, error) mustEmbedUnimplementedThumbnailServiceServer() } diff --git a/server/proto/thumbnail.pb.go b/server/proto/thumbnail.pb.go index 3a6e842..b636454 100644 --- a/server/proto/thumbnail.pb.go +++ b/server/proto/thumbnail.pb.go @@ -22,14 +22,14 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Enum for the file type +// Enum representing the supported file types for processing. type FileType int32 const ( - FileType_FILE_TYPE_UNSPECIFIED FileType = 0 // Default value for unspecified file type - FileType_IMAGE FileType = 1 // Image file - FileType_VIDEO FileType = 2 // Video file - FileType_PDF FileType = 3 // PDF file + FileType_FILE_TYPE_UNSPECIFIED FileType = 0 // Default value when file type is not specified. + FileType_IMAGE FileType = 1 // Represents an image file type. + FileType_VIDEO FileType = 2 // Represents a video file type. + FileType_PDF FileType = 3 // Represents a PDF file type. ) // Enum value maps for FileType. @@ -75,13 +75,17 @@ func (FileType) EnumDescriptor() ([]byte, []int) { return file_thumbnail_proto_rawDescGZIP(), []int{0} } -// Request message for generating thumbnails +// Request message for thumbnail generation. +// +// The file_content must be a base64-encoded file (image, video, or PDF). +// Optional max_width and max_height can be provided to resize the thumbnail +// (values of 0 mean no resizing constraints). type ThumbnailRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // File content as bytes - FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // File type (image, video, pdf) - MaxWidth int32 `protobuf:"varint,3,opt,name=max_width,json=maxWidth,proto3" json:"max_width,omitempty"` // Optional max width for resizing (0 means no limit) - MaxHeight int32 `protobuf:"varint,4,opt,name=max_height,json=maxHeight,proto3" json:"max_height,omitempty"` // Optional max height for resizing (0 means no limit) + FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // Base64-encoded bytes of the file to process. + FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // Specifies the type of the file. + MaxWidth int32 `protobuf:"varint,3,opt,name=max_width,json=maxWidth,proto3" json:"max_width,omitempty"` // Maximum width of the generated thumbnail; 0 means no limit. + MaxHeight int32 `protobuf:"varint,4,opt,name=max_height,json=maxHeight,proto3" json:"max_height,omitempty"` // Maximum height of the generated thumbnail; 0 means no limit. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -144,11 +148,13 @@ func (x *ThumbnailRequest) GetMaxHeight() int32 { return 0 } -// Response message for the thumbnail generation +// Response message for thumbnail generation. +// +// Contains a status message and the generated thumbnail as base64-encoded bytes. type ThumbnailResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Message indicating success or failure - ThumbnailContent []byte `protobuf:"bytes,2,opt,name=thumbnail_content,json=thumbnailContent,proto3" json:"thumbnail_content,omitempty"` // Thumbnail content as bytes + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status or informational message about the thumbnail generation. + ThumbnailContent []byte `protobuf:"bytes,2,opt,name=thumbnail_content,json=thumbnailContent,proto3" json:"thumbnail_content,omitempty"` // Base64-encoded bytes of the generated thumbnail image. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -197,12 +203,16 @@ func (x *ThumbnailResponse) GetThumbnailContent() []byte { return nil } -// create a ocred version of a document +// Request message for OCR processing. +// +// The file_content must be a base64-encoded file. +// The cleanUp flag indicates if whitespace normalization and character cleanup +// should be applied to the extracted text. type OCRFileRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` //file - FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` //file type for future adding of maybe other stuff? - CleanUp bool `protobuf:"varint,3,opt,name=cleanUp,proto3" json:"cleanUp,omitempty"` // if whitespace should be normalized and cleaned from "useless chars" + FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // Base64-encoded bytes of the file to OCR. + FileType FileType `protobuf:"varint,2,opt,name=file_type,json=fileType,proto3,enum=thumbnail_service.FileType" json:"file_type,omitempty"` // Type of the file for future extensibility. + CleanUp bool `protobuf:"varint,3,opt,name=cleanUp,proto3" json:"cleanUp,omitempty"` // Whether to normalize whitespace and remove unnecessary characters. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -258,12 +268,15 @@ func (x *OCRFileRequest) GetCleanUp() bool { return false } -// Response message of ocred document +// Response message for OCR processing. +// +// Contains a status message, the OCRed file content as bytes, and +// the extracted text content as a string. type OCRFileResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status Message - OcrContent []byte `protobuf:"bytes,2,opt,name=ocr_content,json=ocrContent,proto3" json:"ocr_content,omitempty"` //data of the ocred file - TextContent string `protobuf:"bytes,3,opt,name=text_content,json=textContent,proto3" json:"text_content,omitempty"` //text of the file + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Status message about the OCR operation. + OcrContent []byte `protobuf:"bytes,2,opt,name=ocr_content,json=ocrContent,proto3" json:"ocr_content,omitempty"` // Base64-encoded bytes of the OCR processed file. + TextContent string `protobuf:"bytes,3,opt,name=text_content,json=textContent,proto3" json:"text_content,omitempty"` // Extracted text content from the file. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } diff --git a/server/proto/thumbnail_grpc.pb.go b/server/proto/thumbnail_grpc.pb.go index 131b10e..77c7d67 100644 --- a/server/proto/thumbnail_grpc.pb.go +++ b/server/proto/thumbnail_grpc.pb.go @@ -27,9 +27,13 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // -// Service definition +// Service providing thumbnail generation and OCR functionalities. type ThumbnailServiceClient interface { + // Generates a thumbnail image from a given file. + // Accepts a ThumbnailRequest and returns a ThumbnailResponse. GenerateThumbnail(ctx context.Context, in *ThumbnailRequest, opts ...grpc.CallOption) (*ThumbnailResponse, error) + // Performs OCR (Optical Character Recognition) on a provided file. + // Accepts an OCRFileRequest and returns an OCRFileResponse. OcrFile(ctx context.Context, in *OCRFileRequest, opts ...grpc.CallOption) (*OCRFileResponse, error) } @@ -65,9 +69,13 @@ func (c *thumbnailServiceClient) OcrFile(ctx context.Context, in *OCRFileRequest // All implementations must embed UnimplementedThumbnailServiceServer // for forward compatibility. // -// Service definition +// Service providing thumbnail generation and OCR functionalities. type ThumbnailServiceServer interface { + // Generates a thumbnail image from a given file. + // Accepts a ThumbnailRequest and returns a ThumbnailResponse. GenerateThumbnail(context.Context, *ThumbnailRequest) (*ThumbnailResponse, error) + // Performs OCR (Optical Character Recognition) on a provided file. + // Accepts an OCRFileRequest and returns an OCRFileResponse. OcrFile(context.Context, *OCRFileRequest) (*OCRFileResponse, error) mustEmbedUnimplementedThumbnailServiceServer() } diff --git a/server/swagger/thumbnail.swagger.json b/server/swagger/thumbnail.swagger.json index d1729c5..f1a4a12 100644 --- a/server/swagger/thumbnail.swagger.json +++ b/server/swagger/thumbnail.swagger.json @@ -18,6 +18,7 @@ "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": { @@ -36,6 +37,7 @@ "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": { @@ -50,6 +52,7 @@ }, "/v1/thumbnail": { "post": { + "summary": "Generates a thumbnail image from a given file.\nAccepts a ThumbnailRequest and returns a ThumbnailResponse.", "operationId": "ThumbnailService_GenerateThumbnail", "responses": { "200": { @@ -68,6 +71,7 @@ "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": { @@ -119,8 +123,7 @@ "PDF" ], "default": "FILE_TYPE_UNSPECIFIED", - "description": "- FILE_TYPE_UNSPECIFIED: Default value for unspecified file type\n - IMAGE: Image file\n - VIDEO: Video file\n - PDF: PDF file", - "title": "Enum for the file type" + "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", @@ -128,37 +131,37 @@ "fileContent": { "type": "string", "format": "byte", - "title": "file" + "description": "Base64-encoded bytes of the file to OCR." }, "fileType": { "$ref": "#/definitions/thumbnail_serviceFileType", - "title": "file type for future adding of maybe other stuff?" + "description": "Type of the file for future extensibility." }, "cleanUp": { "type": "boolean", - "title": "if whitespace should be normalized and cleaned from \"useless chars\"" + "description": "Whether to normalize whitespace and remove unnecessary characters." } }, - "title": "create a ocred version of a document" + "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", - "title": "Status Message" + "description": "Status message about the OCR operation." }, "ocrContent": { "type": "string", "format": "byte", - "title": "data of the ocred file" + "description": "Base64-encoded bytes of the OCR processed file." }, "textContent": { "type": "string", - "title": "text of the file" + "description": "Extracted text content from the file." } }, - "title": "Response message of ocred document" + "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", @@ -166,39 +169,39 @@ "fileContent": { "type": "string", "format": "byte", - "title": "File content as bytes" + "description": "Base64-encoded bytes of the file to process." }, "fileType": { "$ref": "#/definitions/thumbnail_serviceFileType", - "title": "File type (image, video, pdf)" + "description": "Specifies the type of the file." }, "maxWidth": { "type": "integer", "format": "int32", - "title": "Optional max width for resizing (0 means no limit)" + "description": "Maximum width of the generated thumbnail; 0 means no limit." }, "maxHeight": { "type": "integer", "format": "int32", - "title": "Optional max height for resizing (0 means no limit)" + "description": "Maximum height of the generated thumbnail; 0 means no limit." } }, - "title": "Request message for generating thumbnails" + "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", - "title": "Message indicating success or failure" + "description": "Status or informational message about the thumbnail generation." }, "thumbnailContent": { "type": "string", "format": "byte", - "title": "Thumbnail content as bytes" + "description": "Base64-encoded bytes of the generated thumbnail image." } }, - "title": "Response message for the thumbnail generation" + "description": "Response message for thumbnail generation.\n\nContains a status message and the generated thumbnail as base64-encoded bytes." } } } diff --git a/thumbnail.proto b/thumbnail.proto index bbd9a80..338d3b2 100644 --- a/thumbnail.proto +++ b/thumbnail.proto @@ -6,22 +6,27 @@ option go_package = "./proto"; import "google/api/annotations.proto"; -// Enum for the file type +// Enum representing the supported file types for processing. enum FileType { - FILE_TYPE_UNSPECIFIED = 0; // Default value for unspecified file type - IMAGE = 1; // Image file - VIDEO = 2; // Video file - PDF = 3; // PDF file + FILE_TYPE_UNSPECIFIED = 0; // Default value when file type is not specified. + IMAGE = 1; // Represents an image file type. + VIDEO = 2; // Represents a video file type. + PDF = 3; // Represents a PDF file type. } -// Service definition +// Service providing thumbnail generation and OCR functionalities. service ThumbnailService { + // Generates a thumbnail image from a given file. + // Accepts a ThumbnailRequest and returns a ThumbnailResponse. rpc GenerateThumbnail(ThumbnailRequest) returns (ThumbnailResponse) { option (google.api.http) = { post: "/v1/thumbnail" body: "*" }; } + + // Performs OCR (Optical Character Recognition) on a provided file. + // Accepts an OCRFileRequest and returns an OCRFileResponse. rpc OcrFile(OCRFileRequest) returns (OCRFileResponse) { option (google.api.http) = { post: "/v1/ocr" @@ -30,30 +35,43 @@ service ThumbnailService { } } -// Request message for generating thumbnails +// Request message for thumbnail generation. +// +// The file_content must be a base64-encoded file (image, video, or PDF). +// Optional max_width and max_height can be provided to resize the thumbnail +// (values of 0 mean no resizing constraints). message ThumbnailRequest { - bytes file_content = 1; // File content as bytes - FileType file_type = 2; // File type (image, video, pdf) - int32 max_width = 3; // Optional max width for resizing (0 means no limit) - int32 max_height = 4; // Optional max height for resizing (0 means no limit) + bytes file_content = 1; // Base64-encoded bytes of the file to process. + FileType file_type = 2; // Specifies the type of the file. + int32 max_width = 3; // Maximum width of the generated thumbnail; 0 means no limit. + int32 max_height = 4; // Maximum height of the generated thumbnail; 0 means no limit. } -// Response message for the thumbnail generation +// Response message for thumbnail generation. +// +// Contains a status message and the generated thumbnail as base64-encoded bytes. message ThumbnailResponse { - string message = 1; // Message indicating success or failure - bytes thumbnail_content = 2; // Thumbnail content as bytes + string message = 1; // Status or informational message about the thumbnail generation. + bytes thumbnail_content = 2; // Base64-encoded bytes of the generated thumbnail image. } -//create a ocred version of a document +// Request message for OCR processing. +// +// The file_content must be a base64-encoded file. +// The cleanUp flag indicates if whitespace normalization and character cleanup +// should be applied to the extracted text. message OCRFileRequest { - bytes file_content = 1; //file - FileType file_type = 2; //file type for future adding of maybe other stuff? - bool cleanUp = 3; // if whitespace should be normalized and cleaned from "useless chars" + bytes file_content = 1; // Base64-encoded bytes of the file to OCR. + FileType file_type = 2; // Type of the file for future extensibility. + bool cleanUp = 3; // Whether to normalize whitespace and remove unnecessary characters. } -//Response message of ocred document +// Response message for OCR processing. +// +// Contains a status message, the OCRed file content as bytes, and +// the extracted text content as a string. message OCRFileResponse { - string message = 1; // Status Message - bytes ocr_content = 2; //data of the ocred file - string text_content = 3; //text of the file -} \ No newline at end of file + string message = 1; // Status message about the OCR operation. + bytes ocr_content = 2; // Base64-encoded bytes of the OCR processed file. + string text_content = 3; // Extracted text content from the file. +}