-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from blinklabs-io/feat-swagger
feat: swagger using swaggo/swag and gin-swagger
- Loading branch information
Showing
8 changed files
with
582 additions
and
15 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
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
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,177 @@ | ||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"contact": { | ||
"name": "Blink Labs", | ||
"url": "https://blinklabs.io", | ||
"email": "support@blinklabs.io" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": { | ||
"/fcm": { | ||
"post": { | ||
"description": "Store a new FCM token", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Store FCM Token", | ||
"parameters": [ | ||
{ | ||
"description": "FCM Token Request", | ||
"name": "body", | ||
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/push.TokenRequest" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"201": { | ||
"description": "Created", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"400": { | ||
"description": "Bad Request", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/fcm/{token}": { | ||
"get": { | ||
"description": "Get an FCM token by its value", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Get FCM Token", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "FCM Token", | ||
"name": "token", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/push.TokenResponse" | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"description": "Delete an FCM token by its value", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Delete FCM Token", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "FCM Token", | ||
"name": "token", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"204": { | ||
"description": "No Content", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"push.ErrorResponse": { | ||
"type": "object", | ||
"properties": { | ||
"error": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"push.TokenRequest": { | ||
"type": "object", | ||
"required": [ | ||
"fcmToken" | ||
], | ||
"properties": { | ||
"fcmToken": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"push.TokenResponse": { | ||
"type": "object", | ||
"properties": { | ||
"fcmToken": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
}` | ||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo = &swag.Spec{ | ||
Version: "v1", | ||
Host: "", | ||
BasePath: "/v1", | ||
Schemes: []string{"http"}, | ||
Title: "Snek API", | ||
Description: "Snek API", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
} |
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,157 @@ | ||
{ | ||
"schemes": [ | ||
"http" | ||
], | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "Snek API", | ||
"title": "Snek API", | ||
"contact": { | ||
"name": "Blink Labs", | ||
"url": "https://blinklabs.io", | ||
"email": "support@blinklabs.io" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "v1" | ||
}, | ||
"basePath": "/v1", | ||
"paths": { | ||
"/fcm": { | ||
"post": { | ||
"description": "Store a new FCM token", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Store FCM Token", | ||
"parameters": [ | ||
{ | ||
"description": "FCM Token Request", | ||
"name": "body", | ||
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/push.TokenRequest" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"201": { | ||
"description": "Created", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"400": { | ||
"description": "Bad Request", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/fcm/{token}": { | ||
"get": { | ||
"description": "Get an FCM token by its value", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Get FCM Token", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "FCM Token", | ||
"name": "token", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/push.TokenResponse" | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"description": "Delete an FCM token by its value", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Delete FCM Token", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "FCM Token", | ||
"name": "token", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"204": { | ||
"description": "No Content", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"404": { | ||
"description": "Not Found", | ||
"schema": { | ||
"$ref": "#/definitions/push.ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"push.ErrorResponse": { | ||
"type": "object", | ||
"properties": { | ||
"error": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"push.TokenRequest": { | ||
"type": "object", | ||
"required": [ | ||
"fcmToken" | ||
], | ||
"properties": { | ||
"fcmToken": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"push.TokenResponse": { | ||
"type": "object", | ||
"properties": { | ||
"fcmToken": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.