48 lines
765 B
Plaintext
48 lines
765 B
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "5feet11"
|
|
author: "niku"
|
|
email: "nvdpoel01@gmail.com"
|
|
)
|
|
|
|
type (
|
|
ExpandReq {
|
|
ID string `path:"id"`
|
|
}
|
|
|
|
ExpandResp {
|
|
LongUrl string `json:"longUrl"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
ShortenReq {
|
|
LongUrl string `json:"longUrl"`
|
|
ExpiresAfter int64 `json:"expiresAfter,optional"`
|
|
}
|
|
|
|
ShortenResp {
|
|
ID string `json:"id"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
GetLinkResp {
|
|
ID string `json:"id"`
|
|
LongUrl string `json:"longUrl"`
|
|
CreatedAt string `json:"createdAt"`
|
|
Lifespan int64 `json:"lifespan"`
|
|
}
|
|
)
|
|
|
|
service fivefeeteleven-api {
|
|
@handler ExpandUrl
|
|
get /:id(ExpandReq) returns(ExpandResp)
|
|
|
|
@handler ShortenUrl
|
|
post /api/v1/links(ShortenReq) returns(ShortenResp)
|
|
|
|
@handler GetLink
|
|
get /api/v1/links/:id(ExpandReq) returns(GetLinkResp)
|
|
} |