mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
53 lines
1016 B
Protocol Buffer
53 lines
1016 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 urls = 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;
|
|
}
|