Unverified Commit fee63396 authored by Agate's avatar Agate 💬

Documented playlists API

parent 46a783fb
Pipeline #11185 passed with stages
in 5 minutes and 10 seconds
......@@ -575,6 +575,65 @@ OwnedUpload:
import_metadata:
$ref: "#/ImportMetadata"
Playlist:
type: "object"
properties:
id:
type: "integer"
format: "int64"
example: 42
name:
type: "string"
description: Name of the playlist
example: "Move your body"
duration:
type: "integer"
format: "int64"
description: Duration of the playlist, in seconds
example: 3600
tracks_count:
type: "integer"
format: "int64"
description: Number of tracks in the playlist
example: 76
privacy_level:
$ref: "./properties.yml#privacy_level"
actor:
$ref: "#/Actor"
description: Actor owning the playlist
creation_date:
$ref: "./properties.yml#creation_date"
modification_date:
$ref: "./properties.yml#modification_date"
PlaylistCreate:
type: "object"
properties:
name:
type: "string"
description: Name of the playlist
example: "Move your body"
privacy_level:
$ref: "./properties.yml#privacy_level"
PlaylistTrack:
type: "object"
properties:
id:
type: "integer"
format: "int64"
example: 42
index:
type: "integer"
format: "int64"
example: 16
description: Position of the track in the playlist
creation_date:
$ref: "./properties.yml#creation_date"
track:
$ref: "#/Track"
ImportMetadata:
type: "object"
description: "Import metadata to override values from ID3/embedded audio tags"
......
......@@ -26,6 +26,12 @@ mbid:
creation_date:
type: "string"
format: "date-time"
description: "Creation date of the resource"
modification_date:
type: "string"
format: "date-time"
description: "Last modification date of th resource"
privacy_level:
type: string
example: "me"
......
# Undocumented endpoints:
# /api/v1/settings
# /api/v1/activity
# /api/v1/playlists
# /api/v1/playlist-tracks
# /api/v1/search
# /api/v1/radios
......@@ -1374,7 +1373,199 @@ paths:
responses:
204:
$ref: "#/responses/204"
/api/v1/playlists/:
get:
summary: List playlists
tags:
- "Content curation"
parameters:
- $ref: "./api/parameters.yml#Search"
- allOf:
- $ref: "./api/parameters.yml#Ordering"
- default: "-creation_date"
schema:
required: false
type: "string"
example: "creation_date"
enum:
- creation_date
- modification_date
- id
- name
- in: query
name: artist
description: Restrict to playlists containing tracks from the given artist
schema:
type: "integer"
format: "int64"
- in: query
name: album
description: Restrict to playlists containing tracks from the given album
schema:
type: "integer"
format: "int64"
- in: query
name: track
description: Restrict to playlists containing the given track
schema:
type: "integer"
format: "int64"
- $ref: "./api/parameters.yml#Playable"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
responses:
200:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Playlist"
post:
tags:
- "Content curation"
description: Create a new playlist
responses:
201:
$ref: "#/responses/201"
400:
$ref: "#/responses/400"
requestBody:
required: true
content:
application/json:
schema:
$ref: "./api/definitions.yml#PlaylistCreate"
/api/v1/playlists/{id}/:
parameters:
- name: id
in: path
required: true
schema:
type: "integer"
format: "int64"
get:
summary: Retrieve a playlist
tags:
- "Content curation"
responses:
200:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Playlist"
post:
summary: Update a playlist
tags:
- "Content curation"
requestBody:
required: true
content:
application/json:
schema:
$ref: "./api/definitions.yml#PlaylistCreate"
responses:
201:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Playlist"
delete:
description: Delete the playlist
tags:
- "Content curation"
responses:
204:
$ref: "#/responses/204"
/api/v1/playlists/{id}/tracks:
parameters:
- name: id
in: path
required: true
schema:
type: "integer"
format: "int64"
get:
description: Retrieve all tracks in the playlist
tags:
- "Content curation"
responses:
200:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#PlaylistTrack"
/api/v1/playlists/{id}/add:
parameters:
- name: id
in: path
required: true
schema:
type: "integer"
format: "int64"
post:
tags:
- "Content curation"
summary: Append one or more tracks to a playlist
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
tracks:
type: array
description: An array of track IDs
items:
type: "integer"
format: "int64"
example: 13
allow_duplicates:
type: boolean
default: false
description: |
Wether to raise an error when the same track is added
multiple time in the playlist
responses:
201:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#PlaylistTrack"
/api/v1/playlists/{id}/clear:
parameters:
- name: id
in: path
required: true
schema:
type: "integer"
format: "int64"
delete:
description: Remove all tracks in the playlist
tags:
- "Content curation"
responses:
204:
responses:
200:
description: Success
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment