Files
services/image/proto/image.proto
Janos Dobronszki e563d6114b Image service (#89)
2021-05-05 11:15:40 +01:00

67 lines
2.1 KiB
Protocol Buffer

syntax = "proto3";
package image;
option go_package = "github.com/micro/services/images/proto;image";
service Image {
rpc Upload(UploadRequest) returns (UploadResponse) {}
rpc Resize(ResizeRequest) returns (ResizeResponse) {}
rpc Convert(ConvertRequest) returns (ConvertResponse) {}
}
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
message UploadRequest {
// Base64 encoded image to upload,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
string base64 = 1;
// URL of the image to upload
string url = 2;
// Output name of the image including extension, ie. "cat.png"
string imageID = 3;
}
message UploadResponse {
string url = 1;
}
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
message ResizeRequest {
// base64 encoded image to resize,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
string base64 = 1;
// url of the image to resize
string url = 2;
// output name of the image including extension, ie. "cat.png"
string imageID = 3;
// make output a URL and not a base64 response
bool outputURL = 4;
int64 width = 5;
int64 height = 6;
}
message ResizeResponse {
string base64 = 1;
string url = 2;
}
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
message ConvertRequest {
// base64 encoded image to resize,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
string base64 = 1;
// url of the image to resize
string url = 2;
// output name of the image including extension, ie. "cat.png"
string imageID = 3;
// make output a URL and not a base64 response
bool outputURL = 4;
}
message ConvertResponse {
string base64 = 1;
string url = 2;
}