Skip to content

Commit 58c865f

Browse files
committed
collections: add item types
- genre - internet radio station - podcast episode - podcast
1 parent 0f09c82 commit 58c865f

9 files changed

Lines changed: 141 additions & 29 deletions

File tree

content/en/docs/Endpoints/createcollection.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ The request payload should be provided in the body as a JSON object.
4242
{
4343
"type": "album",
4444
"id": "200000021"
45+
},
46+
{
47+
"type": "genre",
48+
"name": "vaporwave"
4549
}
4650
]
4751
}
@@ -68,7 +72,7 @@ A [`subsonic-response`](../../responses/subsonic-response) element with a top-le
6872
"comment" "this is a collection",
6973
"owner": "user",
7074
"public": false,
71-
"itemCount": 2,
75+
"itemCount": 3,
7276
"created": "2023-03-16T03:18:41+00:00",
7377
"changed": "2023-03-16T03:18:41+00:00",
7478
"items": [
@@ -120,6 +124,13 @@ A [`subsonic-response`](../../responses/subsonic-response) element with a top-le
120124
"year": 2005,
121125
"genre": "Hip-Hop"
122126
}
127+
},
128+
{
129+
"genre": {
130+
"value": "vaporwave",
131+
"songCount": 6,
132+
"albumCount": 1
133+
}
123134
}
124135
]
125136
}

content/en/docs/Endpoints/getcollection.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A [`subsonic-response`](../../responses/subsonic-response) element with a top-le
4343
"comment" "this is a collection",
4444
"owner": "user",
4545
"public": true,
46-
"itemCount": 2,
46+
"itemCount": 3,
4747
"created": "2023-03-16T03:18:41+00:00",
4848
"changed": "2023-03-16T03:18:41+00:00",
4949
"items": [
@@ -95,6 +95,13 @@ A [`subsonic-response`](../../responses/subsonic-response) element with a top-le
9595
"year": 2005,
9696
"genre": "Hip-Hop"
9797
}
98+
},
99+
{
100+
"genre": {
101+
"value": "vaporwave",
102+
"songCount": 6,
103+
"albumCount": 1
104+
}
98105
}
99106
]
100107
}

content/en/docs/Extensions/collections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: >
1212
**OpenSubsonic extension name**: `collections` (As returned by [`getOpenSubsonicExtensions`](../../endpoints/getopensubsonicextensions))
1313

1414
This extension allows users to create and manage collections.
15-
A collection is an ordered list of items - songs, artist, albums, playlists.
15+
A collection is an ordered list of items - songs, artist, albums, playlists, etc.
1616

1717
## Version 1
1818

content/en/docs/Payloads/CollectionItemID.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ description: >
99
An identifier for a collection item to be added.
1010
---
1111

12+
Depending on the item type, either `id` or `name` must be provided.
13+
For most types, `id` is the natural choice, but some types (e.g. [Genre](../responses/genre))
14+
don't have it, so `name` should be used.
15+
1216
{{< tabpane persist=false >}}
1317
{{< tab header="**Example**:" disabled=true />}}
1418
{{< tab header="Song" lang="json">}}
@@ -23,9 +27,16 @@ description: >
2327
"id": "30"
2428
}
2529
{{< /tab >}}
30+
{{< tab header="Genre" lang="json">}}
31+
{
32+
"type": "genre",
33+
"name": "vaporwave"
34+
}
35+
{{< /tab >}}
2636
{{< /tabpane >}}
2737

2838
| Field | Type | Req. | OpenS. | Details |
2939
| --- | --- | --- | --- | --- |
3040
| `type` | `string` | **Yes** | | One of: song, album, artist, playlist |
31-
| `id` | `string` | **Yes** | | An identifier of the item |
41+
| `id` | `string` | No | | ID of the item, where applicable |
42+
| `name` | `string` | No | | Name of the item, where applicable |

content/en/docs/Responses/collectionItem.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ An item in a collection is a wrapper around one of the following types:
1515
- [AlbumID3](../albumid3/)
1616
- [ArtistID3](../artistid3/)
1717
- [Playlist](../playlist/)
18+
- [Genre](../genre)
19+
- [InternetRadioStation](../internetradiostation)
20+
- [PodcastEpisode](../podcastepisode)
21+
- [PodcastChannel](../podcastchannel)
1822

1923
{{< tabpane persist=false >}}
2024
{{< tab header="**Example**:" disabled=true />}}
@@ -265,4 +269,13 @@ An item in a collection is a wrapper around one of the following types:
265269
}
266270
}
267271
{{< /tab >}}
272+
{{< tab header="Genre" lang="json">}}
273+
{
274+
"genre": {
275+
"value": "vaporwave",
276+
"songCount": 6,
277+
"albumCount": 1
278+
}
279+
}
280+
{{< /tab >}}
268281
{{< /tabpane >}}

content/en/docs/Responses/collectionWithItems.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ description: >
7171
"year": 2005,
7272
"genre": "Hip-Hop"
7373
}
74+
},
75+
{
76+
"genre": {
77+
"value": "vaporwave",
78+
"songCount": 6,
79+
"albumCount": 1
80+
}
7481
}
7582
]
7683
}

openapi/endpoints/createCollection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"items": {
3232
"$ref": "../schemas/CollectionItemId.json"
3333
},
34-
"description": "IDs of items in the collection."
34+
"description": "Identifiers of items in the collection."
3535
}
3636
},
3737
"required": [

openapi/schemas/CollectionItem.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,38 @@
3333
"$ref": "Playlist.json"
3434
}
3535
}
36+
},
37+
{
38+
"type": "object",
39+
"properties": {
40+
"genre": {
41+
"$ref": "Genre.json"
42+
}
43+
}
44+
},
45+
{
46+
"type": "object",
47+
"properties": {
48+
"internetRadioStation": {
49+
"$ref": "InternetRadioStation.json"
50+
}
51+
}
52+
},
53+
{
54+
"type": "object",
55+
"properties": {
56+
"podcastEpisode": {
57+
"$ref": "PodcastEpisode.json"
58+
}
59+
}
60+
},
61+
{
62+
"type": "object",
63+
"properties": {
64+
"podcast": {
65+
"$ref": "PodcastChannel.json"
66+
}
67+
}
3668
}
3769
]
3870
}
Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,59 @@
11
{
2-
"type": "object",
3-
"description": "Collection item identifier.",
4-
"properties": {
5-
"type": {
6-
"type": "string",
7-
"description": "Type of the collection item.",
8-
"enum": [
9-
"song",
10-
"album",
11-
"artist",
12-
"playlist"
13-
]
2+
"allOf": [
3+
{
4+
"type": "object",
5+
"description": "Collection item identifier. Depending on the item type, either `id` or `name` must be provided.",
6+
"properties": {
7+
"type": {
8+
"type": "string",
9+
"description": "Type of the collection item.",
10+
"enum": [
11+
"song",
12+
"album",
13+
"artist",
14+
"playlist",
15+
"genre",
16+
"internetRadioStation",
17+
"podcastEpisode",
18+
"podcast"
19+
]
20+
}
21+
},
22+
"required": [
23+
"type"
24+
],
25+
"externalDocs": {
26+
"description": "CollectionItemId",
27+
"url": "https://opensubsonic.netlify.app/docs/payloads/collectionitemid/"
28+
}
1429
},
15-
"id": {
16-
"type": "string",
17-
"description": "Id of the item."
30+
{
31+
"oneOf": [
32+
{
33+
"type": "object",
34+
"properties": {
35+
"id": {
36+
"type": "string",
37+
"description": "ID of the item, where applicable."
38+
}
39+
},
40+
"required": [
41+
"id"
42+
]
43+
},
44+
{
45+
"type": "object",
46+
"properties": {
47+
"name": {
48+
"type": "string",
49+
"description": "Name of the item, where applicable."
50+
}
51+
},
52+
"required": [
53+
"name"
54+
]
55+
}
56+
]
1857
}
19-
},
20-
"required": [
21-
"type",
22-
"id"
23-
],
24-
"externalDocs": {
25-
"description": "CollectionItemId",
26-
"url": "https://opensubsonic.netlify.app/docs/payloads/collectionitemid/"
27-
}
58+
]
2859
}

0 commit comments

Comments
 (0)