mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-24 08:25:31 +00:00
Image service (#89)
This commit is contained in:
67
image/proto/image.proto
Normal file
67
image/proto/image.proto
Normal file
@@ -0,0 +1,67 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user