mirror of
https://github.com/LukeHagar/plex-api-spec.git
synced 2025-12-10 12:37:44 +00:00
added country endpoint by library endpoint
This commit is contained in:
@@ -2234,6 +2234,7 @@ paths:
|
|||||||
example: com.plexapp.plugins.library
|
example: com.plexapp.plugins.library
|
||||||
allowSync:
|
allowSync:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
example: false
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
Meta:
|
Meta:
|
||||||
@@ -2508,7 +2509,7 @@ paths:
|
|||||||
showOrdering:
|
showOrdering:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Setting that indicates the episode ordering for the show
|
Setting that indicates the episode ordering for the show.
|
||||||
None = Library default,
|
None = Library default,
|
||||||
tmdbAiring = The Movie Database (Aired),
|
tmdbAiring = The Movie Database (Aired),
|
||||||
aired = TheTVDB (Aired),
|
aired = TheTVDB (Aired),
|
||||||
@@ -5718,7 +5719,7 @@ paths:
|
|||||||
showOrdering:
|
showOrdering:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Setting that indicates the episode ordering for the show
|
Setting that indicates the episode ordering for the show.
|
||||||
None = Library default,
|
None = Library default,
|
||||||
tmdbAiring = The Movie Database (Aired),
|
tmdbAiring = The Movie Database (Aired),
|
||||||
aired = TheTVDB (Aired),
|
aired = TheTVDB (Aired),
|
||||||
@@ -6862,6 +6863,167 @@ paths:
|
|||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
example: 401
|
example: 401
|
||||||
|
'/library/sections/{sectionKey}/country':
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Library
|
||||||
|
summary: Search Library
|
||||||
|
operationId: get-countries-library
|
||||||
|
description: |
|
||||||
|
Retrieves a list of all the countries 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:
|
||||||
|
- type: object
|
||||||
|
required:
|
||||||
|
- size
|
||||||
|
properties:
|
||||||
|
size:
|
||||||
|
type: number
|
||||||
|
example: 50
|
||||||
|
offset:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
totalSize:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
identifier:
|
||||||
|
type: string
|
||||||
|
example: com.plexapp.plugins.library
|
||||||
|
allowSync:
|
||||||
|
type: boolean
|
||||||
|
example: false
|
||||||
|
- 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 Series
|
||||||
|
title2:
|
||||||
|
type: string
|
||||||
|
example: By Country
|
||||||
|
viewGroup:
|
||||||
|
type: string
|
||||||
|
example: secondary
|
||||||
|
Directory:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- fastKey
|
||||||
|
- key
|
||||||
|
- title
|
||||||
|
properties:
|
||||||
|
fastKey:
|
||||||
|
type: string
|
||||||
|
example: /library/sections/2/all?country=15491
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
example: '15491'
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
example: Japan
|
||||||
|
'400':
|
||||||
|
description: 'Bad Request - A parameter was not specified, or was specified incorrectly.'
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
x-speakeasy-name-override: BadRequest
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
errors:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 1000
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
x-speakeasy-error-message: true
|
||||||
|
example: X-Plex-Client-Identifier is missing
|
||||||
|
status:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 400
|
||||||
|
'401':
|
||||||
|
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
x-speakeasy-name-override: Unauthorized
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
errors:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 1001
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
x-speakeasy-error-message: true
|
||||||
|
example: User could not be authenticated
|
||||||
|
status:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 401
|
||||||
|
'404':
|
||||||
|
description: Not Found - Returned if the resource could not be found
|
||||||
|
content:
|
||||||
|
text/html:
|
||||||
|
example: |
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Not Found</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>404 Not Found</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
/library/search:
|
/library/search:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -7088,7 +7250,7 @@ paths:
|
|||||||
showOrdering:
|
showOrdering:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Setting that indicates the episode ordering for the show
|
Setting that indicates the episode ordering for the show.
|
||||||
None = Library default,
|
None = Library default,
|
||||||
tmdbAiring = The Movie Database (Aired),
|
tmdbAiring = The Movie Database (Aired),
|
||||||
aired = TheTVDB (Aired),
|
aired = TheTVDB (Aired),
|
||||||
|
|||||||
@@ -16,3 +16,4 @@ properties:
|
|||||||
example: "com.plexapp.plugins.library"
|
example: "com.plexapp.plugins.library"
|
||||||
allowSync:
|
allowSync:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
example: false
|
||||||
|
|||||||
84
src/paths/library/[sectionKey]/get-library-countries.yaml
Normal file
84
src/paths/library/[sectionKey]/get-library-countries.yaml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Library
|
||||||
|
summary: Search Library
|
||||||
|
operationId: get-countries-library
|
||||||
|
description: |
|
||||||
|
Retrieves a list of all the countries 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 Series"
|
||||||
|
title2:
|
||||||
|
type: string
|
||||||
|
example: "By Country"
|
||||||
|
viewGroup:
|
||||||
|
type: string
|
||||||
|
example: "secondary"
|
||||||
|
Directory:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- fastKey
|
||||||
|
- key
|
||||||
|
- title
|
||||||
|
properties:
|
||||||
|
fastKey:
|
||||||
|
type: string
|
||||||
|
example: "/library/sections/2/all?country=15491"
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
example: "15491"
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
example: "Japan"
|
||||||
|
"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}/country:
|
||||||
|
$ref: "./paths/library/[sectionKey]/get-library-countries.yaml"
|
||||||
|
|
||||||
/library/search:
|
/library/search:
|
||||||
$ref: "./paths/library/get-search-all-libraries.yaml"
|
$ref: "./paths/library/get-search-all-libraries.yaml"
|
||||||
|
|||||||
13
src/responses/404-html.yaml
Normal file
13
src/responses/404-html.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
description: Not Found - Returned if the resource could not be found
|
||||||
|
content:
|
||||||
|
text/html:
|
||||||
|
example: |
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Not Found</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>404 Not Found</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { validateResponseSpec } from "@utils"
|
||||||
|
import { describe, it } from "vitest"
|
||||||
|
|
||||||
|
describe("GET /library/sections/[sectionKey]/country", () => {
|
||||||
|
it("should validate the 200 response when the API spec is valid", () => {
|
||||||
|
const response = {
|
||||||
|
MediaContainer: {
|
||||||
|
size: 6,
|
||||||
|
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 Series ",
|
||||||
|
title2: "By Country",
|
||||||
|
viewGroup: "secondary",
|
||||||
|
Directory: [
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=15491",
|
||||||
|
key: "15491",
|
||||||
|
title: "Japan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=3929",
|
||||||
|
key: "3929",
|
||||||
|
title: "Netherlands"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=119944",
|
||||||
|
key: "119944",
|
||||||
|
title: "Republic of Korea"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=8343",
|
||||||
|
key: "8343",
|
||||||
|
title: "Spain"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=1761",
|
||||||
|
key: "1761",
|
||||||
|
title: "United Kingdom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fastKey: "/library/sections/2/all?country=58591",
|
||||||
|
key: "58591",
|
||||||
|
title: "United States of America"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validateResponseSpec(
|
||||||
|
"/library/sections/{sectionKey}/country",
|
||||||
|
"get",
|
||||||
|
200,
|
||||||
|
response
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should validate the 200 response with no Directories when the API spec is valid", () => {
|
||||||
|
const response = {
|
||||||
|
MediaContainer: {
|
||||||
|
size: 0,
|
||||||
|
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: "Anime",
|
||||||
|
title2: "By Country",
|
||||||
|
viewGroup: "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validateResponseSpec(
|
||||||
|
"/library/sections/{sectionKey}/country",
|
||||||
|
"get",
|
||||||
|
200,
|
||||||
|
response
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user