/
docs.go
190 lines (186 loc) · 5.65 KB
/
docs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/chat/ws.rtm.start": {
"get": {
"tags": [
"chat"
],
"summary": "Endpoint to start real time chat",
"parameters": [
{
"type": "string",
"description": "One time token for a logged user",
"name": "token",
"in": "query",
"required": true
}
],
"responses": {
"101": {
"description": "Upgrade to websocket protocol"
},
"400": {
"description": "Invalid token"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/user": {
"post": {
"consumes": [
"application/json"
],
"tags": [
"user"
],
"summary": "Register(create) user",
"responses": {
"200": {
"description": "user created",
"schema": {
"$ref": "#/definitions/models.UserDTO"
}
},
"400": {
"description": "Bad request, empty username or id"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/user/active": {
"get": {
"tags": [
"user"
],
"summary": "Number of active users in a chat",
"responses": {
"200": {
"description": "successful operation, returns number of active users",
"schema": {
"$ref": "#/definitions/user.UserOnlineResponse"
}
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/user/login": {
"post": {
"consumes": [
"application/json"
],
"tags": [
"user"
],
"summary": "Logs user into the system",
"responses": {
"200": {
"description": "successful operation, returns link to join chat",
"schema": {
"$ref": "#/definitions/user.UserLoginResponse"
},
"headers": {
"X-Expires-After": {
"type": "string",
"description": "date in UTC when token expires"
}
}
},
"400": {
"description": "Invalid username/password"
},
"500": {
"description": "Internal Server Error"
}
}
}
}
},
"definitions": {
"models.UserDTO": {
"type": "object",
"required": [
"password",
"userName"
],
"properties": {
"password": {
"type": "string",
"example": "password"
},
"userName": {
"type": "string",
"example": "userName"
}
}
},
"user.UserLoginResponse": {
"type": "object",
"properties": {
"url": {
"type": "string",
"example": "ws://fancy-chat.io/ws\u0026token=one-time-token"
}
}
},
"user.UserOnlineResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"example": 0
}
}
}
},
"tags": [
{
"description": "Operations about user",
"name": "user"
},
{
"description": "Operations about chat",
"name": "chat"
}
]
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0.0",
Host: "",
BasePath: "/v1",
Schemes: []string{},
Title: "Fancy Golang chat",
Description: "Just a simple chat service",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}