mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
Document URL service (#107)
This commit is contained in:
33
url/examples.json
Normal file
33
url/examples.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"list": [{
|
||||
"title": "List your shortened URLs",
|
||||
"description": "List the token holder's shortened URLs",
|
||||
"request": {
|
||||
},
|
||||
"response": {
|
||||
"urlPairs": [{
|
||||
"shortURL": "https://m3o.one/u/f8f3f83f3f83g",
|
||||
"destinationURL": "https://mysite.com/this-is-a-rather-long-web-address",
|
||||
"owner": "owner-id"
|
||||
}]
|
||||
}
|
||||
}],
|
||||
"shorten": [{
|
||||
"title": "Shorten a long URL",
|
||||
"request": {
|
||||
"destinationURL": "https://mysite.com/this-is-a-rather-long-web-address"
|
||||
},
|
||||
"response": {
|
||||
"shortURL": "https://m3o.one/u/f8f3f83f3f83g"
|
||||
}
|
||||
}],
|
||||
"proxy": [{
|
||||
"title": "Resolve a short URL to a long destination URL",
|
||||
"request": {
|
||||
"shortURL": "f8f3f83f3f83g"
|
||||
},
|
||||
"response": {
|
||||
"destinationURL": "https://mysite.com/this-is-a-rather-long-web-address"
|
||||
}
|
||||
}]
|
||||
}
|
||||
@@ -10,6 +10,7 @@ service Url {
|
||||
rpc Proxy(ProxyRequest) returns (ProxyResponse) {}
|
||||
}
|
||||
|
||||
// Shortens a destination URL and returns a full short URL.
|
||||
message ShortenRequest {
|
||||
string destinationURL = 1;
|
||||
}
|
||||
@@ -24,6 +25,8 @@ message URLPair {
|
||||
string owner = 3;
|
||||
}
|
||||
|
||||
// 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 {
|
||||
}
|
||||
|
||||
@@ -31,7 +34,12 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user