-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
200 lines (199 loc) · 4.72 KB
/
swagger.yaml
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
191
192
193
194
195
196
197
198
199
200
swagger: "2.0"
info:
title: Sample API
description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
version: 0.1.9
paths:
/filesystem:
get:
summary: "fetches a resource"
produces:
- "application/json"
parameters:
- name: "dir"
in: query
description: "directory path of resource"
required: true
type: "string"
responses:
200:
description: "item fetched successfully"
schema:
$ref: "#/definitions/Response"
404:
description: "item not found"
post:
summary: "adds a new resource"
produces:
- "application/json"
parameters:
- in: body
name: body
description: "creates new resource"
required: true
schema:
$ref: '#/definitions/Resource'
responses:
200:
description: resource created successfully
schema:
$ref: '#/definitions/Response'
400:
description: resource already exists
delete:
summary: "Deletes a resource"
produces:
- "application/json"
parameters:
- name: "dir"
in: query
description: resource path to be deleted
required: true
type: "string"
responses:
200:
description: "successfully deleted"
schema:
$ref: '#/definitions/err'
400:
description: "bad request"
schema:
$ref: '#/definitions/err'
404:
description: "no such path"
schema:
$ref: '#/definitions/err'
put:
summary: "updates a resource"
produces:
- "application/json"
parameters:
- in: body
name: body
description: "update resource"
required: true
schema:
$ref: '#/definitions/Resource'
responses:
200:
description: resource created successfully
schema:
$ref: '#/definitions/Response'
404:
description: resource does not exist
/stat/count:
get:
summary: "shows how many resources are under that directory"
produces:
- "application/json"
parameters:
- name: "dir"
in: query
description: "directory path of resource"
required: true
type: "string"
responses:
200:
description: "item fetched successfully"
schema:
$ref: '#/definitions/FileCount'
404:
description: "item not found"
schema:
$ref: '#/definitions/err'
/stat/alphanumerics:
get:
summary: "shows average and standard deviation number of resources under given path"
produces:
- "application/json"
parameters:
- name: "dir"
in: query
required: true
type: "string"
responses:
200:
description: "item fetched successfully"
schema:
$ref: '#/definitions/alphanumerics'
404:
description: "item not found"
schema:
$ref: '#/definitions/err'
/stat/wordlen:
get:
summary: "shows average and standard deviation number of word length under given path"
produces:
- "application/json"
parameters:
- name: "dir"
in: query
required: true
type: "string"
responses:
200:
description: "item fetched successfully"
schema:
$ref: '#/definitions/alphanumerics'
404:
description: "item not found"
schema:
$ref: '#/definitions/err'
definitions:
Resource:
type: "object"
properties:
Dir:
type: "string"
Content:
type: "string"
err:
type: "object"
properties:
StatusCode:
type: "integer"
Error:
type: "string"
Response:
type: "object"
properties:
StatusCode:
type: "integer"
Error:
type: "string"
Resource:
type: object
properties:
Dir:
type: "string"
Content:
type: "string"
FileCount:
type: "object"
properties:
StatusCode:
type: "integer"
Error:
type: "string"
TotalFiles:
type: "integer"
format: "float64"
stat:
type: "object"
properties:
Mean:
type: "integer"
format: "float64"
StandardDeviation:
type: "integer"
format: "float64"
alphanumerics:
type: "object"
properties:
StatusCode:
type: "integer"
Error:
type: "string"
Stat:
type: "object"
$ref: '#/definitions/stat'