Documented missing API endpoints
This commit is contained in:
parent
4f428a0771
commit
fd5bec9dfa
|
@ -278,7 +278,7 @@ class LessListenedRadio(SessionRadio):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@registry.register(name="actor_content")
|
@registry.register(name="actor-content")
|
||||||
class ActorContentRadio(RelatedObjectRadio):
|
class ActorContentRadio(RelatedObjectRadio):
|
||||||
"""
|
"""
|
||||||
Play content from given actor libraries
|
Play content from given actor libraries
|
||||||
|
|
|
@ -248,7 +248,7 @@ def test_can_start_actor_content_radio(factories):
|
||||||
session = radio.start_session(
|
session = radio.start_session(
|
||||||
actor_library.actor.user, related_object=actor_library.actor
|
actor_library.actor.user, related_object=actor_library.actor
|
||||||
)
|
)
|
||||||
assert session.radio_type == "actor_content"
|
assert session.radio_type == "actor-content"
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
assert radio.pick() in good_tracks
|
assert radio.pick() in good_tracks
|
||||||
|
@ -261,14 +261,14 @@ def test_can_start_actor_content_radio_from_api(
|
||||||
url = reverse("api:v1:radios:sessions-list")
|
url = reverse("api:v1:radios:sessions-list")
|
||||||
|
|
||||||
response = logged_in_api_client.post(
|
response = logged_in_api_client.post(
|
||||||
url, {"radio_type": "actor_content", "related_object_id": actor.full_username}
|
url, {"radio_type": "actor-content", "related_object_id": actor.full_username}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
|
|
||||||
session = models.RadioSession.objects.latest("id")
|
session = models.RadioSession.objects.latest("id")
|
||||||
|
|
||||||
assert session.radio_type == "actor_content"
|
assert session.radio_type == "actor-content"
|
||||||
assert session.related_object == actor
|
assert session.related_object == actor
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -462,6 +462,36 @@ AlbumTrack:
|
||||||
description: "List of uploads associated with this track"
|
description: "List of uploads associated with this track"
|
||||||
items:
|
items:
|
||||||
$ref: "#/Upload"
|
$ref: "#/Upload"
|
||||||
|
|
||||||
|
|
||||||
|
ListeningCreate:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
example: 66
|
||||||
|
creation_date:
|
||||||
|
$ref: "./properties.yml#creation_date"
|
||||||
|
track:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
example: 94
|
||||||
|
|
||||||
|
Listening:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
example: 66
|
||||||
|
creation_date:
|
||||||
|
$ref: "./properties.yml#creation_date"
|
||||||
|
track:
|
||||||
|
$ref: "#/Track"
|
||||||
|
actor:
|
||||||
|
$ref: "#/Actor"
|
||||||
|
|
||||||
Track:
|
Track:
|
||||||
type: "object"
|
type: "object"
|
||||||
allOf:
|
allOf:
|
||||||
|
@ -818,6 +848,37 @@ Permissions:
|
||||||
type: "boolean"
|
type: "boolean"
|
||||||
example: false
|
example: false
|
||||||
description: A boolean indicating if the user can manage instance settings and users
|
description: A boolean indicating if the user can manage instance settings and users
|
||||||
|
|
||||||
|
RadioSessionCreate:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
radio_type:
|
||||||
|
type: "string"
|
||||||
|
description: |
|
||||||
|
The type of radio to start. Depending of the type, the `related_object_id` field
|
||||||
|
will need to be set to a non null value:
|
||||||
|
|
||||||
|
- tag: tag `name`
|
||||||
|
- artist: artist `id`
|
||||||
|
- library: library `uuid`
|
||||||
|
|
||||||
|
enum:
|
||||||
|
- random
|
||||||
|
- favorites
|
||||||
|
- tag
|
||||||
|
- similar
|
||||||
|
- artist
|
||||||
|
- less-listened
|
||||||
|
- actor-content
|
||||||
|
- library
|
||||||
|
|
||||||
|
related_object_id:
|
||||||
|
type: string
|
||||||
|
default: null
|
||||||
|
description:
|
||||||
|
Value may be an integer depending of the `radio_type`.
|
||||||
|
Please refer to the `radio_type` documentation.
|
||||||
|
|
||||||
RateLimitStatus:
|
RateLimitStatus:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
# Undocumented endpoints:
|
|
||||||
# /api/v1/radios
|
|
||||||
# /api/v1/history
|
|
||||||
|
|
||||||
openapi: "3.0.2"
|
openapi: "3.0.2"
|
||||||
info:
|
info:
|
||||||
description: |
|
description: |
|
||||||
Interactive documentation for [Funkwhale](https://funkwhale.audio) API.
|
Interactive documentation for [Funkwhale](https://funkwhale.audio) API.
|
||||||
|
|
||||||
The API is **not** freezed yet, but we will document breaking changes in our changelog,
|
Backward compatibility between minor versions (1.X to 1.Y) is guaranteed for all the
|
||||||
and try to avoid those as much as possible.
|
endpoints documented here.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
@ -193,6 +189,8 @@ tags:
|
||||||
url: https://docs.funkwhale.audio/users/upload.html#using-a-channel
|
url: https://docs.funkwhale.audio/users/upload.html#using-a-channel
|
||||||
- name: Content curation
|
- name: Content curation
|
||||||
description: Favorites, playlists, radios
|
description: Favorites, playlists, radios
|
||||||
|
- name: User activity
|
||||||
|
description: Listenings
|
||||||
- name: Other
|
- name: Other
|
||||||
description: Other endpoints that don't fit in the categories above
|
description: Other endpoints that don't fit in the categories above
|
||||||
|
|
||||||
|
@ -1335,9 +1333,60 @@ paths:
|
||||||
204:
|
204:
|
||||||
$ref: "#/responses/204"
|
$ref: "#/responses/204"
|
||||||
|
|
||||||
|
|
||||||
|
#################
|
||||||
|
# User activity #
|
||||||
|
#################
|
||||||
|
|
||||||
|
/api/v1/history/listenings:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- "User activity"
|
||||||
|
parameters:
|
||||||
|
- $ref: "./api/parameters.yml#/Search"
|
||||||
|
- $ref: "./api/parameters.yml#/PageNumber"
|
||||||
|
- $ref: "./api/parameters.yml#/PageSize"
|
||||||
|
- $ref: "./api/parameters.yml#/Scope"
|
||||||
|
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: "./api/definitions.yml#/ResultPage"
|
||||||
|
- type: "object"
|
||||||
|
properties:
|
||||||
|
results:
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
$ref: "./api/definitions.yml#/Listening"
|
||||||
|
post:
|
||||||
|
summary: Record a track in your history
|
||||||
|
tags:
|
||||||
|
- "User activity"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
track:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
example: 98
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "./api/definitions.yml#/ListeningCreate"
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# Others #
|
# Others #
|
||||||
##########
|
##########
|
||||||
|
|
||||||
/api/v1/search:
|
/api/v1/search:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -1696,6 +1745,38 @@ paths:
|
||||||
- "Content curation"
|
- "Content curation"
|
||||||
responses:
|
responses:
|
||||||
204:
|
204:
|
||||||
|
/api/v1/radios/sessions:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "Content curation"
|
||||||
|
description: Start a new radio session
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
$ref: "#/responses/201"
|
||||||
|
400:
|
||||||
|
$ref: "#/responses/400"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "./api/definitions.yml#/RadioSessionCreate"
|
||||||
|
/api/v1/radios/tracks:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "Content curation"
|
||||||
|
description: Get a new track for a radio session
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
$ref: "#/responses/201"
|
||||||
|
400:
|
||||||
|
$ref: "#/responses/400"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "./api/definitions.yml#/Track"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Success
|
description: Success
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<translate translate-context="Content/Radio/Title">Instance radios</translate>
|
<translate translate-context="Content/Radio/Title">Instance radios</translate>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui cards">
|
<div class="ui cards">
|
||||||
<radio-card v-if="isAuthenticated" :type="'actor_content'" :object-id="$store.state.auth.fullUsername"></radio-card>
|
<radio-card v-if="isAuthenticated" :type="'actor-content'" :object-id="$store.state.auth.fullUsername"></radio-card>
|
||||||
<radio-card v-if="isAuthenticated && hasFavorites" :type="'favorites'"></radio-card>
|
<radio-card v-if="isAuthenticated && hasFavorites" :type="'favorites'"></radio-card>
|
||||||
<radio-card :type="'random'"></radio-card>
|
<radio-card :type="'random'"></radio-card>
|
||||||
<radio-card v-if="$store.state.auth.authenticated" :type="'less-listened'"></radio-card>
|
<radio-card v-if="$store.state.auth.authenticated" :type="'less-listened'"></radio-card>
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
||||||
getters: {
|
getters: {
|
||||||
types: state => {
|
types: state => {
|
||||||
return {
|
return {
|
||||||
actor_content: {
|
'actor-content': {
|
||||||
name: 'Your content',
|
name: 'Your content',
|
||||||
description: "Picks from your own libraries"
|
description: "Picks from your own libraries"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue