swagger: '2.0'

info:
    title: Call-me API
    description: API description for external applications that integrates with Call-me.
    version: 1.0.1

basePath: /api/v1

schemes:
    - https
    - http

paths:
    /users:
        get:
            tags:
                - 'users'
            summary: 'Connected users'
            description: 'Get all connected users'
            consumes:
                - 'application/json'
            produces:
                - 'application/json'
            security:
                - secretApiKey: []
            responses:
                '200':
                    description: 'Connected users'
                    schema:
                        $ref: '#/definitions/UsersResponse'
                '403':
                    description: 'Unauthorized!'

    /connected:
        get:
            tags:
                - 'connected'
            summary: 'Connected users to call'
            description: 'Retrieve all connected users to call'
            parameters:
                - name: user
                  in: path
                  description: 'Username of the requesting user'
                  required: true
                  type: string
            consumes:
                - 'application/json'
            produces:
                - 'application/json'
            security:
                - secretApiKey: []
            responses:
                '200':
                    description: 'Connected users to call'
                    schema:
                        $ref: '#/definitions/connectedResponse'
                '403':
                    description: 'Unauthorized!'

securityDefinitions:
    secretApiKey:
        type: 'apiKey'
        name: 'authorization'
        in: 'header'
        description: 'Format like this: authorization: {API_KEY_SECRET}'

definitions:
    UsersResponse:
        type: 'object'
        properties:
            users:
                type: 'array'
                example: ['call-me', 'miro']

    connectedResponse:
        type: 'object'
        properties:
            connected:
                type: array
                example: ['https://your.domain/join?user=call-me&call=miro']
