From 93797410897cabc3313569e00bf3d27f54a79990 Mon Sep 17 00:00:00 2001 From: Artem Date: Thu, 12 Sep 2024 11:52:06 +0300 Subject: [PATCH] Fix: make /v1/blob authorizable in docs --- cmd/api/docs/swagger.json | 2 +- cmd/api/handler/namespace.go | 31 ++++++++++++++++++------------- cmd/api/main.go | 34 +++++++++++++++++----------------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/cmd/api/docs/swagger.json b/cmd/api/docs/swagger.json index e18f3d6..ff17d57 100644 --- a/cmd/api/docs/swagger.json +++ b/cmd/api/docs/swagger.json @@ -1164,7 +1164,7 @@ } }, "post": { - "description": "Returns blob", + "description": "Returns blob\nTo authorize your requests you have to select the required tariff on our site. Then you receive api key to authorize. Api key should be passed via request header `apikey`.", "consumes": [ "application/json" ], diff --git a/cmd/api/handler/namespace.go b/cmd/api/handler/namespace.go index 7aa4c05..3d81e05 100644 --- a/cmd/api/handler/namespace.go +++ b/cmd/api/handler/namespace.go @@ -435,7 +435,7 @@ func (req listBlobsRequest) toDbRequest(ctx context.Context, ns storage.INamespa // @Param from query integer false "Time from in unix timestamp" mininum(1) // @Param to query integer false "Time to in unix timestamp" mininum(1) // @Param signers query string false "Comma-separated celestia addresses" -// @Param namespaces query string false "Comma-separated celestia namespaces" +// @Param namespaces query string false "Comma-separated celestia namespaces" // @Param cursor query integer false "Last entity id which is used for cursor pagination" mininum(1) // @Accept json // @Produce json @@ -475,18 +475,23 @@ type postBlobRequest struct { // Blob godoc // -// @Summary Get namespace blob by commitment on height -// @Description Returns blob -// @Tags namespace -// @ID get-blob -// @Param hash body string true "Base64-encoded namespace id and version" -// @Param height body integer true "Block heigth" minimum(1) -// @Param commitment body string true "Blob commitment" -// @Accept json -// @Produce json -// @Success 200 {object} responses.Blob -// @Failure 400 {object} Error -// @Router /blob [post] +// @Summary Get namespace blob by commitment on height +// @Description Returns blob +// @Tags namespace +// @ID get-blob +// @Param hash body string true "Base64-encoded namespace id and version" +// @Param height body integer true "Block heigth" minimum(1) +// @Param commitment body string true "Blob commitment" +// @Accept json +// @Produce json +// @Success 200 {object} responses.Blob +// @Failure 400 {object} Error +// @Router /blob [post] +// +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name apikey +// @description To authorize your requests you have to select the required tariff on our site. Then you receive api key to authorize. Api key should be passed via request header `apikey`. func (handler *NamespaceHandler) Blob(c echo.Context) error { req, err := bindAndValidate[postBlobRequest](c) if err != nil { diff --git a/cmd/api/main.go b/cmd/api/main.go index 6247ad2..89c8c21 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -19,27 +19,27 @@ var rootCmd = &cobra.Command{ Short: "DipDup Verticals | Celenium API", } -// @title Celenium API -// @version 1.0 -// @description Celenium API is a powerful tool to access all blockchain data that is processed and indexed by our proprietary indexer. With Celenium API you can retrieve all historical data, off-chain data, blobs and statistics through our REST API. Celenium API indexer are open source, which allows you to not depend on third-party services. You can clone, build and run them independently, giving you full control over all components. If you have any questions or feature requests, please feel free to contact us. We appreciate your feedback! -// @host api-mainnet.celenium.io -// @schemes https -// @BasePath /v1 +// @title Celenium API +// @version 1.0 +// @description Celenium API is a powerful tool to access all blockchain data that is processed and indexed by our proprietary indexer. With Celenium API you can retrieve all historical data, off-chain data, blobs and statistics through our REST API. Celenium API indexer are open source, which allows you to not depend on third-party services. You can clone, build and run them independently, giving you full control over all components. If you have any questions or feature requests, please feel free to contact us. We appreciate your feedback! +// @host api-mainnet.celenium.io +// @schemes https +// @BasePath /v1 // -// @contact.name Support -// @contact.url https://discord.gg/3k83Przqk8 -// @contact.email celenium@pklabs.me +// @contact.name Support +// @contact.url https://discord.gg/3k83Przqk8 +// @contact.email celenium@pklabs.me // -// @externalDocs.description Full documentation -// @externalDocs.url https://api-docs.celenium.io/ +// @externalDocs.description Full documentation +// @externalDocs.url https://api-docs.celenium.io/ // -// @x-servers [{"url": "api-mainnet.celenium.io", "description": "Celenium Mainnet API"},{"url": "api-mocha.celenium.io", "description": "Celenium Mocha API"},{"url": "api-arabica.celenium.io", "description": "Celenium Arabica API"}] -// @query.collection.format multi +// @x-servers [{"url": "api-mainnet.celenium.io", "description": "Celenium Mainnet API"},{"url": "api-mocha.celenium.io", "description": "Celenium Mocha API"},{"url": "api-arabica.celenium.io", "description": "Celenium Arabica API"}] +// @query.collection.format multi // -// @securityDefinitions.apikey ApiKeyAuth -// @in header -// @name apikey -// @description To authorize your requests you have to select the required tariff on our site. Then you receive api key to authorize. Api key should be passed via request header `apikey`. +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name apikey +// @description To authorize your requests you have to select the required tariff on our site. Then you receive api key to authorize. Api key should be passed via request header `apikey`. func main() { cfg, err := initConfig() if err != nil {