Skip to content

Commit d4139ed

Browse files
committed
add swagger
1 parent b733c67 commit d4139ed

File tree

8 files changed

+617
-66
lines changed

8 files changed

+617
-66
lines changed

docs/docs.go

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
// Package docs Code generated by swaggo/swag. DO NOT EDIT
2+
package docs
3+
4+
import "github.com/swaggo/swag"
5+
6+
const docTemplate = `{
7+
"schemes": {{ marshal .Schemes }},
8+
"swagger": "2.0",
9+
"info": {
10+
"description": "{{escape .Description}}",
11+
"title": "{{.Title}}",
12+
"contact": {},
13+
"version": "{{.Version}}"
14+
},
15+
"host": "{{.Host}}",
16+
"basePath": "{{.BasePath}}",
17+
"paths": {
18+
"/blocks": {
19+
"get": {
20+
"description": "Get a paginated list of sync blocks",
21+
"consumes": [
22+
"application/json"
23+
],
24+
"produces": [
25+
"application/json"
26+
],
27+
"tags": [
28+
"Blocks"
29+
],
30+
"summary": "Get sync blocks with pagination",
31+
"parameters": [
32+
{
33+
"type": "integer",
34+
"description": "Page number (default: 1)",
35+
"name": "page",
36+
"in": "query"
37+
},
38+
{
39+
"type": "integer",
40+
"description": "Page size (default: 10, max: 100)",
41+
"name": "pageSize",
42+
"in": "query"
43+
}
44+
],
45+
"responses": {
46+
"200": {
47+
"description": "code\": 200, \"msg\": \"success\", \"data\": {\"list\": []schema.SyncBlock, \"total\": int64, \"page\": int, \"pageSize\": int}",
48+
"schema": {
49+
"type": "object",
50+
"additionalProperties": true
51+
}
52+
}
53+
}
54+
}
55+
},
56+
"/blocks/relayedMessage/{hash}": {
57+
"get": {
58+
"description": "Get relayed message details using message hash",
59+
"consumes": [
60+
"application/json"
61+
],
62+
"produces": [
63+
"application/json"
64+
],
65+
"tags": [
66+
"Messages"
67+
],
68+
"summary": "Get relayed message by hash",
69+
"parameters": [
70+
{
71+
"type": "string",
72+
"description": "Message Hash",
73+
"name": "hash",
74+
"in": "path",
75+
"required": true
76+
}
77+
],
78+
"responses": {
79+
"200": {
80+
"description": "code\": 200, \"msg\": \"success\", \"data\": schema.SyncEvent",
81+
"schema": {
82+
"type": "object",
83+
"additionalProperties": true
84+
}
85+
}
86+
}
87+
}
88+
},
89+
"/blocks/sentMessage/{hash}": {
90+
"get": {
91+
"description": "Get sent message details using message hash",
92+
"consumes": [
93+
"application/json"
94+
],
95+
"produces": [
96+
"application/json"
97+
],
98+
"tags": [
99+
"Messages"
100+
],
101+
"summary": "Get sent message by hash",
102+
"parameters": [
103+
{
104+
"type": "string",
105+
"description": "Message Hash",
106+
"name": "hash",
107+
"in": "path",
108+
"required": true
109+
}
110+
],
111+
"responses": {
112+
"200": {
113+
"description": "code\": 200, \"msg\": \"success\", \"data\": schema.SyncEvent",
114+
"schema": {
115+
"type": "object",
116+
"additionalProperties": true
117+
}
118+
}
119+
}
120+
}
121+
},
122+
"/blocks/{blockNumber}/executingMessage": {
123+
"get": {
124+
"description": "Get all executing messages for a specific block number",
125+
"consumes": [
126+
"application/json"
127+
],
128+
"produces": [
129+
"application/json"
130+
],
131+
"tags": [
132+
"Messages"
133+
],
134+
"summary": "Get executing messages by block number",
135+
"parameters": [
136+
{
137+
"type": "integer",
138+
"description": "Block Number",
139+
"name": "blockNumber",
140+
"in": "path",
141+
"required": true
142+
}
143+
],
144+
"responses": {
145+
"200": {
146+
"description": "code\": 200, \"msg\": \"success\", \"data\": []schema.SyncEvent",
147+
"schema": {
148+
"type": "object",
149+
"additionalProperties": true
150+
}
151+
},
152+
"400": {
153+
"description": "code\": 400, \"msg\": \"Invalid block number\", \"data\": nil",
154+
"schema": {
155+
"type": "object",
156+
"additionalProperties": true
157+
}
158+
}
159+
}
160+
}
161+
}
162+
}
163+
}`
164+
165+
// SwaggerInfo holds exported Swagger Info so clients can modify it
166+
var SwaggerInfo = &swag.Spec{
167+
Version: "1.0",
168+
Host: "localhost:8080",
169+
BasePath: "/",
170+
Schemes: []string{},
171+
Title: "Interop Backend API",
172+
Description: "Interop Backend Service API Documentation",
173+
InfoInstanceName: "swagger",
174+
SwaggerTemplate: docTemplate,
175+
LeftDelim: "{{",
176+
RightDelim: "}}",
177+
}
178+
179+
func init() {
180+
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
181+
}

