Skip to content
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 your account

Finally deprecating the rest of NFT endpoints #381

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
20 changes: 0 additions & 20 deletions cmd/devices-api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os/signal"
"strings"
"syscall"
"time"

"github.com/DIMO-Network/devices-api/internal/config"
"github.com/DIMO-Network/devices-api/internal/constants"
Expand Down Expand Up @@ -41,7 +40,6 @@ import (
"github.com/goccy/go-json"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cache"
fiberrecover "github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/swagger"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
Expand Down Expand Up @@ -155,14 +153,6 @@ func startWebAPI(logger zerolog.Logger, settings *config.Settings, pdb db.Store,
StackTraceHandler: nil,
}))

cacheHandler := cache.New(cache.Config{
Next: func(c *fiber.Ctx) bool {
return c.Query("refresh") == "true"
},
Expiration: 1 * time.Minute,
CacheControl: true,
})

// application routes
app.Get("/", healthCheck)

Expand All @@ -171,16 +161,6 @@ func startWebAPI(logger zerolog.Logger, settings *config.Settings, pdb db.Store,
v1.Get("/swagger/*", swagger.HandlerDefault)
// Device Definitions
nftController := controllers.NewNFTController(settings, pdb.DBS, &logger, s3NFTServiceClient, ddSvc, scTaskSvc, teslaTaskService, ddIntSvc, ddaSvc, ipfsSvc)
v1.Get("/vehicle/:tokenID", nftController.GetNFTMetadata)
v1.Get("/vehicle/:tokenID/image", nftController.GetNFTImage)

v1.Get("/aftermarket/device/by-address/:address", nftController.GetAftermarketDeviceNFTMetadataByAddress)
v1.Get("/aftermarket/device/:tokenID", cacheHandler, nftController.GetAftermarketDeviceNFTMetadata)
v1.Get("/aftermarket/device/:tokenID/image", nftController.GetAftermarketDeviceNFTImage)

v1.Get("/synthetic/device/:tokenID", nftController.GetSyntheticDeviceNFTMetadata)

v1.Get("/integration/:tokenID", nftController.GetIntegrationNFTMetadata)

v1.Get("/countries", countriesController.GetSupportedCountries)
v1.Get("/countries/:countryCode", countriesController.GetCountry)
Expand Down
239 changes: 0 additions & 239 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,6 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/aftermarket/device/by-address/{address}": {
"get": {
"description": "Retrieves NFT metadata for a given aftermarket device, using the device's\nEthereum address.",
"produces": [
"application/json"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "string",
"description": "Ethereum address for the device.",
"name": "address",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_controllers.NFTMetadataResp"
}
},
"404": {
"description": "Not Found"
}
}
}
},
"/aftermarket/device/by-serial/{serial}": {
"get": {
"security": [
Expand Down Expand Up @@ -170,65 +139,6 @@ const docTemplate = `{
}
}
},
"/aftermarket/device/{tokenId}": {
"get": {
"description": "Retrieves NFT metadata for a given aftermarket device.",
"produces": [
"application/json"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "integer",
"description": "token id",
"name": "tokenId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_controllers.NFTMetadataResp"
}
},
"404": {
"description": "Not Found"
}
}
}
},
"/aftermarket/device/{tokenId}/image": {
"get": {
"description": "Returns the image for the given aftermarket device NFT.",
"produces": [
"image/png"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "integer",
"description": "token id",
"name": "tokenId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
}
}
}
},
"/countries": {
"get": {
"description": "Returns all the supported countries",
Expand Down Expand Up @@ -465,28 +375,6 @@ const docTemplate = `{
}
}
},
"/integration/{tokenID}": {
"get": {
"description": "gets an integration using its tokenID",
"produces": [
"application/json"
],
"tags": [
"integrations"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_controllers.NFTMetadataResp"
}
}
}
}
}
},
"/integration/{tokenID}/credentials": {
"post": {
"security": [
Expand Down Expand Up @@ -535,37 +423,6 @@ const docTemplate = `{
}
}
},
"/synthetic/device/{tokenId}": {
"get": {
"description": "Retrieves NFT metadata for a given synthetic device.",
"produces": [
"application/json"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "integer",
"description": "token id",
"name": "tokenId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_controllers.NFTMetadataResp"
}
},
"404": {
"description": "Not Found"
}
}
}
},
"/user/devices": {
"post": {
"security": [
Expand Down Expand Up @@ -2138,71 +1995,6 @@ const docTemplate = `{
}
}
}
},
"/vehicle/{tokenId}": {
"get": {
"description": "retrieves NFT metadata for a given tokenID",
"produces": [
"application/json"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "integer",
"description": "token id",
"name": "tokenId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_controllers.NFTMetadataResp"
}
},
"404": {
"description": "Not Found"
}
}
}
},
"/vehicle/{tokenId}/image": {
"get": {
"description": "Returns the image for the given vehicle NFT.",
"produces": [
"image/png"
],
"tags": [
"nfts"
],
"parameters": [
{
"type": "integer",
"description": "token id",
"name": "tokenId",
"in": "path",
"required": true
},
{
"type": "boolean",
"description": "whether to remove the image background",
"name": "transparent",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -2978,17 +2770,6 @@ const docTemplate = `{
}
}
},
"internal_controllers.NFTAttribute": {
"type": "object",
"properties": {
"trait_type": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"internal_controllers.NFTImageData": {
"type": "object",
"required": [
Expand All @@ -3005,26 +2786,6 @@ const docTemplate = `{
}
}
},
"internal_controllers.NFTMetadataResp": {
"type": "object",
"properties": {
"attributes": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_controllers.NFTAttribute"
}
},
"description": {
"type": "string"
},
"image": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"internal_controllers.Privilege": {
"type": "object",
"properties": {
Expand Down
Loading
Loading