8000 Add descriptions to LinkConfig object by flamion · Pull Request #21 · soft-duck/shorty · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add descriptions to LinkConfig object #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to y 8000 our account

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 72 additions & 22 deletions meta/docs/api.yaml
Original file line number Diff line number Diff line change
@@ -1,94 +1,144 @@
swagger: "2.0"
info:
description: "Small link shortener"
version: "0.5.0"
version: "0.6.0"
title: "shorty"
contact:
name: "flamion"
email: "flamion@protonmail.com"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "s.u-are.gay"
basePath: "/"
tags:
- name: "/"
description: ""
- name: "custom"
description: "Allows advanced configuration."
- name: "/"
description: ""
- name: "custom"
description: "Allows advanced configuration."
schemes:
- "https"
- "http"
- "https"
paths:
# better parameter name
/{url}:
post:
tags:
- "/"
- "/"
summary: "Create a simple, unconfigured shortened link."
description: "Creates a shortened link with the configuration specifics chosen by the server."
produces:
- "text/plain; charset=utf-8"
- "text/plain; charset=utf-8"
parameters:
- in: "path"
name: "url"
description: "The url to shorten"
required: true
type: "string"
- in: "path"
name: "url"
description: "The url to shorten"
required: true
type: "string"
responses:
"200":
description: "The url was successfully shortened"
get:
tags:
- "/"
- "/"
summary: "Redirect to the aliased url"
description: "Redirect to the aliased url"
parameters:
- in: "path"
name: "url"
description: "The id of the aliased url"
required: true
type: "string"
- in: "path"
name: "url"
description: "The id of the aliased url"
required: true
type: "string"
responses:
"307":
description: "Redirection to aliased url"
"404":
description: "Shortened ID couldn't be found or was expired"

/custom:
post:
tags:
- "custom"
summary: "Advanced url shortening"
description: "Shortens a URL, allowing for advanced configuration."
produces:
- "text/plain; charset=utf-8"
- "text/plain; charset=utf-8"

parameters:
- in: body
name: user
required: true
description: "The settings for the url to alias"
schema:
$ref: "#/definitions/LinkConfig"

responses:
"200":
description: "The url was successfully registered as an alias and is now retrievable with at the get endpoint"
"400":
description: "Json is malformed, the link exceeds the max length allowed by the server or the link was empty"
"409":
description: "The specified ID is already in use"

/config:
get:
tags:
- "config"
summary: "Retrieve server config"
description: "Retrieves the servers configuration details."
produces:
- "application/json; charset=utf-8"

responses:
"200":
description: "The server config as json"
schema:
$ref: "#/definitions/Config"


definitions:
LinkConfig:
type: "object"
properties:
link:
type: "string"
description: "The link that should be shortened."
id:
type: "string"
description: "Custom ID for a link."
max_uses:
type: "integer"
format: "int64"
description: "Maximum uses before the link expires."
valid_for:
type: "integer"
format: "int64"
description: "How long in milliseconds the link should be valid for."
required:
- link

Config:
type: "object"
properties:
public_url:
type: "string"
description: "The URL the server prefixes to shortened link IDs."
max_link_length:
type: "integer"
format: "int64"
description: "Maximum length allowed for a link in chars."
max_json_size:
type: "integer"
format: "int64"
description: "Maximum allowed Json size in bytes."
max_custom_id_length:
type: "integer"
format: "int64"
description: "Maximum custom ID length in chars."
default_max_uses:
type: "integer"
format: "int64"
description: "The default maximum uses for a link."
default_valid_for:
type: "integer"
format: "int64"
description: "The default duration a link is valid for in milliseconds."
0