Files
services/url/proto/url.proto
Dominic Wong 15853a4198 rename param
2022-03-01 16:58:44 +00:00

55 lines
1.1 KiB
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;
// The number of times the short URL has been resolved
int64 hitCount = 5;
}
// 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;
}