diff --git a/cmd/api.go b/cmd/api.go index cde9b0e..99f5631 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -29,20 +29,12 @@ var ( // @title Thirdweb Insight // @version v0.0.1-beta // @description API for querying blockchain transactions and events -// @termsOfService http://swagger.io/terms/ - -// @contact.name Thirdweb Support -// @contact.url https://thirdweb.com/support -// @contact.email support@thirdweb.com - // @license.name Apache 2.0 // @license.url https://github.com/thirdweb-dev/indexer/blob/main/LICENSE - // @host localhost:3000 // @BasePath / - +// @Security BasicAuth // @securityDefinitions.basic BasicAuth - func RunApi(cmd *cobra.Command, args []string) { r := gin.New() r.Use(gin.Logger()) diff --git a/docs/docs.go b/docs/docs.go index 3b3c7e2..e24cc84 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -10,6 +10,10 @@ const docTemplate = `{ "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "https://github.com/thirdweb-dev/indexer/blob/main/LICENSE" + }, "version": "{{.Version}}" }, "host": "{{.Host}}", @@ -934,17 +938,27 @@ const docTemplate = `{ } } } - } + }, + "securityDefinitions": { + "BasicAuth": { + "type": "basic" + } + }, + "security": [ + { + "BasicAuth": [] + } + ] }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ - Version: "", - Host: "", - BasePath: "", + Version: "v0.0.1-beta", + Host: "localhost:3000", + BasePath: "/", Schemes: []string{}, - Title: "", - Description: "", + Title: "Thirdweb Insight", + Description: "API for querying blockchain transactions and events", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/docs/swagger.json b/docs/swagger.json index 382b52b..c59a3fc 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1,8 +1,17 @@ { "swagger": "2.0", "info": { - "contact": {} + "description": "API for querying blockchain transactions and events", + "title": "Thirdweb Insight", + "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "https://github.com/thirdweb-dev/indexer/blob/main/LICENSE" + }, + "version": "v0.0.1-beta" }, + "host": "localhost:3000", + "basePath": "/", "paths": { "/{chainId}/events": { "get": { @@ -923,5 +932,15 @@ } } } - } + }, + "securityDefinitions": { + "BasicAuth": { + "type": "basic" + } + }, + "security": [ + { + "BasicAuth": [] + } + ] } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 4830041..0b558ba 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,3 +1,4 @@ +basePath: / definitions: api.Error: description: Error represents an API error response @@ -120,8 +121,15 @@ definitions: value: type: string type: object +host: localhost:3000 info: contact: {} + description: API for querying blockchain transactions and events + license: + name: Apache 2.0 + url: https://github.com/thirdweb-dev/indexer/blob/main/LICENSE + title: Thirdweb Insight + version: v0.0.1-beta paths: /{chainId}/events: get: @@ -592,4 +600,9 @@ paths: summary: Get transactions by contract and signature tags: - transactions +security: +- BasicAuth: [] +securityDefinitions: + BasicAuth: + type: basic swagger: "2.0"