mirror of
https://github.com/LukeHagar/plex-api-spec.git
synced 2025-12-10 12:37:44 +00:00
added genres
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Library
|
- Library
|
||||||
summary: Search Library
|
summary: Get Countries of library media
|
||||||
operationId: get-countries-library
|
operationId: get-countries-library
|
||||||
description: |
|
description: |
|
||||||
Retrieves a list of all the countries that are found for the media in this library.
|
Retrieves a list of all the countries that are found for the media in this library.
|
||||||
|
|||||||
88
src/paths/library/[sectionKey]/get-library-genres.yaml
Normal file
88
src/paths/library/[sectionKey]/get-library-genres.yaml
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Library
|
||||||
|
summary: Get Genres of library media
|
||||||
|
operationId: get-genres-library
|
||||||
|
description: |
|
||||||
|
Retrieves a list of all the genres that are found for the media in this library.
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Successful response containing media container data.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
MediaContainer:
|
||||||
|
allOf:
|
||||||
|
- $ref: "../../../models/MediaContainer.yaml"
|
||||||
|
- type: object
|
||||||
|
required:
|
||||||
|
- size
|
||||||
|
- allowSync
|
||||||
|
- art
|
||||||
|
- content
|
||||||
|
- identifier
|
||||||
|
- mediaTagPrefix
|
||||||
|
- mediaTagVersion
|
||||||
|
- nocache
|
||||||
|
- thumb
|
||||||
|
- title1
|
||||||
|
- title2
|
||||||
|
- viewGroup
|
||||||
|
properties:
|
||||||
|
art:
|
||||||
|
type: string
|
||||||
|
example: "/:/resources/show-fanart.jpg"
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
example: "secondary"
|
||||||
|
mediaTagPrefix:
|
||||||
|
type: string
|
||||||
|
example: "/system/bundle/media/flags/"
|
||||||
|
mediaTagVersion:
|
||||||
|
type: integer
|
||||||
|
example: 1734362201
|
||||||
|
nocache:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
thumb:
|
||||||
|
type: string
|
||||||
|
example: "/:/resources/show.png"
|
||||||
|
title1:
|
||||||
|
type: string
|
||||||
|
example: "TV Shows (Reality)"
|
||||||
|
title2:
|
||||||
|
type: string
|
||||||
|
example: "By Genre"
|
||||||
|
viewGroup:
|
||||||
|
type: string
|
||||||
|
example: "secondary"
|
||||||
|
Directory:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- fastKey
|
||||||
|
- key
|
||||||
|
- title
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
fastKey:
|
||||||
|
type: string
|
||||||
|
example: "/library/sections/10/all?genre=89"
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
example: "89"
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
example: "Action"
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
example: "genre"
|
||||||
|
"400":
|
||||||
|
$ref: "../../../responses/400.yaml"
|
||||||
|
"401":
|
||||||
|
$ref: "../../../responses/401.yaml"
|
||||||
|
"404":
|
||||||
|
$ref: "../../../responses/404-html.yaml"
|
||||||
@@ -169,6 +169,8 @@ paths:
|
|||||||
$ref: "./paths/library/[sectionKey]/refresh/get-refresh-library-metadata.yaml"
|
$ref: "./paths/library/[sectionKey]/refresh/get-refresh-library-metadata.yaml"
|
||||||
/library/sections/{sectionKey}/search:
|
/library/sections/{sectionKey}/search:
|
||||||
$ref: "./paths/library/[sectionKey]/get-search-library.yaml"
|
$ref: "./paths/library/[sectionKey]/get-search-library.yaml"
|
||||||
|
/library/sections/{sectionKey}/genre:
|
||||||
|
$ref: "./paths/library/[sectionKey]/get-library-genres.yaml"
|
||||||
/library/sections/{sectionKey}/country:
|
/library/sections/{sectionKey}/country:
|
||||||
$ref: "./paths/library/[sectionKey]/get-library-countries.yaml"
|
$ref: "./paths/library/[sectionKey]/get-library-countries.yaml"
|
||||||
|
|
||||||
|
|||||||
196
tests/paths/library/[sectionKey]/get-library-genres.spec.ts
Normal file
196
tests/paths/library/[sectionKey]/get-library-genres.spec.ts
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
import { validateResponseSpec } from "@utils"
|
||||||
|
import { describe, it } from "vitest"
|
||||||
|
|
||||||
|
describe("GET /library/sections/[sectionKey]/genre", () => {
|
||||||
|
it("should validate the 200 response when the API spec is valid", () => {
|
||||||
|
const response = {
|
||||||
|
MediaContainer: {
|
||||||
|
size: 23,
|
||||||
|
allowSync: false,
|
||||||
|
art: "/:/resources/show-fanart.jpg",
|
||||||
|
content: "secondary",
|
||||||
|
identifier: "com.plexapp.plugins.library",
|
||||||
|
mediaTagPrefix: "/system/bundle/media/flags/",
|
||||||
|
mediaTagVersion: 1734362201,
|
||||||
|
nocache: true,
|
||||||
|
thumb: "/:/resources/show.png",
|
||||||
|
title1: "TV Shows (Reality)",
|
||||||
|
title2: "By Genre",
|
||||||
|
viewGroup: "secondary",
|
||||||
|
Directory: [
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=89",
|
||||||
|
key: "89",
|
||||||
|
title: "Action",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=17",
|
||||||
|
key: "17",
|
||||||
|
title: "Adventure",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=4025",
|
||||||
|
key: "4025",
|
||||||
|
title: "Biography",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=19",
|
||||||
|
key: "19",
|
||||||
|
title: "Comedy",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=1057",
|
||||||
|
key: "1057",
|
||||||
|
title: "Crime",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=2268",
|
||||||
|
key: "2268",
|
||||||
|
title: "Documentary",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=91",
|
||||||
|
key: "91",
|
||||||
|
title: "Drama",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=1708",
|
||||||
|
key: "1708",
|
||||||
|
title: "Family",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=8438",
|
||||||
|
key: "8438",
|
||||||
|
title: "Food",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=8439",
|
||||||
|
key: "8439",
|
||||||
|
title: "Game Show",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=30219",
|
||||||
|
key: "30219",
|
||||||
|
title: "Home and Garden",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=551",
|
||||||
|
key: "551",
|
||||||
|
title: "Horror",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=5114",
|
||||||
|
key: "5114",
|
||||||
|
title: "Music",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=552",
|
||||||
|
key: "552",
|
||||||
|
title: "Mystery",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=12439",
|
||||||
|
key: "12439",
|
||||||
|
title: "News",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=96699",
|
||||||
|
key: "96699",
|
||||||
|
title: "Podcast",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=86",
|
||||||
|
key: "86",
|
||||||
|
title: "Reality",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=2313",
|
||||||
|
key: "2313",
|
||||||
|
title: "Romance",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=7484",
|
||||||
|
key: "7484",
|
||||||
|
title: "Sport",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=82171",
|
||||||
|
key: "82171",
|
||||||
|
title: "Talk",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=82170",
|
||||||
|
key: "82170",
|
||||||
|
title: "Talk Show",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=739",
|
||||||
|
key: "739",
|
||||||
|
title: "Thriller",
|
||||||
|
type: "genre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/10/all?genre=57093",
|
||||||
|
key: "57093",
|
||||||
|
title: "Travel",
|
||||||
|
type: "genre"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validateResponseSpec(
|
||||||
|
"/library/sections/{sectionKey}/genre",
|
||||||
|
"get",
|
||||||
|
200,
|
||||||
|
response
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should validate the 200 response with no Directories when the API spec is valid", () => {
|
||||||
|
const response = {
|
||||||
|
MediaContainer: {
|
||||||
|
size: 14,
|
||||||
|
allowSync: false,
|
||||||
|
art: "/:/resources/show-fanart.jpg",
|
||||||
|
content: "secondary",
|
||||||
|
identifier: "com.plexapp.plugins.library",
|
||||||
|
mediaTagPrefix: "/system/bundle/media/flags/",
|
||||||
|
mediaTagVersion: 1734362201,
|
||||||
|
nocache: true,
|
||||||
|
thumb: "/:/resources/show.png",
|
||||||
|
title1: "TV Shows (Kids)",
|
||||||
|
title2: "By Genre",
|
||||||
|
viewGroup: "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validateResponseSpec(
|
||||||
|
"/library/sections/{sectionKey}/genre",
|
||||||
|
"get",
|
||||||
|
200,
|
||||||
|
response
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user