openapi: 3.0.0
info:
  title: HTWKalendar API
  version: 1.0.1
servers:
  - url: https://htwkalendar.de
    description: Production server
  - url: http://localhost:8090
    description: Local server
paths:
  /api/fetch/events:
    get:
      summary: Fetch Seminar Plans
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: Successful response
  /api/fetch/groups:
    get:
      summary: Fetch Seminar Groups
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: Successful response
  /api/fetch/sports:
    get:
      summary: Fetch Sport Events from HTWK Leipzig
      security:
        - ApiKeyAuth: [ ]
      responses:
        '200':
          description: Successful response
  /api/modules:
    delete:
        summary: Delete Module
        security:
            - ApiKeyAuth: []
        responses:
          '200':
            description: Successful response
  /api/rooms:
    get:
      summary: Get Rooms
      responses:
        '200':
          description: Successful response
  /api/rooms/free:
    get:
      summary: Get Free Rooms
      parameters:
        - name: from
          in: query
          description: start date
          example: "2006-01-02T15:04:05Z"
          required: true
          schema:
            type: string
        - name: to
          in: query
          description: end date
          example: "2006-01-02T15:04:05Z"
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
  /api/schedule/day:
    get:
      summary: Get Day Schedule
      parameters:
        - name: room
          in: query
          description: room
          example: "LN006-H"
          required: true
          schema:
            type: string
        - name: date
          in: query
          description: date
          example: "2023-11-26"
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
  /api/schedule:
    get:
      summary: Get Schedule
      parameters:
        - name: room
          in: query
          description: room
          example: "LN006-H"
          required: true
          schema:
            type: string
        - name: from
          in: query
          description: date
          example: "2023-11-26"
          required: true
          schema:
            type: string
        - name: to
          in: query
          description: date
          example: "2023-11-30"
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
  /api/createFeed:
    post:
      summary: Create iCal Feed
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Module'
              required:
                - name
                - modules
      responses:
        '200':
          description: Successful response
  /api/feed:
    get:
      summary: Get iCal Feed for calendar
      parameters:
        - name: token
          in: query
          description: calendar token
          required: true
          example: "ldluwzg3e73ffxq"
          schema:
            type: string
      responses:
        '200':
          description: Successful response
  /api/course/modules:
    get:
      summary: Get Modules for Course
      parameters:
        - name: course
          in: query
          description: course
          required: true
          example: "Software Engineering"
          schema:
            type: string
        - name: semester
          in: query
          description: semester
          required: true
          example: "ws"
          schema:
              type: string
      responses:
        '200':
          description: Successful response
  /api/module:
    get:
      summary: Get Module
      parameters:
        - name: uuid
          in: query
          description: uuid
          required: true
          example: "d0b3a0e0-2f1a-4e1a-8b0a-0b9e1a0b9e1a"
          schema:
              type: string
      responses:
        '200':
          description: Successful response
  /api/courses:
    get:
      summary: Get Courses
      responses:
        '200':
          description: Successful response
  /api/courses/events:
    get:
      summary: Get Courses that have Events for specific semester
      parameters:
        - name: semester
          in: query
          description: semester
          required: true
          example: "ws"
          schema:
              type: string
      responses:
        '200':
          description: Successful response
  /api/collections/feeds/records/{id}:
    get:
      summary: Get Modules selected for iCal feed
      parameters:
        - name: id
          in: path
          description: calendar token
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
  /api/events:
    delete:
        summary: Delete Event
        security:
            - ApiKeyAuth: []
        responses:
          '200':
            description: Successful response
  /api/feeds/migrate:
    get:
      summary: Migrates all iCal Feeds in the database to the new format
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: Successful response
security:
  - ApiKeyAuth: []
components:
    securitySchemes:
      ApiKeyAuth:
        type: apiKey
        in: header
        name: Authorization
    schemas:
      Module:
        type: object
        properties:
          name:
            type: string
            description: name
            example: "Software Engineering"
          uuid:
            type: string
            format: uuid
          course:
            type: string
          userDefinedName:
            type: string
          prof:
            type: string
          semester:
            type: string
          reminder:
            type: boolean
          events:
            type: array
            items:
              type: string