Skip to content

Commit

Permalink
swagger, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
golangisfun123 committed May 1, 2024
1 parent 01f8b57 commit 7f81c14
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 7 deletions.
1 change: 0 additions & 1 deletion contrib/screener-api/db/sql/base/namer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
)

func init() {
// idk what this is
namer := dbcommon.NewNamer(GetAllModels())

addressName = namer.GetConsistentName("Address")
Expand Down
53 changes: 52 additions & 1 deletion contrib/screener-api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,58 @@ const docTemplate = `{
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {}
"paths": {
"/api/data/sync": {
"post": {
"description": "blacklist an address",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "blacklist an address",
"parameters": [
{
"type": "string",
"description": "Application ID",
"name": "appid",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Timestamp of the request",
"name": "timestamp",
"in": "header",
"required": true
},
{
"type": "string",
"description": "A unique nonce for the request",
"name": "nonce",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Query string parameters included in the request",
"name": "queryString",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Signature for request validation",
"name": "signature",
"in": "header",
"required": true
}
],
"responses": {}
}
}
}
}`

// SwaggerInfo holds exported Swagger Info so clients can modify it
Expand Down
53 changes: 52 additions & 1 deletion contrib/screener-api/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,56 @@
"info": {
"contact": {}
},
"paths": {}
"paths": {
"/api/data/sync": {
"post": {
"description": "blacklist an address",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "blacklist an address",
"parameters": [
{
"type": "string",
"description": "Application ID",
"name": "appid",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Timestamp of the request",
"name": "timestamp",
"in": "header",
"required": true
},
{
"type": "string",
"description": "A unique nonce for the request",
"name": "nonce",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Query string parameters included in the request",
"name": "queryString",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Signature for request validation",
"name": "signature",
"in": "header",
"required": true
}
],
"responses": {}
}
}
}
}
37 changes: 36 additions & 1 deletion contrib/screener-api/docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
info:
contact: {}
paths: {}
paths:
/api/data/sync:
post:
consumes:
- application/json
description: blacklist an address
parameters:
- description: Application ID
in: header
name: appid
required: true
type: string
- description: Timestamp of the request
in: header
name: timestamp
required: true
type: string
- description: A unique nonce for the request
in: header
name: nonce
required: true
type: string
- description: Query string parameters included in the request
in: header
name: queryString
required: true
type: string
- description: Signature for request validation
in: header
name: signature
required: true
type: string
produces:
- application/json
responses: {}
summary: blacklist an address
swagger: "2.0"
2 changes: 2 additions & 0 deletions contrib/screener-api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ require (
github.com/ipfs/go-log v1.0.5
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
github.com/stretchr/testify v1.8.4
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.3
github.com/synapsecns/sanguine/core v0.0.0-00010101000000-000000000000
github.com/urfave/cli/v2 v2.27.1
Expand Down
7 changes: 7 additions & 0 deletions contrib/screener-api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uq
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/requestid v0.0.6 h1:mGcxTnHQ45F6QU5HQRgQUDsAfHprD3P7g2uZ4cSZo9o=
github.com/gin-contrib/requestid v0.0.6/go.mod h1:9i4vKATX/CdggbkY252dPVasgVucy/ggBeELXuQztm4=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
Expand Down Expand Up @@ -475,6 +477,10 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
Expand Down Expand Up @@ -667,6 +673,7 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
Expand Down
8 changes: 6 additions & 2 deletions contrib/screener-api/screener/screener.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ func (s *screenerImpl) fetchBlacklist(ctx context.Context) {
// @dev Protected Method
// @Summary blacklist an address
// @Description blacklist an address
// @Param request body appsecret appid timestamp nonce queryString BlackListBody
// @Param appid header string true "Application ID"
// @Param timestamp header string true "Timestamp of the request"
// @Param nonce header string true "A unique nonce for the request"
// @Param queryString header string true "Query string parameters included in the request"
// @Param signature header string true "Signature for request validation"
// @Accept json
// @Produce json
// @Router /api/data/sync [post]
// @Router /api/data/sync [post].
func (s *screenerImpl) blacklistAddress(c *gin.Context) {
var blacklistBody client.BlackListBody

Expand Down
1 change: 0 additions & 1 deletion contrib/screener-api/screener/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ func (s *ScreenerSuite) TestScreener() {
status, err = apiClient.BlacklistAddress(s.GetTestContext(), "bad", cfg.AppID, blacklistBody)
NotEqual(s.T(), "success", status)
NotNil(s.T(), err)

}

type mockClient struct {
Expand Down

0 comments on commit 7f81c14

Please sign in to comment.