format project

This commit is contained in:
JasonLandbridge
2024-09-04 11:24:16 +02:00
parent 0b9c51f79f
commit d902880604
44 changed files with 3712 additions and 3109 deletions

View File

@@ -27,8 +27,8 @@ jobs:
commit_message: "build: dereferenced Plex Media Server API Spec updated" commit_message: "build: dereferenced Plex Media Server API Spec updated"
skip_checkout: true skip_checkout: true
skip_fetch: true skip_fetch: true
add_options: '-f' add_options: "-f"
file_pattern: './output/*.yaml' file_pattern: "./output/*.yaml"
skip_dirty_check: true skip_dirty_check: true
- name: Pushes Dereferenced Specification File - name: Pushes Dereferenced Specification File
@@ -42,4 +42,3 @@ jobs:
user_email: lukeslakemail@gmail.com user_email: lukeslakemail@gmail.com
user_name: lukehagar user_name: lukehagar
commit_message: Updating PMS Spec commit_message: Updating PMS Spec

View File

@@ -1,12 +1,12 @@
name: 'Project Setup' name: "Project Setup"
description: 'Setup Bun and install dependencies' description: "Setup Bun and install dependencies"
runs: runs:
using: 'composite' using: "composite"
steps: steps:
- name: Setup Bun - name: Setup Bun
uses: oven-sh/setup-bun@v2 uses: oven-sh/setup-bun@v2
with: with:
bun-version: "latest" bun-version: "latest"
- name: Clean install node_modules - name: Clean install node_modules
shell: bash shell: bash
run: bun install run: bun install

View File

@@ -1,9 +1,9 @@
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: latest speakeasyVersion: latest
sources: sources:
Plex-API: Plex-API:
inputs: inputs:
- location: ./src/pms-spec.yaml - location: ./src/pms-spec.yaml
registry: registry:
location: registry.speakeasyapi.dev/lukehagar/lukehagar/plex-api location: registry.speakeasyapi.dev/lukehagar/lukehagar/plex-api
targets: {} targets: {}

View File

