Skip to content

Commit 5e2d44e

Browse files
committed
Update documentation
1 parent df4b2cb commit 5e2d44e

File tree

3 files changed

+218
-12
lines changed

3 files changed

+218
-12
lines changed

api/controllers/events.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ func EventsByBuilding(c *gin.Context) {
103103
// @Router /events/{date}/{building}/{room} [get]
104104
// @Description "Returns all sections with meetings on the specified date in the specified building and room"
105105
// @Produce json
106-
// @Param date path string true "ISO date of the set of events to get"
107-
// @Param building path string true "building abbreviation of the event location"
108-
// @Param room path string true "room number"
109-
// @Success 200 {object} schema.APIResponse[[]schema.SectionWithTime] "All sections with meetings on the specified date in the specified building and room"
110-
// @Failure 500 {object} schema.APIResponse[string] "A string describing the error"
111-
// @Failure 404 {object} schema.APIResponse[string] "A string describing the error"
106+
// @Param date path string true "ISO date of the set of events to get"
107+
// @Param building path string true "building abbreviation of the event location"
108+
// @Param room path string true "room number"
109+
// @Success 200 {object} schema.APIResponse[[]schema.SectionWithTime] "All sections with meetings on the specified date in the specified building and room"
110+
// @Failure 500 {object} schema.APIResponse[string] "A string describing the error"
111+
// @Failure 404 {object} schema.APIResponse[string] "A string describing the error"
112112
func EventsByRoom(c *gin.Context) {
113113
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
114114
defer cancel()
@@ -156,12 +156,12 @@ func EventsByRoom(c *gin.Context) {
156156
// @Router /events/{date}/{building}/{room}/sections [get]
157157
// @Description "Returns full section objects with meetings on the specified date in the specified building and room"
158158
// @Produce json
159-
// @Param date path string true "ISO date of the set of events to get"
160-
// @Param building path string true "building abbreviation of the event location"
161-
// @Param room path string true "room number"
162-
// @Success 200 {object} schema.APIResponse[[]schema.Section] "Full section objects with meetings on the specified date in the specified building and room"
163-
// @Failure 500 {object} schema.APIResponse[string] "A string describing the error"
164-
// @Failure 404 {object} schema.APIResponse[string] "A string describing the error"
159+
// @Param date path string true "ISO date of the set of events to get"
160+
// @Param building path string true "building abbreviation of the event location"
161+
// @Param room path string true "room number"
162+
// @Success 200 {object} schema.APIResponse[[]schema.Section] "Full section objects with meetings on the specified date in the specified building and room"
163+
// @Failure 500 {object} schema.APIResponse[string] "A string describing the error"
164+
// @Failure 404 {object} schema.APIResponse[string] "A string describing the error"
165165
func SectionsByRoomDetailed(c *gin.Context) {
166166
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
167167
defer cancel()

api/docs/docs.go

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,110 @@ const docTemplate = `{
733733
}
734734
}
735735
},
736+
"/events/{date}/{building}/{room}": {
737+
"get": {
738+
"description": "\"Returns all sections with meetings on the specified date in the specified building and room\"",
739+
"produces": [
740+
"application/json"
741+
],
742+
"operationId": "eventsByRoom",
743+
"parameters": [
744+
{
745+
"type": "string",
746+
"description": "ISO date of the set of events to get",
747+
"name": "date",
748+
"in": "path",
749+
"required": true
750+
},
751+
{
752+
"type": "string",
753+
"description": "building abbreviation of the event location",
754+
"name": "building",
755+
"in": "path",
756+
"required": true
757+
},
758+
{
759+
"type": "string",
760+
"description": "room number",
761+
"name": "room",
762+
"in": "path",
763+
"required": true
764+
}
765+
],
766+
"responses": {
767+
"200": {
768+
"description": "All sections with meetings on the specified date in the specified building and room",
769+
"schema": {
770+
"$ref": "#/definitions/schema.APIResponse-array_schema_SectionWithTime"
771+
}
772+
},
773+
"404": {
774+
"description": "A string describing the error",
775+
"schema": {
776+
"$ref": "#/definitions/schema.APIResponse-string"
777+
}
778+
},
779+
"500": {
780+
"description": "A string describing the error",
781+
"schema": {
782+
"$ref": "#/definitions/schema.APIResponse-string"
783+
}
784+
}
785+
}
786+
}
787+
},
788+
"/events/{date}/{building}/{room}/sections": {
789+
"get": {
790+
"description": "\"Returns full section objects with meetings on the specified date in the specified building and room\"",
791+
"produces": [
792+
"application/json"
793+
],
794+
"operationId": "sectionsByRoomDetailed",
795+
"parameters": [
796+
{
797+
"type": "string",
798+
"description": "ISO date of the set of events to get",
799+
"name": "date",
800+
"in": "path",
801+
"required": true
802+
},
803+
{
804+
"type": "string",
805+
"description": "building abbreviation of the event location",
806+
"name": "building",
807+
"in": "path",
808+
"required": true
809+
},
810+
{
811+
"type": "string",
812+
"description": "room number",
813+
"name": "room",
814+
"in": "path",
815+
"required": true
816+
}
817+
],
818+
"responses": {
819+
"200": {
820+
"description": "Full section objects with meetings on the specified date in the specified building and room",
821+
"schema": {
822+
"$ref": "#/definitions/schema.APIResponse-array_schema_Section"
823+
}
824+
},
825+
"404": {
826+
"description": "A string describing the error",
827+
"schema": {
828+
"$ref": "#/definitions/schema.APIResponse-string"
829+
}
830+
},
831+
"500": {
832+
"description": "A string describing the error",
833+
"schema": {
834+
"$ref": "#/definitions/schema.APIResponse-string"
835+
}
836+
}
837+
}
838+
}
839+
},
736840
"/grades/overall": {
737841
"get": {
738842
"description": "\"Returns the overall grade distribution\"",
@@ -2788,6 +2892,23 @@ const docTemplate = `{
27882892
}
27892893
}
27902894
},
2895+
"schema.APIResponse-array_schema_SectionWithTime": {
2896+
"type": "object",
2897+
"properties": {
2898+
"data": {
2899+
"type": "array",
2900+
"items": {
2901+
"$ref": "#/definitions/schema.SectionWithTime"
2902+
}
2903+
},
2904+
"message": {
2905+
"type": "string"
2906+
},
2907+
"status": {
2908+
"type": "integer"
2909+
}
2910+
}
2911+
},
27912912
"schema.APIResponse-array_schema_TypedGradeData": {
27922913
"type": "object",
27932914
"properties": {

api/docs/swagger.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ definitions:
7676
status:
7777
type: integer
7878
type: object
79+
schema.APIResponse-array_schema_SectionWithTime:
80+
properties:
81+
data:
82+
items:
83+
$ref: '#/definitions/schema.SectionWithTime'
84+
type: array
85+
message:
86+
type: string
87+
status:
88+
type: integer
89+
type: object
7990
schema.APIResponse-array_schema_TypedGradeData:
8091
properties:
8192
data:
@@ -1186,6 +1197,80 @@ paths:
11861197
$ref: '#/definitions/schema.APIResponse-string'
11871198
tags:
11881199
- Events
1200+
/events/{date}/{building}/{room}:
1201+
get:
1202+
description: '"Returns all sections with meetings on the specified date in the
1203+
specified building and room"'
1204+
operationId: eventsByRoom
1205+
parameters:
1206+
- description: ISO date of the set of events to get
1207+
in: path
1208+
name: date
1209+
required: true
1210+
type: string
1211+
- description: building abbreviation of the event location
1212+
in: path
1213+
name: building
1214+
required: true
1215+
type: string
1216+
- description: room number
1217+
in: path
1218+
name: room
1219+
required: true
1220+
type: string
1221+
produces:
1222+
- application/json
1223+
responses:
1224+
"200":
1225+
description: All sections with meetings on the specified date in the specified
1226+
building and room
1227+
schema:
1228+
$ref: '#/definitions/schema.APIResponse-array_schema_SectionWithTime'
1229+
"404":
1230+
description: A string describing the error
1231+
schema:
1232+
$ref: '#/definitions/schema.APIResponse-string'
1233+
"500":
1234+
description: A string describing the error
1235+
schema:
1236+
$ref: '#/definitions/schema.APIResponse-string'
1237+
/events/{date}/{building}/{room}/sections:
1238+
get:
1239+
description: '"Returns full section objects with meetings on the specified date
1240+
in the specified building and room"'
1241+
operationId: sectionsByRoomDetailed
1242+
parameters:
1243+
- description: ISO date of the set of events to get
1244+
in: path
1245+
name: date
1246+
required: true
1247+
type: string
1248+
- description: building abbreviation of the event location
1249+
in: path
1250+
name: building
1251+
required: true
1252+
type: string
1253+
- description: room number
1254+
in: path
1255+
name: room
1256+
required: true
1257+
type: string
1258+
produces:
1259+
- application/json
1260+
responses:
1261+
"200":
1262+
description: Full section objects with meetings on the specified date in
1263+
the specified building and room
1264+
schema:
1265+
$ref: '#/definitions/schema.APIResponse-array_schema_Section'
1266+
"404":
1267+
description: A string describing the error
1268+
schema:
1269+
$ref: '#/definitions/schema.APIResponse-string'
1270+
"500":
1271+
description: A string describing the error
1272+
schema:
1273+
$ref: '#/definitions/schema.APIResponse-string'
11891274
/grades/overall:
11901275
get:
11911276
description: '"Returns the overall grade distribution"'

0 commit comments

Comments
 (0)