Files
services/url/proto/url.proto
Asim Aslam d456ff28e1 fix url
2021-12-11 20:52:48 +00:00

53 lines
1020 B
Protocol Buffer

syntax = "proto3";
package url;
option go_package = "./proto;url";
service Url {
rpc Shorten(ShortenRequest) returns (ShortenResponse) {}
rpc List(ListRequest) returns (ListResponse) {}
rpc Proxy(ProxyRequest) returns (ProxyResponse) {}
}
// Shorten a long URL
message ShortenRequest {
// the url to shorten
string destinationURL = 1;
}
message ShortenResponse {
// the shortened url
string shortURL = 1;
}
message URLPair {
// destination url
string destinationURL = 1;
// shortened url
string shortURL = 2;
// time of creation
string created = 4;
}
// List all the shortened URLs
message ListRequest {
// filter by short URL, optional
string shortURL = 2;
}
message ListResponse {
repeated URLPair urlPairs = 1;
}
// Proxy returns the destination URL of a short URL.
message ProxyRequest {
// short url ID, without the domain, eg. if your short URL is
// `m3o.one/u/someshorturlid` then pass in `someshorturlid`
string shortURL = 1;
}
message ProxyResponse {
string destinationURL = 1;
}