@@ -1,25 +1,28 @@
# Plex Media Server OpenAPI Specification # Plex Media Server OpenAPI Specification
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/) Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
An Open Source OpenAPI Specification for Plex Media Server An Open Source OpenAPI Specification for Plex Media Server
## Documentation ## Documentation
[API Documentation](https://plexapi.dev)
[API Documentation](https://plexapi.dev)
## SDKs ## SDKs
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository. The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.
| Language | Repository | Releases | Other | | Language | Repository | Releases | Other |
| -------- | ---------- | ------- | ----- | | --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
| Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - | | Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - | | JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
| Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) | | Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
| Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - | | Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
| Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - | | Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - | | PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - | | Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | - | | C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | - |
## Questions?
## Questions?
Reach out to me on the [Discord Server](https://discord.gg/mxqjsJHwUm) Reach out to me on the [Discord Server](https://discord.gg/mxqjsJHwUm)

View File

@@ -3,9 +3,9 @@ x-examples:
Example 1: Example 1:
id: 373040866 id: 373040866
code: 7RQZ code: 7RQZ
product: '0' product: "0"
trusted: false trusted: false
qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' qr: "https://plex.tv/api/v2/pins/qr/7RQZ"
clientIdentifier: 9klpwueublnfbvlx95w83ah9 clientIdentifier: 9klpwueublnfbvlx95w83ah9
location: location:
code: NL code: NL
@@ -14,23 +14,23 @@ x-examples:
country: The Netherlands country: The Netherlands
city: Breda city: Breda
time_zone: Europe/Amsterdam time_zone: Europe/Amsterdam
postal_code: '4814' postal_code: "4814"
in_privacy_restricted_country: true in_privacy_restricted_country: true
in_privacy_restricted_region: true in_privacy_restricted_region: true
subdivisions: North Brabant subdivisions: North Brabant
coordinates: '51.5869, 4.7471' coordinates: "51.5869, 4.7471"
expiresIn: 876 expiresIn: 876
createdAt: '2024-07-16T17:03:05Z' createdAt: "2024-07-16T17:03:05Z"
expiresAt: '2024-07-16T17:18:05Z' expiresAt: "2024-07-16T17:18:05Z"
authToken: null authToken: null
newRegistration: null newRegistration: null
title: AuthPinContainer title: AuthPinContainer
examples: examples:
- id: 308667304 - id: 308667304
code: 7RQZ code: 7RQZ
product: '0' product: "0"
trusted: false trusted: false
qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' qr: "https://plex.tv/api/v2/pins/qr/7RQZ"
clientIdentifier: string clientIdentifier: string
location: location:
code: VI code: VI
@@ -43,10 +43,10 @@ examples:
in_privacy_restricted_country: true in_privacy_restricted_country: true
in_privacy_restricted_region: true in_privacy_restricted_region: true
subdivisions: Saint Thomas subdivisions: Saint Thomas
coordinates: '18.3381, -64.8941' coordinates: "18.3381, -64.8941"
expiresIn: 876 expiresIn: 876
createdAt: '2024-07-16T17:03:05Z' createdAt: "2024-07-16T17:03:05Z"
expiresAt: '2024-07-16T17:18:05Z' expiresAt: "2024-07-16T17:18:05Z"
authToken: null authToken: null
newRegistration: null newRegistration: null
required: required:
@@ -69,13 +69,13 @@ properties:
example: 7RQZ example: 7RQZ
product: product:
type: string type: string
example: '0' example: "0"
trusted: trusted:
type: boolean type: boolean
default: false default: false
qr: qr:
type: string type: string
example: 'https://plex.tv/api/v2/pins/qr/7RQZ' example: "https://plex.tv/api/v2/pins/qr/7RQZ"
clientIdentifier: clientIdentifier:
type: string type: string
description: The X-Client-Identifier used in the request description: The X-Client-Identifier used in the request
@@ -84,17 +84,17 @@ properties:
expiresIn: expiresIn:
type: integer type: integer
example: 876 example: 876
description: 'The number of seconds this pin expires, by default 900 seconds' description: "The number of seconds this pin expires, by default 900 seconds"
default: 900 default: 900
createdAt: createdAt:
type: string type: string
example: '2024-07-16T17:03:05Z' example: "2024-07-16T17:03:05Z"
format: date-time format: date-time
expiresAt: expiresAt:
type: string type: string
format: date-time format: date-time
example: '2024-07-16T17:18:05Z' example: "2024-07-16T17:18:05Z"
authToken: authToken:
type: 'null' type: "null"
newRegistration: newRegistration:
type: 'null' type: "null"

View File

@@ -9,7 +9,7 @@ examples:
sharedServers: [] sharedServers: []
sharedSources: [] sharedSources: []
status: accepted status: accepted
thumb: 'https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578' thumb: "https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578"
title: username123 title: username123
username: username123 username: username123
uuid: 7d1916e0d8f6e76b uuid: 7d1916e0d8f6e76b
@@ -38,7 +38,7 @@ properties:
- null - null
type: type:
- string - string
- 'null' - "null"
description: The account full name description: The account full name
home: home:
type: boolean type: boolean
@@ -67,7 +67,7 @@ properties:
description: Current friend request status description: Current friend request status
thumb: thumb:
type: string type: string
example: 'https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578' example: "https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578"
format: uri format: uri
description: URL of the account thumbnail description: URL of the account thumbnail
title: title:

View File

@@ -1,6 +1,6 @@
title: GeoData title: GeoData
type: object type: object
description: 'Geo location data' description: "Geo location data"
examples: examples:
- code: VI - code: VI
continent_code: NA continent_code: NA
@@ -12,7 +12,7 @@ examples:
in_privacy_restricted_country: true in_privacy_restricted_country: true
in_privacy_restricted_region: true in_privacy_restricted_region: true
subdivisions: Saint Thomas subdivisions: Saint Thomas
coordinates: '18.3381, -64.8941' coordinates: "18.3381, -64.8941"
required: required:
- code - code
- continent_code - continent_code
@@ -71,5 +71,5 @@ properties:
example: Saint Thomas example: Saint Thomas
coordinates: coordinates:
type: string type: string
description: 'The geographical coordinates (latitude, longitude) of the location.' description: "The geographical coordinates (latitude, longitude) of the location."
example: '18.3381, -64.8941' example: "18.3381, -64.8941"

View File

@@ -20,19 +20,19 @@ properties:
id: id:
type: type:
- string - string
- 'null' - "null"
mode: mode:
type: type:
- string - string
- 'null' - "null"
renewsAt: renewsAt:
oneOf: oneOf:
- $ref: './common/PlexDateTime.yaml' - $ref: "./common/PlexDateTime.yaml"
- type: 'null' - type: "null"
endsAt: endsAt:
oneOf: oneOf:
- $ref: './common/PlexDateTime.yaml' - $ref: "./common/PlexDateTime.yaml"
- type: 'null' - type: "null"
canceled: canceled:
type: boolean type: boolean
example: false example: false
@@ -67,7 +67,7 @@ properties:
transfer: transfer:
type: type:
- string - string
- 'null' - "null"
state: state:
example: ended example: ended
enum: enum:
@@ -83,4 +83,4 @@ properties:
paymentMethodId: paymentMethodId:
type: type:
- integer - integer
- 'null' - "null"

View File

@@ -73,8 +73,8 @@ properties:
description: Date the account subscribed to Plex Pass description: Date the account subscribed to Plex Pass
type: type:
- string - string
- 'null' - "null"
example: '2021-04-12T18:21:12Z' example: "2021-04-12T18:21:12Z"
status: status:
description: String representation of subscriptionActive description: String representation of subscriptionActive
example: Inactive example: Inactive
@@ -85,9 +85,9 @@ properties:
description: Payment service used for your Plex Pass subscription description: Payment service used for your Plex Pass subscription
type: type:
- string - string
- 'null' - "null"
plan: plan:
description: Name of Plex Pass subscription plan description: Name of Plex Pass subscription plan
type: type:
- string - string
- 'null' - "null"

View File

@@ -2,8 +2,8 @@ title: UserPlexAccount
type: object type: object
examples: examples:
- adsConsent: true - adsConsent: true
adsConsentReminderAt: '2019-08-24T14:15:22Z' adsConsentReminderAt: "2019-08-24T14:15:22Z"
adsConsentSetAt: '2019-08-24T14:15:22Z' adsConsentSetAt: "2019-08-24T14:15:22Z"
anonymous: false anonymous: false
authToken: CxoUzBTSV5hsxjTpFKaf authToken: CxoUzBTSV5hsxjTpFKaf
backupCodesCreated: false backupCodesCreated: false
@@ -29,14 +29,14 @@ examples:
- id: string - id: string
mode: string mode: string
renewsAt: string renewsAt: string
endsAt: '1556281940' endsAt: "1556281940"
canceled: '0' canceled: "0"
gracePeriod: '0' gracePeriod: "0"
onHold: '0' onHold: "0"
canReactivate: '0' canReactivate: "0"
canUpgrade: '0' canUpgrade: "0"
canDowngrade: '0' canDowngrade: "0"
canConvert: '0' canConvert: "0"
type: plexpass type: plexpass
transfer: string transfer: string
state: ended state: ended
@@ -58,10 +58,10 @@ examples:
restricted: false restricted: false
roles: roles:
- string - string
scrobbleTypes: '' scrobbleTypes: ""
services: services:
- identifier: metadata-dev - identifier: metadata-dev
endpoint: 'https://epg.provider.plex.tv' endpoint: "https://epg.provider.plex.tv"
token: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv token: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv
secret: string secret: string
status: online status: online
@@ -69,7 +69,7 @@ examples:
features: features:
- Android - Dolby Vision - Android - Dolby Vision
active: true active: true
subscribedAt: '2021-04-12T18:21:12Z' subscribedAt: "2021-04-12T18:21:12Z"
status: Inactive status: Inactive
paymentService: string paymentService: string
plan: string plan: string
@@ -78,11 +78,11 @@ examples:
- features: - features:
- Android - Dolby Vision - Android - Dolby Vision
active: true active: true
subscribedAt: '2021-04-12T18:21:12Z' subscribedAt: "2021-04-12T18:21:12Z"
status: Inactive status: Inactive
paymentService: string paymentService: string
plan: string plan: string
thumb: 'https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101' thumb: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101"
title: UsernameTitle title: UsernameTitle
trials: trials:
- {} - {}
@@ -132,24 +132,24 @@ properties:
adsConsent: adsConsent:
type: type:
- boolean - boolean
- 'null' - "null"
description: Unknown description: Unknown
adsConsentReminderAt: adsConsentReminderAt:
type: type:
- string - string
- 'null' - "null"
description: Unknown description: Unknown
format: date-time format: date-time
adsConsentSetAt: adsConsentSetAt:
type: type:
- string - string
- 'null' - "null"
description: Unknown description: Unknown
format: date-time format: date-time
anonymous: anonymous:
type: type:
- boolean - boolean
- 'null' - "null"
description: Unknown description: Unknown
default: false default: false
authToken: authToken:
@@ -192,7 +192,7 @@ properties:
description: List of devices your allowed to use with this account description: List of devices your allowed to use with this account
items: items:
type: string type: string
example: '[]' example: "[]"
guest: guest:
type: boolean type: boolean
description: If the account is a Plex Home guest user description: If the account is a Plex Home guest user
@@ -227,7 +227,7 @@ properties:
locale: locale:
type: type:
- string - string
- 'null' - "null"
description: The account locale description: The account locale
mailingListActive: mailingListActive:
type: boolean type: boolean
@@ -245,7 +245,7 @@ properties:
format: int32 format: int32
pin: pin:
type: string type: string
description: '[Might be removed] The hashed Plex Home PIN ' description: "[Might be removed] The hashed Plex Home PIN "
deprecated: true deprecated: true
profile: profile:
$ref: ./UserProfile.yaml $ref: ./UserProfile.yaml
@@ -264,7 +264,7 @@ properties:
default: false default: false
roles: roles:
type: array type: array
description: '[Might be removed] List of account roles. Plexpass membership listed here' description: "[Might be removed] List of account roles. Plexpass membership listed here"
items: items:
type: string type: string
scrobbleTypes: scrobbleTypes:
@@ -286,17 +286,17 @@ properties:
example: metadata-dev example: metadata-dev
endpoint: endpoint:
type: string type: string
example: 'https://epg.provider.plex.tv' example: "https://epg.provider.plex.tv"
format: uri format: uri
token: token:
type: type:
- string - string
- 'null' - "null"
example: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv example: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv
secret: secret:
type: type:
- string - string
- 'null' - "null"
status: status:
example: online example: online
enum: enum:
@@ -308,7 +308,7 @@ properties:
subscriptionDescription: subscriptionDescription:
type: type:
- string - string
- 'null' - "null"
description: Description of the Plex Pass subscription description: Description of the Plex Pass subscription
subscriptions: subscriptions:
type: array type: array
@@ -318,7 +318,7 @@ properties:
type: string type: string
description: URL of the account thumbnail description: URL of the account thumbnail
format: uri format: uri
example: 'https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101' example: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101"
title: title:
type: string type: string
description: The title of the account (username or friendly name) description: The title of the account (username or friendly name)

View File

@@ -12,18 +12,18 @@ properties:
defaultAudioLanguage: defaultAudioLanguage:
type: type:
- string - string
- 'null' - "null"
example: ja example: ja
description: The preferred audio language for the account description: The preferred audio language for the account
defaultSubtitleLanguage: defaultSubtitleLanguage:
type: type:
- string - string
- 'null' - "null"
example: en example: en
description: The preferred subtitle language for the account description: The preferred subtitle language for the account
autoSelectSubtitle: autoSelectSubtitle:
example: 1 example: 1
description: 'The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled)' description: "The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled)"
enum: enum:
- 0 - 0
- 1 - 1
@@ -32,13 +32,13 @@ properties:
- 0 - 0
- 1 - 1
example: 1 example: 1
description: 'The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles)' description: "The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles)"
defaultSubtitleForced: defaultSubtitleForced:
enum: enum:
- 0 - 0
- 1 - 1
example: 0 example: 0
description: 'The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles)' description: "The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles)"
watchedIndicator: watchedIndicator:
enum: enum:
- 0 - 0

View File

@@ -2,4 +2,4 @@ type:
- integer - integer
example: 1556281940 example: 1556281940
description: Unix epoch datetime description: Unix epoch datetime
format: int32 format: int32

View File

@@ -5,4 +5,3 @@ schema:
type: integer type: integer
example: 9518 example: 9518
required: true required: true

View File

@@ -1,5 +1,5 @@
name: sectionKey name: sectionKey
description: | description: |
The unique key of the Plex library. The unique key of the Plex library.
Note: This is unique in the context of the Plex server. Note: This is unique in the context of the Plex server.
in: path in: path
@@ -8,4 +8,3 @@ schema:
format: int32 format: int32
example: 9518 example: 9518
required: true required: true

View File

@@ -4,4 +4,3 @@ required: false
schema: schema:
type: string type: string
example: "Linux" example: "Linux"

View File

@@ -4,12 +4,12 @@ get:
summary: Get the timeline for a media item summary: Get the timeline for a media item
description: Get the timeline for a media item description: Get the timeline for a media item
operationId: getTimeline operationId: getTimeline
parameters: parameters:
- name: ratingKey - name: ratingKey
description: The rating key of the media item description: The rating key of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 23409 example: 23409
@@ -17,7 +17,7 @@ get:
description: The key of the media item to get the timeline for description: The key of the media item to get the timeline for
required: true required: true
in: query in: query
schema: schema:
type: string type: string
example: "/library/metadata/23409" example: "/library/metadata/23409"
@@ -25,7 +25,7 @@ get:
description: The state of the media item description: The state of the media item
required: true required: true
in: query in: query
schema: schema:
type: string type: string
enum: ["playing", "paused", "stopped"] enum: ["playing", "paused", "stopped"]
example: "playing" example: "playing"
@@ -34,7 +34,7 @@ get:
description: Whether the media item has MDE description: Whether the media item has MDE
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 1 example: 1
@@ -42,7 +42,7 @@ get:
description: The time of the media item description: The time of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 2000 example: 2000
@@ -50,7 +50,7 @@ get:
description: The duration of the media item description: The duration of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 10000 example: 10000
@@ -58,7 +58,7 @@ get:
description: The context of the media item description: The context of the media item
required: true required: true
in: query in: query
schema: schema:
type: string type: string
example: "home:hub.continueWatching" example: "home:hub.continueWatching"
@@ -66,7 +66,7 @@ get:
description: The play queue item ID of the media item description: The play queue item ID of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 1 example: 1
@@ -74,7 +74,7 @@ get:
description: The playback time of the media item description: The playback time of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 2000 example: 2000
@@ -82,7 +82,7 @@ get:
description: The row of the media item description: The row of the media item
required: true required: true
in: query in: query
schema: schema:
type: number type: number
example: 1 example: 1

View File

@@ -1,13 +1,13 @@
get: get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
tags: tags:
- Plex - Plex
summary: Get Companions Data summary: Get Companions Data
description: Get Companions Data description: Get Companions Data
operationId: getCompanionsData operationId: getCompanionsData
responses: responses:
'200': "200":
description: Companions Data description: Companions Data
content: content:
application/json: application/json:
@@ -28,21 +28,21 @@ get:
example: tv.plex.sonos example: tv.plex.sonos
baseURL: baseURL:
type: string type: string
example: 'https://sonos.plex.tv' example: "https://sonos.plex.tv"
format: uri format: uri
title: title:
type: string type: string
example: Sonos example: Sonos
linkURL: linkURL:
type: string type: string
example: 'https://sonos.plex.tv/link' example: "https://sonos.plex.tv/link"
provides: provides:
type: string type: string
example: 'client,player' example: "client,player"
token: token:
type: string type: string
description: The plex authtoken used to identify with description: The plex authtoken used to identify with
'400': "400":
$ref: ../../responses/400.yaml $ref: ../../responses/400.yaml
'401': "401":
$ref: ../../responses/401.yaml $ref: ../../responses/401.yaml

View File

@@ -1,13 +1,13 @@
get: get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
tags: tags:
- Plex - Plex
summary: Get list of friends of the user logged in summary: Get list of friends of the user logged in
description: Get friends of provided auth token. description: Get friends of provided auth token.
operationId: getUserFriends operationId: getUserFriends
responses: responses:
'200': "200":
description: Friends Data description: Friends Data
content: content:
application/json: application/json:
@@ -15,7 +15,7 @@ get:
type: array type: array
items: items:
$ref: ../../models/Friend.yaml $ref: ../../models/Friend.yaml
'400': "400":
$ref: '../../responses/400.yaml' $ref: "../../responses/400.yaml"
'401': "401":
$ref: '../../responses/401.yaml' $ref: "../../responses/401.yaml"

View File

@@ -1,6 +1,6 @@
get: get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
security: [] # No security required security: [] # No security required
tags: tags:
- Plex - Plex
@@ -8,13 +8,13 @@ get:
description: Returns the geolocation and locale data of the caller description: Returns the geolocation and locale data of the caller
operationId: getGeoData operationId: getGeoData
responses: responses:
'200': "200":
description: Gets the geo location data of the user description: Gets the geo location data of the user
content: content:
application/json: application/json:
schema: schema:
$ref: ../../models/GeoData.yaml $ref: ../../models/GeoData.yaml
'400': "400":
$ref: ../../responses/400.yaml $ref: ../../responses/400.yaml
'401': "401":
$ref: ../../responses/401.yaml $ref: ../../responses/401.yaml

View File

@@ -113,7 +113,8 @@ get:
example: Firefly example: Firefly
summary: summary:
type: string type: string
example: Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is example:
Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is
the captain of the transport ship "Serenity". Mal and his crew, the captain of the transport ship "Serenity". Mal and his crew,
ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash'
Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee

View File

@@ -60,7 +60,7 @@ get:
example: /:/resources/movie.png example: /:/resources/movie.png
key: key:
type: string type: string
example: '1' example: "1"
type: type:
type: string type: string
example: movie example: movie
@@ -80,11 +80,11 @@ get:
type: string type: string
example: 322a231a-b7f7-49f5-920f-14c61199cd30 example: 322a231a-b7f7-49f5-920f-14c61199cd30
updatedAt: updatedAt:
$ref: '../../models/common/PlexDateTime.yaml' $ref: "../../models/common/PlexDateTime.yaml"
createdAt: createdAt:
$ref: '../../models/common/PlexDateTime.yaml' $ref: "../../models/common/PlexDateTime.yaml"
scannedAt: scannedAt:
$ref: '../../models/common/PlexDateTime.yaml' $ref: "../../models/common/PlexDateTime.yaml"
content: content:
type: boolean type: boolean
example: true example: true

View File

@@ -16,7 +16,7 @@ get:
description: | description: |
Adds additional elements to the response. Supported types are (Stream) Adds additional elements to the response. Supported types are (Stream)
in: query in: query
schema: schema:
type: string type: string
required: false required: false
examples: examples:

View File

@@ -18,7 +18,7 @@ get:
- $ref: "../../../../../parameters/image/upscale.yaml" - $ref: "../../../../../parameters/image/upscale.yaml"
- $ref: "../../../../../parameters/plex/x-plex-token.yaml" - $ref: "../../../../../parameters/plex/x-plex-token.yaml"
responses: responses:
'200': "200":
description: Successful response returning an image description: Successful response returning an image
headers: headers:
X-Plex-Protocol: X-Plex-Protocol:

View File

@@ -89,7 +89,8 @@ get:
example: PG-13 example: PG-13
summary: summary:
type: string type: string
example: Serenity continues the story of the TV series it was based upon example:
Serenity continues the story of the TV series it was based upon
("Firefly"). River Tam had a secret - one in which she's not ("Firefly"). River Tam had a secret - one in which she's not
even aware - so dangerous, no one's safe, as an Alliance even aware - so dangerous, no one's safe, as an Alliance
operative's sent to capture her, and all others are considered operative's sent to capture her, and all others are considered

View File

@@ -18,7 +18,7 @@ get:
- $ref: "../../../../../parameters/image/upscale.yaml" - $ref: "../../../../../parameters/image/upscale.yaml"
- $ref: "../../../../../parameters/plex/x-plex-token.yaml" - $ref: "../../../../../parameters/plex/x-plex-token.yaml"
responses: responses:
'200': "200":
description: Successful response returning an image description: Successful response returning an image
headers: headers:
X-Plex-Protocol: X-Plex-Protocol:

View File

@@ -5,10 +5,10 @@ get:
description: Retrieves media providers and their features from the Plex server. description: Retrieves media providers and their features from the Plex server.
operationId: get-media-providers operationId: get-media-providers
parameters: parameters:
- $ref: '../../../parameters/accept-application-json.yaml' - $ref: "../../../parameters/accept-application-json.yaml"
- $ref: '../../../parameters/plex/x-plex-token.yaml' - $ref: "../../../parameters/plex/x-plex-token.yaml"
responses: responses:
'200': "200":
description: Media providers and their features description: Media providers and their features
content: content:
application/json: application/json:

View File

@@ -16,15 +16,15 @@ get:
schema: schema:
type: integer type: integer
responses: responses:
'200': "200":
description: The Pin with a non-null authToken when it has been verified by the user description: The Pin with a non-null authToken when it has been verified by the user
content: content:
application/json: application/json:
schema: schema:
$ref: ../../models/AuthPinContainer.yaml $ref: ../../models/AuthPinContainer.yaml
'400': "400":
$ref: ../../responses/400-MissingIdentifier.yaml $ref: ../../responses/400-MissingIdentifier.yaml
'404': "404":
description: Not Found or Expired description: Not Found or Expired
content: content:
application/json: application/json:

View File

@@ -1,6 +1,6 @@
post: post:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
tags: tags:
- Plex - Plex
summary: Get a Pin summary: Get a Pin
@@ -21,12 +21,11 @@ post:
- $ref: ../../parameters/plex/x-plex-identifier.yaml - $ref: ../../parameters/plex/x-plex-identifier.yaml
- $ref: ../../parameters/plex/x-plex-product.yaml - $ref: ../../parameters/plex/x-plex-product.yaml
responses: responses:
'200': "200":
description: Requests a new pin id used in the authentication flow description: Requests a new pin id used in the authentication flow
content: content:
application/json: application/json:
schema: schema:
$ref: ../../models/AuthPinContainer.yaml $ref: ../../models/AuthPinContainer.yaml
'400': "400":
$ref: ../../responses/400-MissingIdentifier.yaml $ref: ../../responses/400-MissingIdentifier.yaml

View File

@@ -1,6 +1,6 @@
get: get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
security: [] security: []
tags: tags:
- Plex - Plex
@@ -34,7 +34,7 @@ get:
- 0 - 0
- 1 - 1
responses: responses:
'200': "200":
description: List of Plex Devices. This includes Plex hosted servers and clients description: List of Plex Devices. This includes Plex hosted servers and clients
content: content:
application/json: application/json:
@@ -42,7 +42,7 @@ get:
type: array type: array
items: items:
$ref: ../../models/PlexDevice.yaml $ref: ../../models/PlexDevice.yaml
'400': "400":
$ref: '../../responses/400.yaml' $ref: "../../responses/400.yaml"
'401': "401":
$ref: '../../responses/401.yaml' $ref: "../../responses/401.yaml"

View File

@@ -34,10 +34,10 @@ get:
items: items:
type: object type: object
properties: properties:
timespan: timespan:
type: integer type: integer
example: 6 example: 6
at: at:
type: integer type: integer
example: 1718384427 example: 1718384427
hostCpuUtilization: hostCpuUtilization:
@@ -55,8 +55,8 @@ get:
processMemoryUtilization: processMemoryUtilization:
type: number type: number
format: float format: float
example: 0.493 example: 0.493
"400": "400":
$ref: "../../responses/400.yaml" $ref: "../../responses/400.yaml"
"401": "401":
$ref: "../../responses/401.yaml" $ref: "../../responses/401.yaml"

View File

@@ -4,7 +4,7 @@ get:
summary: Get Session History summary: Get Session History
description: This will Retrieve a listing of all history views. description: This will Retrieve a listing of all history views.
operationId: getSessionHistory operationId: getSessionHistory
parameters: parameters:
- name: sort - name: sort
description: | description: |
Sorts the results by the specified field followed by the direction (asc, desc) Sorts the results by the specified field followed by the direction (asc, desc)
@@ -12,7 +12,7 @@ get:
schema: schema:
type: string type: string
required: false required: false
examples: examples:
viewed-at-descending: viewed-at-descending:
value: viewedAt:desc value: viewedAt:desc
viewed-at-ascending: viewed-at-ascending:
@@ -25,7 +25,7 @@ get:
description: | description: |
Filter results by those that are related to a specific users id Filter results by those that are related to a specific users id
in: query in: query
schema: schema:
type: integer type: integer
required: false required: false
example: 1 example: 1
@@ -36,7 +36,7 @@ get:
in: query in: query
schema: schema:
type: object type: object
pattern: '^[A-Za-z][A-Za-z0-9]*[>=<]{0,2}$' pattern: "^[A-Za-z][A-Za-z0-9]*[>=<]{0,2}$"
example: example:
viewed-at-greater-than: viewed-at-greater-than:
value: viewedAt> value: viewedAt>
@@ -52,7 +52,7 @@ get:
description: | description: |
Filters the results based on the id of a valid library section Filters the results based on the id of a valid library section
in: query in: query
schema: schema:
type: integer type: integer
required: false required: false
example: 12 example: 12

View File

@@ -1,22 +1,22 @@
get: get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
tags: tags:
- Authentication - Authentication
summary: Get User Data By Token summary: Get User Data By Token
description: Get the User data from the provided X-Plex-Token description: Get the User data from the provided X-Plex-Token
operationId: getUserDetails operationId: getUserDetails
parameters: parameters:
- $ref: '../../parameters/plex/x-plex-token.yaml' - $ref: "../../parameters/plex/x-plex-token.yaml"
- $ref: "../../parameters/accept-application-json.yaml" - $ref: "../../parameters/accept-application-json.yaml"
responses: responses:
'200': "200":
description: Logged in user details description: Logged in user details
content: content:
application/json: application/json:
schema: schema:
$ref: ../../models/UserPlexAccount.yaml $ref: ../../models/UserPlexAccount.yaml
'400': "400":
$ref: '../../responses/400.yaml' $ref: "../../responses/400.yaml"
'401': "401":
$ref: '../../responses/401.yaml' $ref: "../../responses/401.yaml"

View File

@@ -1,6 +1,6 @@
post: post:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: "https://plex.tv/api/v2"
security: [] security: []
tags: tags:
- Authentication - Authentication
@@ -31,7 +31,7 @@ post:
default: false default: false
description: Login credentials description: Login credentials
responses: responses:
'201': "201":
description: Returns the user account data with a valid auth token description: Returns the user account data with a valid auth token
content: content:
application/json: application/json:
@@ -51,7 +51,7 @@ post:
type: array type: array
items: items:
type: object type: object
'400': "400":
$ref: '../../responses/400.yaml' $ref: "../../responses/400.yaml"
'401': "401":
$ref: '../../responses/401.yaml' $ref: "../../responses/401.yaml"

View File

@@ -17,4 +17,4 @@ content:
example: X-Plex-Client-Identifier is missing example: X-Plex-Client-Identifier is missing
status: status:
type: integer type: integer
example: 400 example: 400

View File

@@ -4,17 +4,17 @@ content:
schema: schema:
type: object type: object
properties: properties:
errors: errors:
type: array type: array
items: items:
type: object type: object
properties: properties:
code: code:
type: number type: number
example: 1001 example: 1001
message: message:
type: string type: string
example: User could not be authenticated example: User could not be authenticated
status: status:
type: number type: number
example: 401 example: 401

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,414 +1,414 @@
import {validateResponseSpec} from "../../utils/"; import { validateResponseSpec } from "../../utils/"
import {describe, it} from 'vitest' import { describe, it } from "vitest"
describe('GET /library/sections', () => { describe("GET /library/sections", () => {
it('should validate the 200 response when the API spec is valid', () => { it("should validate the 200 response when the API spec is valid", () => {
const response = { const response = {
"MediaContainer": { MediaContainer: {
"size": 14, size: 14,
"allowSync": false, allowSync: false,
"title1": "Plex Library", title1: "Plex Library",
"Directory": [ Directory: [
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/7/composite/1893047123", composite: "/library/sections/7/composite/1893047123",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/movie.png", thumb: "/:/resources/movie.png",
"key": "7", key: "7",
"type": "movie", type: "movie",
"title": "Kids Movies", title: "Kids Movies",
"agent": "tv.plex.agents.movie", agent: "tv.plex.agents.movie",
"scanner": "Plex Movie", scanner: "Plex Movie",
"language": "en-US", language: "en-US",
"uuid": "a1b2c3d4e5f67890", uuid: "a1b2c3d4e5f67890",
"updatedAt": 1728394001, updatedAt: 1728394001,
"createdAt": 1598476504, createdAt: 1598476504,
"scannedAt": 1893047123, scannedAt: 1893047123,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 4738921, contentChangedAt: 4738921,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 25, id: 25,
"path": "/KidsMovies" path: "/KidsMovies"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/13/composite/1893047124", composite: "/library/sections/13/composite/1893047124",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/movie.png", thumb: "/:/resources/movie.png",
"key": "13", key: "13",
"type": "movie", type: "movie",
"title": "Kids Movies NL", title: "Kids Movies NL",
"agent": "tv.plex.agents.movie", agent: "tv.plex.agents.movie",
"scanner": "Plex Movie", scanner: "Plex Movie",
"language": "nl-NL", language: "nl-NL",
"uuid": "b2c3d4e5f67890a1", uuid: "b2c3d4e5f67890a1",
"updatedAt": 1680007500, updatedAt: 1680007500,
"createdAt": 1680007500, createdAt: 1680007500,
"scannedAt": 1893047124, scannedAt: 1893047124,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 5283714, contentChangedAt: 5283714,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 23, id: 23,
"path": "/KidsMoviesNL" path: "/KidsMoviesNL"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/1/composite/1893047130", composite: "/library/sections/1/composite/1893047130",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/movie.png", thumb: "/:/resources/movie.png",
"key": "1", key: "1",
"type": "movie", type: "movie",
"title": "Movies", title: "Movies",
"agent": "tv.plex.agents.movie", agent: "tv.plex.agents.movie",
"scanner": "Plex Movie", scanner: "Plex Movie",
"language": "en-US", language: "en-US",
"uuid": "c3d4e5f67890a1b2", uuid: "c3d4e5f67890a1b2",
"updatedAt": 1728394005, updatedAt: 1728394005,
"createdAt": 1598476200, createdAt: 1598476200,
"scannedAt": 1893047130, scannedAt: 1893047130,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 6379184, contentChangedAt: 6379184,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 18, id: 18,
"path": "/Movies" path: "/Movies"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/6/composite/1893047135", composite: "/library/sections/6/composite/1893047135",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/movie.png", thumb: "/:/resources/movie.png",
"key": "6", key: "6",
"type": "movie", type: "movie",
"title": "Movies (Documentaries)", title: "Movies (Documentaries)",
"agent": "tv.plex.agents.movie", agent: "tv.plex.agents.movie",
"scanner": "Plex Movie", scanner: "Plex Movie",
"language": "en-US", language: "en-US",
"uuid": "d4e5f67890a1b2c3", uuid: "d4e5f67890a1b2c3",
"updatedAt": 1728394010, updatedAt: 1728394010,
"createdAt": 1598476302, createdAt: 1598476302,
"scannedAt": 1893047135, scannedAt: 1893047135,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 5293874, contentChangedAt: 5293874,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 29, id: 29,
"path": "/Movies (Documentaries)" path: "/Movies (Documentaries)"
}, },
{ {
"id": 15, id: 15,
"path": "/Plex Library/Documentaries" path: "/Plex Library/Documentaries"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/15/composite/1893047145", composite: "/library/sections/15/composite/1893047145",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/movie.png", thumb: "/:/resources/movie.png",
"key": "15", key: "15",
"type": "movie", type: "movie",
"title": "Test Media Movies", title: "Test Media Movies",
"agent": "tv.plex.agents.movie", agent: "tv.plex.agents.movie",
"scanner": "Plex Movie", scanner: "Plex Movie",
"language": "en-US", language: "en-US",
"uuid": "e5f67890a1b2c3d4", uuid: "e5f67890a1b2c3d4",
"updatedAt": 1689075000, updatedAt: 1689075000,
"createdAt": 1689075000, createdAt: 1689075000,
"scannedAt": 1893047145, scannedAt: 1893047145,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 5182738, contentChangedAt: 5182738,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 27, id: 27,
"path": "/TestMedia/Movies" path: "/TestMedia/Movies"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/3/composite/1893047110", composite: "/library/sections/3/composite/1893047110",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "3", key: "3",
"type": "show", type: "show",
"title": "Anime", title: "Anime",
"agent": "com.plexapp.agents.hama", agent: "com.plexapp.agents.hama",
"scanner": "Plex Series Scanner", scanner: "Plex Series Scanner",
"language": "en", language: "en",
"uuid": "f67890a1b2c3d4e5", uuid: "f67890a1b2c3d4e5",
"updatedAt": 1684970001, updatedAt: 1684970001,
"createdAt": 1598476000, createdAt: 1598476000,
"scannedAt": 1893047110, scannedAt: 1893047110,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 8379201, contentChangedAt: 8379201,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 17, id: 17,
"path": "/Anime" path: "/Anime"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/12/composite/1893047125", composite: "/library/sections/12/composite/1893047125",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "12", key: "12",
"type": "show", type: "show",
"title": "Kids Tv Shows NL", title: "Kids Tv Shows NL",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "nl-NL", language: "nl-NL",
"uuid": "67890a1b2c3d4e5f", uuid: "67890a1b2c3d4e5f",
"updatedAt": 1728394002, updatedAt: 1728394002,
"createdAt": 1680007400, createdAt: 1680007400,
"scannedAt": 1893047125, scannedAt: 1893047125,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 5948203, contentChangedAt: 5948203,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 22, id: 22,
"path": "/KidsTvShowsNL" path: "/KidsTvShowsNL"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/14/composite/1893047145", composite: "/library/sections/14/composite/1893047145",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "14", key: "14",
"type": "show", type: "show",
"title": "Reality TV (NL)", title: "Reality TV (NL)",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "nl-NL", language: "nl-NL",
"uuid": "890a1b2c3d4e5f67", uuid: "890a1b2c3d4e5f67",
"updatedAt": 1728394007, updatedAt: 1728394007,
"createdAt": 1601860600, createdAt: 1601860600,
"scannedAt": 1893047145, scannedAt: 1893047145,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 6283720, contentChangedAt: 6283720,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 26, id: 26,
"path": "/Reality TV NL" path: "/Reality TV NL"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/2/composite/1893047150", composite: "/library/sections/2/composite/1893047150",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "2", key: "2",
"type": "show", type: "show",
"title": "TV Series ", title: "TV Series ",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "en-US", language: "en-US",
"uuid": "a1b2c3d4e5f67890", uuid: "a1b2c3d4e5f67890",
"updatedAt": 1728394003, updatedAt: 1728394003,
"createdAt": 1598476100, createdAt: 1598476100,
"scannedAt": 1893047150, scannedAt: 1893047150,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 6472184, contentChangedAt: 6472184,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 32, id: 32,
"path": "/TV Shows" path: "/TV Shows"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/16/composite/1893047155", composite: "/library/sections/16/composite/1893047155",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "16", key: "16",
"type": "show", type: "show",
"title": "TV Shows (Documentaries)", title: "TV Shows (Documentaries)",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "en-US", language: "en-US",
"uuid": "b2c3d4e5f67890a1", uuid: "b2c3d4e5f67890a1",
"updatedAt": 1689076000, updatedAt: 1689076000,
"createdAt": 1689076000, createdAt: 1689076000,
"scannedAt": 1893047155, scannedAt: 1893047155,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 4920835, contentChangedAt: 4920835,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 28, id: 28,
"path": "/TV Shows (Documentaries)" path: "/TV Shows (Documentaries)"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/17/composite/1893047155", composite: "/library/sections/17/composite/1893047155",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "17", key: "17",
"type": "show", type: "show",
"title": "TV Shows (Kids)", title: "TV Shows (Kids)",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "en-US", language: "en-US",
"uuid": "c3d4e5f67890a1b2", uuid: "c3d4e5f67890a1b2",
"updatedAt": 1689077000, updatedAt: 1689077000,
"createdAt": 1689077000, createdAt: 1689077000,
"scannedAt": 1893047155, scannedAt: 1893047155,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 5309283, contentChangedAt: 5309283,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 31, id: 31,
"path": "/TV Shows (Kids)" path: "/TV Shows (Kids)"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/show-fanart.jpg", art: "/:/resources/show-fanart.jpg",
"composite": "/library/sections/10/composite/1893047170", composite: "/library/sections/10/composite/1893047170",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/show.png", thumb: "/:/resources/show.png",
"key": "10", key: "10",
"type": "show", type: "show",
"title": "TV Shows (Reality)", title: "TV Shows (Reality)",
"agent": "tv.plex.agents.series", agent: "tv.plex.agents.series",
"scanner": "Plex TV Series", scanner: "Plex TV Series",
"language": "en-US", language: "en-US",
"uuid": "d4e5f67890a1b2c3", uuid: "d4e5f67890a1b2c3",
"updatedAt": 1689078000, updatedAt: 1689078000,
"createdAt": 1626704821, createdAt: 1626704821,
"scannedAt": 1893047170, scannedAt: 1893047170,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 7291885, contentChangedAt: 7291885,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 30, id: 30,
"path": "/TV Shows (Reality)" path: "/TV Shows (Reality)"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/artist-fanart.jpg", art: "/:/resources/artist-fanart.jpg",
"composite": "/library/sections/9/composite/1893047140", composite: "/library/sections/9/composite/1893047140",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/artist.png", thumb: "/:/resources/artist.png",
"key": "9", key: "9",
"type": "artist", type: "artist",
"title": "Music", title: "Music",
"agent": "tv.plex.agents.music", agent: "tv.plex.agents.music",
"scanner": "Plex Music", scanner: "Plex Music",
"language": "en-US", language: "en-US",
"uuid": "e5f67890a1b2c3d4", uuid: "e5f67890a1b2c3d4",
"updatedAt": 1684974922, updatedAt: 1684974922,
"createdAt": 1598476740, createdAt: 1598476740,
"scannedAt": 1893047140, scannedAt: 1893047140,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 7204063, contentChangedAt: 7204063,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 24, id: 24,
"path": "/Music" path: "/Music"
} }
] ]
}, },
{ {
"allowSync": true, allowSync: true,
"art": "/:/resources/movie-fanart.jpg", art: "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/5/composite/1893047123", composite: "/library/sections/5/composite/1893047123",
"filters": true, filters: true,
"refreshing": false, refreshing: false,
"thumb": "/:/resources/video.png", thumb: "/:/resources/video.png",
"key": "5", key: "5",
"type": "movie", type: "movie",
"title": "Graduation", title: "Graduation",
"agent": "com.plexapp.agents.none", agent: "com.plexapp.agents.none",
"scanner": "Plex Video Files Scanner", scanner: "Plex Video Files Scanner",
"language": "xn", language: "xn",
"uuid": "f67890a1b2c3d4e5", uuid: "f67890a1b2c3d4e5",
"updatedAt": 1684974733, updatedAt: 1684974733,
"createdAt": 1598475949, createdAt: 1598475949,
"scannedAt": 1893047123, scannedAt: 1893047123,
"content": true, content: true,
"directory": true, directory: true,
"contentChangedAt": 3828909, contentChangedAt: 3828909,
"hidden": 0, hidden: 0,
"Location": [ Location: [
{ {
"id": 14, id: 14,
"path": "/Plex Library/Conspiracy" path: "/Plex Library/Conspiracy"
} }
] ]
} }
] ]
} }
}; }
validateResponseSpec("/library/sections", "get", 200, response) validateResponseSpec("/library/sections", "get", 200, response)
}); })
}) })

