Files
nextcloud-jukebox/openapi.json
2025-06-09 11:28:20 +03:00

697 lines
28 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "jukebox",
"version": "0.0.1",
"description": "Stream and organize all your audio content in one place.",
"license": {
"name": "agpl"
}
},
"components": {
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
},
"bearer_auth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"OCSMeta": {
"type": "object",
"required": [
"status",
"statuscode"
],
"properties": {
"status": {
"type": "string"
},
"statuscode": {
"type": "integer"
},
"message": {
"type": "string"
},
"totalitems": {
"type": "string"
},
"itemsperpage": {
"type": "string"
}
}
}
}
},
"paths": {
"/ocs/v2.php/apps/jukebox/api/tracks": {
"get": {
"operationId": "api-list-tracks",
"summary": "List all tracks for the current user",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "List of media tracks for current user",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"tracks"
],
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/tracks/{id}/stream": {
"get": {
"operationId": "api-stream-track",
"summary": "Stream a track file for playback",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Track ID",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "File response returned successfully",
"content": {
"*/*": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"401": {
"description": "User not authenticated",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"403": {
"description": "Track does not belong to current user",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"404": {
"description": "Track file or record not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/albums": {
"get": {
"operationId": "api-list-albums",
"summary": "Fetch albums with grouped tracks for current user",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Grouped albums and their tracks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"albums"
],
"properties": {
"albums": {
"type": "array",
"items": {
"type": "object",
"required": [
"album",
"albumArtist",
"year",
"cover",
"tracks"
],
"properties": {
"album": {
"type": "string"
},
"albumArtist": {
"type": "string"
},
"year": {
"type": "integer",
"format": "int64",
"nullable": true
},
"cover": {
"type": "string",
"nullable": true
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/albums/{id}": {
"get": {
"operationId": "api-get-album-by-id",
"summary": "Fetch a single album by its ID",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Encoded album identifier (albumArtist|album)",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Album and its tracks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"album",
"albumArtist",
"year",
"cover",
"tracks"
],
"properties": {
"album": {
"type": "string"
},
"albumArtist": {
"type": "string"
},
"year": {
"type": "integer",
"format": "int64",
"nullable": true
},
"cover": {
"type": "string",
"nullable": true
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/artists": {
"get": {
"operationId": "api-list-artists",
"summary": "Fetch a list of unique artists for the current user",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "List of unique artists",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"artists"
],
"properties": {
"artists": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"cover",
"genre"
],
"properties": {
"name": {
"type": "string"
},
"cover": {
"type": "string",
"nullable": true
},
"genre": {
"type": "string",
"nullable": true
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/artists/{id}": {
"get": {
"operationId": "api-get-artist-by-id",
"summary": "Fetch a single artist by their ID",
"description": "This endpoint requires admin access",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Base64-encoded artist name",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Artist details, their albums and tracks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name",
"cover",
"genre",
"tracks"
],
"properties": {
"name": {
"type": "string"
},
"cover": {
"type": "string",
"nullable": true
},
"genre": {
"type": "string",
"nullable": true
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/jukebox/api/settings": {
"put": {
"operationId": "settings-save-settings",
"summary": "Save user-specific settings",
"description": "This endpoint requires admin access",
"tags": [
"settings"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"description": "Data to save",
"additionalProperties": {
"type": "object"
}
}
}
}
}
}
},
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Settings saved",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
}
}
}
}
}
},
"get": {
"operationId": "settings-get-settings",
"summary": "Fetch all user-specific settings",
"description": "This endpoint requires admin access",
"tags": [
"settings"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Current settings",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
},
"tags": [
{
"name": "settings",
"description": "Handles user-specific settings such as the music folder path."
}
]
}