{
  "swagger": "2.0",
  "info": {
    "title": "evey/v1/music.proto",
    "version": "version not set"
  },
  "tags": [
    {
      "name": "MusicService"
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/api/v1/music/albums": {
      "get": {
        "operationId": "MusicService_GetAlbums",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1GetAlbumsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "libraryId",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    },
    "/api/v1/music/artists": {
      "get": {
        "operationId": "MusicService_GetArtists",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1GetArtistsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "libraryId",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    },
    "/api/v1/music/scan": {
      "post": {
        "operationId": "MusicService_ScanMusicDirectory",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1ScanMusicDirectoryResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1ScanMusicDirectoryRequest"
            }
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    },
    "/api/v1/music/search": {
      "get": {
        "operationId": "MusicService_SearchMusic",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1SearchMusicResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "libraryId",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    },
    "/api/v1/music/tracks": {
      "get": {
        "operationId": "MusicService_ListTracks",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1ListTracksResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "libraryId",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "albumId",
            "description": "When set, returns all tracks of the album with this opaque id (see\nMusicAlbum.id), ignoring limit/offset/search. The id is derived from the\nalbum folder, so homonym albums don't collide.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "cursor",
            "description": "Opaque keyset cursor from a previous ListTracksResponse.next_cursor. When\nset, offset is ignored and the page is served by index seek instead of the\nCOUNT(*) OVER() window the offset path carries.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "shuffle",
            "description": "When set, returns up to limit tracks drawn at random from the WHOLE\nlibrary (a fresh draw per call), ignoring offset, search and cursor - the\n\"shuffle\" button's queue, instead of a shuffle of the pages already loaded.",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    },
    "/api/v1/music/tracks/{id}": {
      "get": {
        "summary": "GetTrack returns a single track by id. Used by clients that hold a track id\nbut not the track in a paged list - notably a syncplay JOINER whose queue\nreferences tracks outside its own top-100 ListTracks window.",
        "operationId": "MusicService_GetTrack",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1GetTrackResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "MusicService"
        ]
      },
      "delete": {
        "operationId": "MusicService_DeleteTrack",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "object",
              "properties": {}
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "MusicService"
        ]
      }
    }
  },
  "definitions": {
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "rpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          }
        }
      }
    },
    "v1GetAlbumsResponse": {
      "type": "object",
      "properties": {
        "albums": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1MusicAlbum"
          }
        }
      }
    },
    "v1GetArtistsResponse": {
      "type": "object",
      "properties": {
        "artists": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1MusicArtist"
          }
        }
      }
    },
    "v1GetTrackResponse": {
      "type": "object",
      "properties": {
        "track": {
          "$ref": "#/definitions/v1Track"
        }
      }
    },
    "v1ListTracksResponse": {
      "type": "object",
      "properties": {
        "tracks": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1Track"
          }
        },
        "total": {
          "type": "integer",
          "format": "int32",
          "description": "Exact row count. Only populated on the OFFSET path: computing it is the\nvery cost the cursor path exists to avoid. On the cursor path it stays 0 -\nuse next_cursor (or a page shorter than the requested limit) to know when\nto stop, never total."
        },
        "nextCursor": {
          "type": "string",
          "description": "Cursor for the following page. Empty means this was the last page."
        }
      }
    },
    "v1MusicAlbum": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "artist": {
          "type": "string"
        },
        "year": {
          "type": "integer",
          "format": "int32"
        },
        "coverArtUrl": {
          "type": "string"
        },
        "trackCount": {
          "type": "integer",
          "format": "int32"
        },
        "duration": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "v1MusicArtist": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "trackCount": {
          "type": "integer",
          "format": "int32"
        },
        "albumCount": {
          "type": "integer",
          "format": "int32"
        },
        "coverArtUrl": {
          "type": "string"
        }
      }
    },
    "v1ScanMusicDirectoryRequest": {
      "type": "object",
      "properties": {
        "libraryId": {
          "type": "string"
        },
        "directory": {
          "type": "string"
        }
      }
    },
    "v1ScanMusicDirectoryResponse": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "v1SearchMusicResponse": {
      "type": "object",
      "properties": {
        "tracks": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1Track"
          }
        }
      }
    },
    "v1Track": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "libraryId": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "artist": {
          "type": "string"
        },
        "album": {
          "type": "string"
        },
        "albumArtist": {
          "type": "string"
        },
        "year": {
          "type": "integer",
          "format": "int32"
        },
        "trackNumber": {
          "type": "integer",
          "format": "int32"
        },
        "diskNumber": {
          "type": "integer",
          "format": "int32"
        },
        "duration": {
          "type": "number",
          "format": "double"
        },
        "filePath": {
          "type": "string"
        },
        "fileSize": {
          "type": "string",
          "format": "int64"
        },
        "mimeType": {
          "type": "string"
        },
        "bitrate": {
          "type": "integer",
          "format": "int32"
        },
        "sampleRate": {
          "type": "integer",
          "format": "int32"
        },
        "channels": {
          "type": "integer",
          "format": "int32"
        },
        "genre": {
          "type": "string"
        },
        "coverArtUrl": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "albumId": {
          "type": "string",
          "description": "Opaque id of the album this track belongs to (see MusicAlbum.id), so a\nsearch result can link straight to the album view."
        }
      }
    }
  }
}