View File

@@ -1,221 +1,222 @@
import {validateResponseSpec} from "@utils"; import { validateResponseSpec } from "@utils"
import {describe, it} from 'vitest' import { describe, it } from "vitest"
describe('GET /media/providers', () => { describe("GET /media/providers", () => {
it('should validate the 200 response when the API spec is valid', () => { it("should validate the 200 response when the API spec is valid", () => {
const response = { const response = {
"MediaContainer": { MediaContainer: {
"size": 7, size: 7,
"allowCameraUpload": false, allowCameraUpload: false,
"allowChannelAccess": false, allowChannelAccess: false,
"allowSharing": true, allowSharing: true,
"allowSync": true, allowSync: true,
"allowTuners": false, allowTuners: false,
"backgroundProcessing": true, backgroundProcessing: true,
"certificate": true, certificate: true,
"companionProxy": true, companionProxy: true,
"countryCode": "uk", countryCode: "uk",
"diagnostics": "streaminglogs,databases", diagnostics: "streaminglogs,databases",
"eventStream": true, eventStream: true,
"friendlyName": "desktop-titan", friendlyName: "desktop-titan",
"livetv": 12, livetv: 12,
"machineIdentifier": "cf18e74b-7e92-403f-b95a-a99e1f83f77b", machineIdentifier: "cf18e74b-7e92-403f-b95a-a99e1f83f77b",
"musicAnalysis": 3, musicAnalysis: 3,
"myPlex": true, myPlex: true,
"myPlexMappingState": "linked", myPlexMappingState: "linked",
"myPlexSigninState": "active", myPlexSigninState: "active",
"myPlexSubscription": true, myPlexSubscription: true,
"myPlexUsername": "random.jason@outlook.com", myPlexUsername: "random.jason@outlook.com",
"offlineTranscode": 4, offlineTranscode: 4,
"ownerFeatures": "5f36ef7d-bf9e-48a4-9399-6fddf0ea47b8,2e5687c9-9e71-4712-aec5-0198a93ff56f,3b84a6a9-bcfa-438b-b732-62cb3fcb6732,7d197f42-dc48-4e7b-a758-b6d52ffb216d", ownerFeatures:
"platform": "Linux", "5f36ef7d-bf9e-48a4-9399-6fddf0ea47b8,2e5687c9-9e71-4712-aec5-0198a93ff56f,3b84a6a9-bcfa-438b-b732-62cb3fcb6732,7d197f42-dc48-4e7b-a758-b6d52ffb216d",
"platformVersion": "18.04 (Build 12345)", platform: "Linux",
"pluginHost": true, platformVersion: "18.04 (Build 12345)",
"pushNotifications": true, pluginHost: true,
"readOnlyLibraries": true, pushNotifications: true,
"streamingBrainABRVersion": 5, readOnlyLibraries: true,
"streamingBrainVersion": 4, streamingBrainABRVersion: 5,
"sync": true, streamingBrainVersion: 4,
"transcoderActiveVideoSessions": 2, sync: true,
"transcoderAudio": true, transcoderActiveVideoSessions: 2,
"transcoderLyrics": true, transcoderAudio: true,
"transcoderSubtitles": true, transcoderLyrics: true,
"transcoderVideo": true, transcoderSubtitles: true,
"transcoderVideoBitrates": "150,250,350,500,1000,2000,4000", transcoderVideo: true,
"transcoderVideoQualities": "2,3,5,7,9", transcoderVideoBitrates: "150,250,350,500,1000,2000,4000",
"transcoderVideoResolutions": "160,320,480,720,1080", transcoderVideoQualities: "2,3,5,7,9",
"updatedAt": 1835421007, transcoderVideoResolutions: "160,320,480,720,1080",
"updater": true, updatedAt: 1835421007,
"version": "3.40.9.1536-745a67c45", updater: true,
"voiceSearch": true, version: "3.40.9.1536-745a67c45",
"MediaProvider": [ voiceSearch: true,
{ MediaProvider: [
"identifier": "com.plexapp.plugins.library", {
"title": "Random Library", identifier: "com.plexapp.plugins.library",
"types": "photo,audio,video", title: "Random Library",
"protocols": "stream,http", types: "photo,audio,video",
"Feature": [ protocols: "stream,http",
{ Feature: [
"key": "/library/sections/new", {
"type": "content", key: "/library/sections/new",
"Directory": [ type: "content",
{ Directory: [
"hubKey": "/hubs/home", {
"title": "Main Hub" hubKey: "/hubs/home",
}, title: "Main Hub"
{ },
"agent": "tv.plex.agents.movie", {
"language": "fr-FR", agent: "tv.plex.agents.movie",
"refreshing": false, language: "fr-FR",
"scanner": "Random Movie Scanner", refreshing: false,
"uuid": "9b8e23c4-592c-4d3d-b2b6-7e5d1843c7a8", scanner: "Random Movie Scanner",
"id": "5", uuid: "9b8e23c4-592c-4d3d-b2b6-7e5d1843c7a8",
"key": "/library/sections/5", id: "5",
"hubKey": "/hubs/sections/5", key: "/library/sections/5",
"type": "movie", hubKey: "/hubs/sections/5",
"title": "Films", type: "movie",
"updatedAt": 1835420739, title: "Films",
"scannedAt": 1835420123, updatedAt: 1835420739,
"Pivot": [ scannedAt: 1835420123,
{ Pivot: [
"id": "recommended", {
"key": "/hubs/sections/5", id: "recommended",
"type": "hub", key: "/hubs/sections/5",
"title": "Popular", type: "hub",
"context": "content.popular", title: "Popular",
"symbol": "star" context: "content.popular",
}, symbol: "star"
{ },
"id": "library", {
"key": "/library/sections/5/all?type=5", id: "library",
"type": "list", key: "/library/sections/5/all?type=5",
"title": "Film Library", type: "list",
"context": "content.library", title: "Film Library",
"symbol": "library" context: "content.library",
}, symbol: "library"
{ },
"id": "categories", {
"key": "/library/sections/5/categories", id: "categories",
"type": "list", key: "/library/sections/5/categories",
"title": "Film Categories", type: "list",
"context": "content.categories", title: "Film Categories",
"symbol": "stack" context: "content.categories",
} symbol: "stack"
] }
},
{
"agent": "tv.plex.agents.series",
"language": "de-DE",
"refreshing": false,
"scanner": "Random TV Series Scanner",
"uuid": "af5832e1-3246-4e31-9f48-b24f670d95d7",
"id": "6",
"key": "/library/sections/6",
"hubKey": "/hubs/sections/6",
"type": "show",
"title": "Shows",
"updatedAt": 1835413943,
"scannedAt": 1835413688,
"Pivot": [
{
"id": "trending",
"key": "/hubs/sections/6",
"type": "hub",
"title": "Trending Shows",
"context": "content.trending",
"symbol": "fire"
},
{
"id": "library",
"key": "/library/sections/6/all?type=6",
"type": "list",
"title": "TV Library",
"context": "content.library",
"symbol": "library"
},
{
"id": "categories",
"key": "/library/sections/6/categories",
"type": "list",
"title": "Show Categories",
"context": "content.categories",
"symbol": "stack"
}
]
}
]
},
{
"key": "/hubs/search/new",
"type": "search"
},
{
"key": "/library/matches/new",
"type": "match"
},
{
"key": "/library/metadata/new",
"type": "metadata"
},
{
"key": "/photo/:/transcode",
"type": "imagetranscoder"
},
{
"key": "/hubs/promoted/new",
"type": "promoted"
},
{
"key": "/hubs/continueWatching/new",
"type": "continuewatching"
},
{
"key": "/actions/new",
"type": "actions",
"Action": [
{
"id": "addToContinueWatching",
"key": "/actions/addToContinueWatching"
}
]
},
{
"flavor": "global",
"key": "/playlists/new",
"type": "playlist"
},
{
"flavor": "global",
"key": "/playQueues/new",
"type": "playqueue"
},
{
"key": "/library/collections/new",
"type": "collection"
},
{
"scrobbleKey": "/:/scrobble/new",
"unscrobbleKey": "/:/unscrobble/new",
"key": "/:/timeline/new",
"type": "timeline"
},
{
"type": "queryParser"
},
{
"flavor": "global",
"type": "subscribe"
},
{
"key": "/library/search/new",
"type": "universalsearch"
}
]
}
] ]
} },
} ; {
agent: "tv.plex.agents.series",
language: "de-DE",
refreshing: false,
scanner: "Random TV Series Scanner",
uuid: "af5832e1-3246-4e31-9f48-b24f670d95d7",
id: "6",
key: "/library/sections/6",
hubKey: "/hubs/sections/6",
type: "show",
title: "Shows",
updatedAt: 1835413943,
scannedAt: 1835413688,
Pivot: [
{
id: "trending",
key: "/hubs/sections/6",
type: "hub",
title: "Trending Shows",
context: "content.trending",
symbol: "fire"
},
{
id: "library",
key: "/library/sections/6/all?type=6",
type: "list",
title: "TV Library",
context: "content.library",
symbol: "library"
},
{
id: "categories",
key: "/library/sections/6/categories",
type: "list",
title: "Show Categories",
context: "content.categories",
symbol: "stack"
}
]
}
]
},
{
key: "/hubs/search/new",
type: "search"
},
{
key: "/library/matches/new",
type: "match"
},
{
key: "/library/metadata/new",
type: "metadata"
},
{
key: "/photo/:/transcode",
type: "imagetranscoder"
},
{
key: "/hubs/promoted/new",
type: "promoted"
},
{
key: "/hubs/continueWatching/new",
type: "continuewatching"
},
{
key: "/actions/new",
type: "actions",
Action: [
{
id: "addToContinueWatching",
key: "/actions/addToContinueWatching"
}
]
},
{
flavor: "global",
key: "/playlists/new",
type: "playlist"
},
{
flavor: "global",
key: "/playQueues/new",
type: "playqueue"
},
{
key: "/library/collections/new",
type: "collection"
},
{
scrobbleKey: "/:/scrobble/new",
unscrobbleKey: "/:/unscrobble/new",
key: "/:/timeline/new",
type: "timeline"
},
{
type: "queryParser"
},
{
flavor: "global",
type: "subscribe"
},
{
key: "/library/search/new",
type: "universalsearch"
}
]
}
]
}
}
validateResponseSpec("/media/providers", "get", 200, response) validateResponseSpec("/media/providers", "get", 200, response)
}); })
}) })

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,26 @@
import PMSSpec from '../../output/plex-media-server-spec-dereferenced.yaml'; import PMSSpec from "../../output/plex-media-server-spec-dereferenced.yaml"
import Ajv from "ajv"; import Ajv from "ajv"
import addFormats from "ajv-formats"; import addFormats from "ajv-formats"
import {expect} from 'vitest' import { expect } from "vitest"
export function validateResponseSpec(
path: string,
type: "get" | "post" | "delete",
statusCode: number,
response: any
): void {
const ajv = new Ajv({ allErrors: true, strict: false })
ajv.addSchema(PMSSpec, "API.yaml")
addFormats(ajv)
export function validateResponseSpec(path: string, type: 'get' | 'post' | 'delete', statusCode: number, response: any): void { // Convert JSONPath to JSON Pointer
const pathPointer = `/paths/${path.replace(/\//g, `~1`)}/${type}/responses/${statusCode}/content/application~1json/schema`
const ajv = new Ajv({allErrors: true, strict: false}); const validate = ajv.validate({ $ref: "API.yaml#" + pathPointer }, response)
ajv.addSchema(PMSSpec, "API.yaml");
addFormats(ajv);
if (!validate) {
console.error(ajv.errors)
}
// Convert JSONPath to JSON Pointer expect(validate).toBe(true)
const pathPointer = `/paths/${path.replace(/\//g, `~1`)}/${type}/responses/${statusCode}/content/application~1json/schema`
const validate = ajv.validate({$ref: "API.yaml#" + pathPointer}, response);
if (!validate) {
console.error(ajv.errors);
}
expect(validate).toBe(true);
} }

View File

@@ -1 +1 @@
export * from './import.js'; export * from "./import.js"

View File

@@ -4,16 +4,10 @@
"outDir": "./output", "outDir": "./output",
"paths": { "paths": {
"@/*": ["./src/*"], "@/*": ["./src/*"],
"@utils": [ "@utils": ["./tests/utils/index.ts"]
"./tests/utils/index.ts"
]
}, },
"types": [ "types": ["@modyfi/vite-plugin-yaml/modules"],
"@modyfi/vite-plugin-yaml/modules"
],
"skipLibCheck": true "skipLibCheck": true
}, },
"exclude": [ "exclude": ["node_modules"]
"node_modules"
]
} }

View File

@@ -1,7 +1,7 @@
import ViteYaml from '@modyfi/vite-plugin-yaml'; import ViteYaml from "@modyfi/vite-plugin-yaml"
import tsconfigPaths from 'vite-tsconfig-paths' import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from 'vite' import { defineConfig } from "vite"
export default defineConfig({ export default defineConfig({
plugins: [tsconfigPaths(), ViteYaml()], plugins: [tsconfigPaths(), ViteYaml()]
}) })