diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 00e3ec15..7ceab15a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,14 +22,8 @@ jobs: - name: Test run: go test -v ./... - name: Swagger - run: | - go install github.com/swaggo/swag/cmd/swag@latest - swag init -g ./cmd/server/main.go - git config user.name devops - git config suer.email devops@aastar.xyz - git add ./docs - git commit -m "swagger updated" - git push + run: chmod +x ./.github/scripts/auto-swagger.sh && ./.github/scripts/auto-swagger.sh + name: Building And Testing diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 00000000..fb2d35ee --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,135 @@ +{ + "swagger": "2.0", + "info": { + "contact": { + "name": "AAStar Support", + "url": "https://aastar.xyz" + } + }, + "paths": { + "/api/auth": { + "post": { + "description": "Get AccessToken By ApiKey", + "consumes": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "parameters": [ + { + "description": "AccessToken Model", + "name": "credential", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ClientCredential" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/healthz": { + "get": { + "description": "Get Healthz", + "tags": [ + "Healthz" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/get-support-entrypoint": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "get the support entrypoint", + "consumes": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/get-support-strategy": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "get the support strategy", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/try-pay-user-operation": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "sponsor the userOp", + "consumes": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "definitions": { + "models.ClientCredential": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "JWT": { + "description": "Type 'Bearer \\\u003cTOKEN\\\u003e' to correctly set the AccessToken", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 00000000..783b7916 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,81 @@ +definitions: + models.ClientCredential: + properties: + apiKey: + type: string + type: object +info: + contact: + name: AAStar Support + url: https://aastar.xyz +paths: + /api/auth: + post: + consumes: + - application/json + description: Get AccessToken By ApiKey + parameters: + - description: AccessToken Model + in: body + name: credential + required: true + schema: + $ref: '#/definitions/models.ClientCredential' + responses: + "200": + description: OK + tags: + - Auth + /api/healthz: + get: + description: Get Healthz + responses: + "200": + description: OK + tags: + - Healthz + /api/v1/get-support-entrypoint: + get: + consumes: + - application/json + description: get the support entrypoint + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor + /api/v1/get-support-strategy: + get: + consumes: + - application/json + description: get the support strategy + produces: + - application/json + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor + /api/v1/try-pay-user-operation: + post: + consumes: + - application/json + description: sponsor the userOp + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor +securityDefinitions: + JWT: + description: Type 'Bearer \' to correctly set the AccessToken + in: header + name: Authorization + type: apiKey +swagger: "2.0"