diff --git a/output/plex-media-server-spec-dereferenced.yaml b/output/plex-media-server-spec-dereferenced.yaml
index d553576c..0c1b2782 100644
--- a/output/plex-media-server-spec-dereferenced.yaml
+++ b/output/plex-media-server-spec-dereferenced.yaml
@@ -2234,6 +2234,7 @@ paths:
example: com.plexapp.plugins.library
allowSync:
type: boolean
+ example: false
- type: object
properties:
Meta:
@@ -2508,7 +2509,7 @@ paths:
showOrdering:
type: string
description: |
- Setting that indicates the episode ordering for the show
+ Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
@@ -5718,7 +5719,7 @@ paths:
showOrdering:
type: string
description: |
- Setting that indicates the episode ordering for the show
+ Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
@@ -6862,6 +6863,167 @@ paths:
type: integer
format: int32
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: |
+
+
+
+ Not Found
+
+
+ 404 Not Found
+
+
/library/search:
get:
tags:
@@ -7088,7 +7250,7 @@ paths:
showOrdering:
type: string
description: |
- Setting that indicates the episode ordering for the show
+ Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
diff --git a/src/models/MediaContainer.yaml b/src/models/MediaContainer.yaml
index 82feb14a..ac8cab8e 100644
--- a/src/models/MediaContainer.yaml
+++ b/src/models/MediaContainer.yaml
@@ -16,3 +16,4 @@ properties:
example: "com.plexapp.plugins.library"
allowSync:
type: boolean
+ example: false
diff --git a/src/paths/library/[sectionKey]/get-library-countries.yaml b/src/paths/library/[sectionKey]/get-library-countries.yaml
new file mode 100644
index 00000000..07588fbe
--- /dev/null
+++ b/src/paths/library/[sectionKey]/get-library-countries.yaml
@@ -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"
diff --git a/src/pms-spec.yaml b/src/pms-spec.yaml
index 7ba2f91e..c047572a 100644
--- a/src/pms-spec.yaml
+++ b/src/pms-spec.yaml
@@ -169,6 +169,8 @@ paths:
$ref: "./paths/library/[sectionKey]/refresh/get-refresh-library-metadata.yaml"
/library/sections/{sectionKey}/search:
$ref: "./paths/library/[sectionKey]/get-search-library.yaml"
+ /library/sections/{sectionKey}/country:
+ $ref: "./paths/library/[sectionKey]/get-library-countries.yaml"
/library/search:
$ref: "./paths/library/get-search-all-libraries.yaml"
diff --git a/src/responses/404-html.yaml b/src/responses/404-html.yaml
new file mode 100644
index 00000000..7b652795
--- /dev/null
+++ b/src/responses/404-html.yaml
@@ -0,0 +1,13 @@
+description: Not Found - Returned if the resource could not be found
+content:
+ text/html:
+ example: |
+
+
+
+ Not Found
+
+
+ 404 Not Found
+
+
diff --git a/tests/paths/library/[sectionKey]/get-library-countries.spec.ts b/tests/paths/library/[sectionKey]/get-library-countries.spec.ts
new file mode 100644
index 00000000..f4d21435
--- /dev/null
+++ b/tests/paths/library/[sectionKey]/get-library-countries.spec.ts
@@ -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
+ )
+ })
+})