-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created swagger in project for API doc
- Loading branch information
1 parent
601c493
commit 680d02a
Showing
8 changed files
with
705 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT | ||
// This file was generated by swaggo/swag | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "http://www.shortly.io/support", | ||
"email": "support@shortly.io" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": { | ||
"/api/v1/create": { | ||
"post": { | ||
"description": "It gives short URL", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"Create Short URL" | ||
], | ||
"summary": "Generate short URL", | ||
"parameters": [ | ||
{ | ||
"description": "Original URL is required", | ||
"name": "original_url", | ||
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/shortly.SaveRequestDTO" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/shortly.SaveResponseDTO" | ||
} | ||
}, | ||
"400": { | ||
"description": "Request body is not valid", | ||
"schema": { | ||
"$ref": "#/definitions/shortly.ErrResponseDTO" | ||
} | ||
}, | ||
"409": { | ||
"description": "URL is not valid", | ||
"schema": { | ||
"$ref": "#/definitions/shortly.ErrResponseDTO" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/health": { | ||
"get": { | ||
"description": "It helps server tracking", | ||
"produces": [ | ||
"text/plain" | ||
], | ||
"tags": [ | ||
"Health" | ||
], | ||
"summary": "Server Health", | ||
"responses": { | ||
"200": { | ||
"description": "" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/list": { | ||
"get": { | ||
"description": "It gives all shortly data", | ||
"tags": [ | ||
"All Shortly List" | ||
], | ||
"summary": "Get All Shortly List", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/db.Shortly" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/{code}": { | ||
"get": { | ||
"description": "It redirects from short URL to original URL", | ||
"tags": [ | ||
"Redirect" | ||
], | ||
"summary": "Short URL", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Shortly Code", | ||
"name": "code", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "" | ||
}, | ||
"404": { | ||
"description": "Not found", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"put": { | ||
"description": "It redirects from short URL to original URL", | ||
"tags": [ | ||
"Redirect" | ||
], | ||
"summary": "Short URL", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Shortly Code", | ||
"name": "code", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "" | ||
}, | ||
"404": { | ||
"description": "Not found", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"post": { | ||
"description": "It redirects from short URL to original URL", | ||
"tags": [ | ||
"Redirect" | ||
], | ||
"summary": "Short URL", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Shortly Code", | ||
"name": "code", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "" | ||
}, | ||
"404": { | ||
"description": "Not found", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"description": "It redirects from short URL to original URL", | ||
"tags": [ | ||
"Redirect" | ||
], | ||
"summary": "Short URL", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Shortly Code", | ||
"name": "code", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "" | ||
}, | ||
"404": { | ||
"description": "Not found", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"db.Shortly": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "string" | ||
}, | ||
"original_url": { | ||
"type": "string" | ||
}, | ||
"short_url": { | ||
"type": "string" | ||
}, | ||
"visit_count": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"shortly.ErrResponseDTO": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "integer" | ||
}, | ||
"error": { | ||
"type": "string" | ||
}, | ||
"message": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"shortly.SaveRequestDTO": { | ||
"type": "object", | ||
"properties": { | ||
"original_url": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"shortly.SaveResponseDTO": { | ||
"type": "object", | ||
"properties": { | ||
"short_url": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
}` | ||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo = &swag.Spec{ | ||
Version: "1.0", | ||
Host: "", | ||
BasePath: "", | ||
Schemes: []string{}, | ||
Title: "Shortly API DOC", | ||
Description: "Shortly is URL Shortener", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
} |
Oops, something went wrong.