Files
services/url/proto/url.proto
2021-05-18 10:26:53 +01:00

50 lines
1.1 KiB
Protocol Buffer

syntax = "proto3";
package url;
option go_package = "github.com/micro/services/url/proto;url";
service Url {
rpc Shorten(ShortenRequest) returns (ShortenResponse) {}
rpc List(ListRequest) returns (ListResponse) {}
rpc Proxy(ProxyRequest) returns (ProxyResponse) {}
}
// Shortens a destination URL and returns a full short URL.
message ShortenRequest {
string destinationURL = 1;
}
message ShortenResponse {
string shortURL = 1;
}
message URLPair {
string destinationURL = 1;
string shortURL = 2;
string owner = 3;
int64 created = 4;
}
// List shortened URLs. It has no input parameters, as it will take
// the user ID from the token and list the user's (caller's) shortened URLs.
message ListRequest {
}
message ListResponse {
repeated URLPair urlPairs = 1;
}
// Proxy returns the destination URL of a short URL.
// Proxy resolves even URLs not owned by the token holder,
// unlike the List endpoint.
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;
}