<commit_before><commit_msg>swagger api definition work in progress<commit_after>swagger: '2.0'

info:
  title: Player API
  version: '0.1'

host: localhost:8880
basePath: /api

produces:
- application/json

tags:
- name: player
  description: Player APIs
- name: playlist
  description: Playlist APIs

paths:

  /player:
    get:
      operationId: getPlayerState
      summary: Get player state
      tags: [ player ]
      parameters:
      - name: columns
        in: query
        description: Active item columns to return
        type: array
        items:
          type: string
        collectionFormat: csv
      responses:
        200:
          description: Success
          schema:
            type: object
            properties:
              player:
                $ref: '#/definitions/PlayerState'
    post:
      operationId: setPlayerState
      summary: Set player state
      tags: [ player ]
      parameters:
      - name: volumeDb
        description: New volume dB value
        in: query
        type: number
      - name: volumeAmp
        description: New volume amp value
        in: query
        type: number
      - name: isMuted
        description: New mute state
        in: query
        type: boolean
      - name: position
        description: New absolute playback position (milliseconds)
        in: query
        type: number
      - name: relativePosition
        description: New relative playback position (milliseconds)
        in: query
        type: number
      - name: loop
        description: New loop mode
        in: query
        type: string
      - name: order
        description: New playback order
        in: query
        type: string
      responses:
        200:
          description: Success

  /playlists:
    get:
      operationId: getPlaylists
      summary: Get playlists
      tags: [ playlist ]
      responses:
        200:
          description: Success
          schema:
            type: object
            properties:
              playlists:
                type: array
                items:
                  $ref: '#/definitions/PlaylistInfo'

  /playlists/{playlistId}/items/{range}:
    get:
      operationId: getPlaylistItems
      summary: Get playlist items
      tags: [ playlist ]
      parameters:
      - name: playlistId
        description: playlist id or index
        in: path
        required: true
        type: string
      - name: range
        description: playlist item range in form offset:count
        in: path
        required: true
        type: string
      - name: columns
        description: Item columns to return
        in: query
        required: true
        type: array
        items:
          type: string
        collectionFormat: csv
      responses:
        200:
          description: Success
          schema:
            type: object
            properties:
              playlists:
                type: array
                items:
                  $ref: '#/definitions/PlaylistItemInfo'

definitions:

  PlaybackState:
    type: string
    enum: [ stopped, playing, paused ]

  LoopMode:
    type: string
    enum: [ none, single, all ]

  PlaybackOrder:
    type: string
    enum: [ linear, random, shuffleAlbums, shuffleTracks ]

  PlayerState:
    type: object
    properties:
      activeItem:
        type: object
        properties:
          playlistId:
            type: string
          playlistIndex:
            type: number
          index:
            type: number
          position:
            type: number
          duration:
            type: number
          columns:
            type: array
            items:
              type: string
      playbackState:
        $ref: '#/definitions/PlaybackState'
      volume:
        type: object
        properties:
          amp:
            type: number
          db:
            type: number
          dbMin:
            type: number
          isMuted:
            type: boolean
      options:
        type: object
        properties:
          loop:
            $ref: '#/definitions/LoopMode'
          order:
            $ref: '#/definitions/PlaybackOrder'

  PlaylistInfo:
    type: object
    properties:
      id:
        type: string
      index:
        type: number
      title:
        type: string
      isCurrent:
        type: boolean
      itemCount:
        type: number
      totalTime:
        type: number

  PlaylistItemInfo:
    type: object
    properties:
      columns:
        type: array
        items:
          type: string
{'fraction_non_alphanumeric': 0.06428885953324527, 'fraction_numerical': 0.004403346543372964, 'mean_word_length': 1.4242262540021344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1501927', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1144, 'n_words': 367}