docs/swagger.json

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"description": "Interop Backend Service API Documentation",
5+
"title": "Interop Backend API",
6+
"contact": {},
7+
"version": "1.0"
8+
},
9+
"host": "localhost:8080",
10+
"basePath": "/",
11+
"paths": {
12+
"/blocks": {
13+
"get": {
14+
"description": "Get a paginated list of sync blocks",
15+
"consumes": [
16+
"application/json"
17+
],
18+
"produces": [
19+
"application/json"
20+
],
21+
"tags": [
22+
"Blocks"
23+
],
24+
"summary": "Get sync blocks with pagination",
25+
"parameters": [
26+
{
27+
"type": "integer",
28+
"description": "Page number (default: 1)",
29+
"name": "page",
30+
"in": "query"
31+
},
32+
{
33+
"type": "integer",
34+
"description": "Page size (default: 10, max: 100)",
35+
"name": "pageSize",
36+
"in": "query"
37+
}
38+
],
39+
"responses": {
40+
"200": {
41+
"description": "code\": 200, \"msg\": \"success\", \"data\": {\"list\": []schema.SyncBlock, \"total\": int64, \"page\": int, \"pageSize\": int}",
42+
"schema": {
43+
"type": "object",
44+
"additionalProperties": true
45+
}
46+
}
47+
}
48+
}
49+
},
50+
"/blocks/relayedMessage/{hash}": {
51+
"get": {
52+
"description": "Get relayed message details using message hash",
53+
"consumes": [
54+
"application/json"
55+
],
56+
"produces": [
57+
"application/json"
58+
],
59+
"tags": [
60+
"Messages"
61+
],
62+
"summary": "Get relayed message by hash",
63+
"parameters": [
64+
{
65+
"type": "string",
66+
"description": "Message Hash",
67+
"name": "hash",
68+
"in": "path",
69+
"required": true
70+
}
71+
],
72+
"responses": {
73+
"200": {
74+
"description": "code\": 200, \"msg\": \"success\", \"data\": schema.SyncEvent",
75+
"schema": {
76+
"type": "object",
77+
"additionalProperties": true
78+
}
79+
}
80+
}
81+
}
82+
},
83+
"/blocks/sentMessage/{hash}": {
84+
"get": {
85+
"description": "Get sent message details using message hash",
86+
"consumes": [
87+
"application/json"
88+
],
89+
"produces": [
90+
"application/json"
91+
],
92+
"tags": [
93+
"Messages"
94+
],
95+
"summary": "Get sent message by hash",
96+
"parameters": [
97+
{
98+
"type": "string",
99+
"description": "Message Hash",
100+
"name": "hash",
101+
"in": "path",
102+
"required": true
103+
}
104+
],
105+
"responses": {
106+
"200": {
107+
"description": "code\": 200, \"msg\": \"success\", \"data\": schema.SyncEvent",
108+
"schema": {
109+
"type": "object",
110+
"additionalProperties": true
111+
}
112+
}
113+
}
114+
}
115+
},
116+
"/blocks/{blockNumber}/executingMessage": {
117+
"get": {
118+
"description": "Get all executing messages for a specific block number",
119+
"consumes": [
120+
"application/json"
121+
],
122+
"produces": [
123+
"application/json"
124+
],
125+
"tags": [
126+
"Messages"
127+
],
128+
"summary": "Get executing messages by block number",
129+
"parameters": [
130+
{
131+
"type": "integer",
132+
"description": "Block Number",
133+
"name": "blockNumber",
134+
"in": "path",
135+
"required": true
136+
}
137+
],
138+
"responses": {
139+
"200": {
140+
"description": "code\": 200, \"msg\": \"success\", \"data\": []schema.SyncEvent",
141+
"schema": {
142+
"type": "object",
143+
"additionalProperties": true
144+
}
145+
},
146+
"400": {
147+
"description": "code\": 400, \"msg\": \"Invalid block number\", \"data\": nil",
148+
"schema": {
149+
"type": "object",
150+
"additionalProperties": true
151+
}
152+
}
153+
}
154+
}
155+
}
156+
}
157+
}

0 commit comments

Comments
 (0)