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"
skip_checkout: true
skip_fetch: true
add_options: '-f'
file_pattern: './output/*.yaml'
add_options: "-f"
file_pattern: "./output/*.yaml"
skip_dirty_check: true
- name: Pushes Dereferenced Specification File
@@ -42,4 +42,3 @@ jobs:
user_email: lukeslakemail@gmail.com
user_name: lukehagar
commit_message: Updating PMS Spec

View File

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

View File

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

View File

@@ -1,25 +1,28 @@
# Plex Media Server OpenAPI Specification
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
An Open Source OpenAPI Specification for Plex Media Server
## Documentation
[API Documentation](https://plexapi.dev)
[API Documentation](https://plexapi.dev)
## 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.
| Language | Repository | Releases | Other |
| -------- | ---------- | ------- | ----- |
| 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) | - |
| 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) | - |
| 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) | - |
| 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) | - |
| Language | Repository | Releases | Other |
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
| 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) | - |
| 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) | - |
| 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) | - |
| 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) | - |
## Questions?
## Questions?
Reach out to me on the [Discord Server](https://discord.gg/mxqjsJHwUm)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,18 +12,18 @@ properties:
defaultAudioLanguage:
type:
- string
- 'null'
- "null"
example: ja
description: The preferred audio language for the account
defaultSubtitleLanguage:
type:
- string
- 'null'
- "null"
example: en
description: The preferred subtitle language for the account
autoSelectSubtitle:
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:
- 0
- 1
@@ -32,13 +32,13 @@ properties:
- 0
- 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:
enum:
- 0
- 1
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:
enum:
- 0

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -113,7 +113,8 @@ get:
example: Firefly
summary:
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,
ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash'
Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee

View File

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

View File

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

View File

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

View File

@@ -89,7 +89,8 @@ get:
example: PG-13
summary:
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
even aware - so dangerous, no one's safe, as an Alliance
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/plex/x-plex-token.yaml"
responses:
'200':
"200":
description: Successful response returning an image
headers:
X-Plex-Protocol:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,17 +4,17 @@ content:
schema:
type: object
properties:
errors:
errors:
type: array
items:
type: object
properties:
code:
properties:
code:
type: number
example: 1001
message:
message:
type: string
example: User could not be authenticated
status:
status:
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 {describe, it} from 'vitest'
import { validateResponseSpec } from "../../utils/"
import { describe, it } from "vitest"
describe('GET /library/sections', () => {
it('should validate the 200 response when the API spec is valid', () => {
const response = {
"MediaContainer": {
"size": 14,
"allowSync": false,
"title1": "Plex Library",
"Directory": [
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/7/composite/1893047123",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "7",
"type": "movie",
"title": "Kids Movies",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "en-US",
"uuid": "a1b2c3d4e5f67890",
"updatedAt": 1728394001,
"createdAt": 1598476504,
"scannedAt": 1893047123,
"content": true,
"directory": true,
"contentChangedAt": 4738921,
"hidden": 0,
"Location": [
{
"id": 25,
"path": "/KidsMovies"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/13/composite/1893047124",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "13",
"type": "movie",
"title": "Kids Movies NL",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "nl-NL",
"uuid": "b2c3d4e5f67890a1",
"updatedAt": 1680007500,
"createdAt": 1680007500,
"scannedAt": 1893047124,
"content": true,
"directory": true,
"contentChangedAt": 5283714,
"hidden": 0,
"Location": [
{
"id": 23,
"path": "/KidsMoviesNL"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/1/composite/1893047130",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "1",
"type": "movie",
"title": "Movies",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "en-US",
"uuid": "c3d4e5f67890a1b2",
"updatedAt": 1728394005,
"createdAt": 1598476200,
"scannedAt": 1893047130,
"content": true,
"directory": true,
"contentChangedAt": 6379184,
"hidden": 0,
"Location": [
{
"id": 18,
"path": "/Movies"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/6/composite/1893047135",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "6",
"type": "movie",
"title": "Movies (Documentaries)",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "en-US",
"uuid": "d4e5f67890a1b2c3",
"updatedAt": 1728394010,
"createdAt": 1598476302,
"scannedAt": 1893047135,
"content": true,
"directory": true,
"contentChangedAt": 5293874,
"hidden": 0,
"Location": [
{
"id": 29,
"path": "/Movies (Documentaries)"
},
{
"id": 15,
"path": "/Plex Library/Documentaries"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/15/composite/1893047145",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "15",
"type": "movie",
"title": "Test Media Movies",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "en-US",
"uuid": "e5f67890a1b2c3d4",
"updatedAt": 1689075000,
"createdAt": 1689075000,
"scannedAt": 1893047145,
"content": true,
"directory": true,
"contentChangedAt": 5182738,
"hidden": 0,
"Location": [
{
"id": 27,
"path": "/TestMedia/Movies"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/3/composite/1893047110",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "3",
"type": "show",
"title": "Anime",
"agent": "com.plexapp.agents.hama",
"scanner": "Plex Series Scanner",
"language": "en",
"uuid": "f67890a1b2c3d4e5",
"updatedAt": 1684970001,
"createdAt": 1598476000,
"scannedAt": 1893047110,
"content": true,
"directory": true,
"contentChangedAt": 8379201,
"hidden": 0,
"Location": [
{
"id": 17,
"path": "/Anime"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/12/composite/1893047125",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "12",
"type": "show",
"title": "Kids Tv Shows NL",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "nl-NL",
"uuid": "67890a1b2c3d4e5f",
"updatedAt": 1728394002,
"createdAt": 1680007400,
"scannedAt": 1893047125,
"content": true,
"directory": true,
"contentChangedAt": 5948203,
"hidden": 0,
"Location": [
{
"id": 22,
"path": "/KidsTvShowsNL"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/14/composite/1893047145",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "14",
"type": "show",
"title": "Reality TV (NL)",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "nl-NL",
"uuid": "890a1b2c3d4e5f67",
"updatedAt": 1728394007,
"createdAt": 1601860600,
"scannedAt": 1893047145,
"content": true,
"directory": true,
"contentChangedAt": 6283720,
"hidden": 0,
"Location": [
{
"id": 26,
"path": "/Reality TV NL"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/2/composite/1893047150",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "2",
"type": "show",
"title": "TV Series ",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "en-US",
"uuid": "a1b2c3d4e5f67890",
"updatedAt": 1728394003,
"createdAt": 1598476100,
"scannedAt": 1893047150,
"content": true,
"directory": true,
"contentChangedAt": 6472184,
"hidden": 0,
"Location": [
{
"id": 32,
"path": "/TV Shows"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/16/composite/1893047155",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "16",
"type": "show",
"title": "TV Shows (Documentaries)",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "en-US",
"uuid": "b2c3d4e5f67890a1",
"updatedAt": 1689076000,
"createdAt": 1689076000,
"scannedAt": 1893047155,
"content": true,
"directory": true,
"contentChangedAt": 4920835,
"hidden": 0,
"Location": [
{
"id": 28,
"path": "/TV Shows (Documentaries)"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/17/composite/1893047155",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "17",
"type": "show",
"title": "TV Shows (Kids)",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "en-US",
"uuid": "c3d4e5f67890a1b2",
"updatedAt": 1689077000,
"createdAt": 1689077000,
"scannedAt": 1893047155,
"content": true,
"directory": true,
"contentChangedAt": 5309283,
"hidden": 0,
"Location": [
{
"id": 31,
"path": "/TV Shows (Kids)"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/10/composite/1893047170",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "10",
"type": "show",
"title": "TV Shows (Reality)",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "en-US",
"uuid": "d4e5f67890a1b2c3",
"updatedAt": 1689078000,
"createdAt": 1626704821,
"scannedAt": 1893047170,
"content": true,
"directory": true,
"contentChangedAt": 7291885,
"hidden": 0,
"Location": [
{
"id": 30,
"path": "/TV Shows (Reality)"
}
]
},
{
"allowSync": true,
"art": "/:/resources/artist-fanart.jpg",
"composite": "/library/sections/9/composite/1893047140",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/artist.png",
"key": "9",
"type": "artist",
"title": "Music",
"agent": "tv.plex.agents.music",
"scanner": "Plex Music",
"language": "en-US",
"uuid": "e5f67890a1b2c3d4",
"updatedAt": 1684974922,
"createdAt": 1598476740,
"scannedAt": 1893047140,
"content": true,
"directory": true,
"contentChangedAt": 7204063,
"hidden": 0,
"Location": [
{
"id": 24,
"path": "/Music"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/5/composite/1893047123",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/video.png",
"key": "5",
"type": "movie",
"title": "Graduation",
"agent": "com.plexapp.agents.none",
"scanner": "Plex Video Files Scanner",
"language": "xn",
"uuid": "f67890a1b2c3d4e5",
"updatedAt": 1684974733,
"createdAt": 1598475949,
"scannedAt": 1893047123,
"content": true,
"directory": true,
"contentChangedAt": 3828909,
"hidden": 0,
"Location": [
{
"id": 14,
"path": "/Plex Library/Conspiracy"
}
]
}
]
}
};
describe("GET /library/sections", () => {
it("should validate the 200 response when the API spec is valid", () => {
const response = {
MediaContainer: {
size: 14,
allowSync: false,
title1: "Plex Library",
Directory: [
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/7/composite/1893047123",
filters: true,
refreshing: false,
thumb: "/:/resources/movie.png",
key: "7",
type: "movie",
title: "Kids Movies",
agent: "tv.plex.agents.movie",
scanner: "Plex Movie",
language: "en-US",
uuid: "a1b2c3d4e5f67890",
updatedAt: 1728394001,
createdAt: 1598476504,
scannedAt: 1893047123,
content: true,
directory: true,
contentChangedAt: 4738921,
hidden: 0,
Location: [
{
id: 25,
path: "/KidsMovies"
}
]
},
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/13/composite/1893047124",
filters: true,
refreshing: false,
thumb: "/:/resources/movie.png",
key: "13",
type: "movie",
title: "Kids Movies NL",
agent: "tv.plex.agents.movie",
scanner: "Plex Movie",
language: "nl-NL",
uuid: "b2c3d4e5f67890a1",
updatedAt: 1680007500,
createdAt: 1680007500,
scannedAt: 1893047124,
content: true,
directory: true,
contentChangedAt: 5283714,
hidden: 0,
Location: [
{
id: 23,
path: "/KidsMoviesNL"
}
]
},
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/1/composite/1893047130",
filters: true,
refreshing: false,
thumb: "/:/resources/movie.png",
key: "1",
type: "movie",
title: "Movies",
agent: "tv.plex.agents.movie",
scanner: "Plex Movie",
language: "en-US",
uuid: "c3d4e5f67890a1b2",
updatedAt: 1728394005,
createdAt: 1598476200,
scannedAt: 1893047130,
content: true,
directory: true,
contentChangedAt: 6379184,
hidden: 0,
Location: [
{
id: 18,
path: "/Movies"
}
]
},
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/6/composite/1893047135",
filters: true,
refreshing: false,
thumb: "/:/resources/movie.png",
key: "6",
type: "movie",
title: "Movies (Documentaries)",
agent: "tv.plex.agents.movie",
scanner: "Plex Movie",
language: "en-US",
uuid: "d4e5f67890a1b2c3",
updatedAt: 1728394010,
createdAt: 1598476302,
scannedAt: 1893047135,
content: true,
directory: true,
contentChangedAt: 5293874,
hidden: 0,
Location: [
{
id: 29,
path: "/Movies (Documentaries)"
},
{
id: 15,
path: "/Plex Library/Documentaries"
}
]
},
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/15/composite/1893047145",
filters: true,
refreshing: false,
thumb: "/:/resources/movie.png",
key: "15",
type: "movie",
title: "Test Media Movies",
agent: "tv.plex.agents.movie",
scanner: "Plex Movie",
language: "en-US",
uuid: "e5f67890a1b2c3d4",
updatedAt: 1689075000,
createdAt: 1689075000,
scannedAt: 1893047145,
content: true,
directory: true,
contentChangedAt: 5182738,
hidden: 0,
Location: [
{
id: 27,
path: "/TestMedia/Movies"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/3/composite/1893047110",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "3",
type: "show",
title: "Anime",
agent: "com.plexapp.agents.hama",
scanner: "Plex Series Scanner",
language: "en",
uuid: "f67890a1b2c3d4e5",
updatedAt: 1684970001,
createdAt: 1598476000,
scannedAt: 1893047110,
content: true,
directory: true,
contentChangedAt: 8379201,
hidden: 0,
Location: [
{
id: 17,
path: "/Anime"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/12/composite/1893047125",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "12",
type: "show",
title: "Kids Tv Shows NL",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "nl-NL",
uuid: "67890a1b2c3d4e5f",
updatedAt: 1728394002,
createdAt: 1680007400,
scannedAt: 1893047125,
content: true,
directory: true,
contentChangedAt: 5948203,
hidden: 0,
Location: [
{
id: 22,
path: "/KidsTvShowsNL"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/14/composite/1893047145",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "14",
type: "show",
title: "Reality TV (NL)",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "nl-NL",
uuid: "890a1b2c3d4e5f67",
updatedAt: 1728394007,
createdAt: 1601860600,
scannedAt: 1893047145,
content: true,
directory: true,
contentChangedAt: 6283720,
hidden: 0,
Location: [
{
id: 26,
path: "/Reality TV NL"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/2/composite/1893047150",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "2",
type: "show",
title: "TV Series ",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "en-US",
uuid: "a1b2c3d4e5f67890",
updatedAt: 1728394003,
createdAt: 1598476100,
scannedAt: 1893047150,
content: true,
directory: true,
contentChangedAt: 6472184,
hidden: 0,
Location: [
{
id: 32,
path: "/TV Shows"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/16/composite/1893047155",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "16",
type: "show",
title: "TV Shows (Documentaries)",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "en-US",
uuid: "b2c3d4e5f67890a1",
updatedAt: 1689076000,
createdAt: 1689076000,
scannedAt: 1893047155,
content: true,
directory: true,
contentChangedAt: 4920835,
hidden: 0,
Location: [
{
id: 28,
path: "/TV Shows (Documentaries)"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/17/composite/1893047155",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "17",
type: "show",
title: "TV Shows (Kids)",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "en-US",
uuid: "c3d4e5f67890a1b2",
updatedAt: 1689077000,
createdAt: 1689077000,
scannedAt: 1893047155,
content: true,
directory: true,
contentChangedAt: 5309283,
hidden: 0,
Location: [
{
id: 31,
path: "/TV Shows (Kids)"
}
]
},
{
allowSync: true,
art: "/:/resources/show-fanart.jpg",
composite: "/library/sections/10/composite/1893047170",
filters: true,
refreshing: false,
thumb: "/:/resources/show.png",
key: "10",
type: "show",
title: "TV Shows (Reality)",
agent: "tv.plex.agents.series",
scanner: "Plex TV Series",
language: "en-US",
uuid: "d4e5f67890a1b2c3",
updatedAt: 1689078000,
createdAt: 1626704821,
scannedAt: 1893047170,
content: true,
directory: true,
contentChangedAt: 7291885,
hidden: 0,
Location: [
{
id: 30,
path: "/TV Shows (Reality)"
}
]
},
{
allowSync: true,
art: "/:/resources/artist-fanart.jpg",
composite: "/library/sections/9/composite/1893047140",
filters: true,
refreshing: false,
thumb: "/:/resources/artist.png",
key: "9",
type: "artist",
title: "Music",
agent: "tv.plex.agents.music",
scanner: "Plex Music",
language: "en-US",
uuid: "e5f67890a1b2c3d4",
updatedAt: 1684974922,
createdAt: 1598476740,
scannedAt: 1893047140,
content: true,
directory: true,
contentChangedAt: 7204063,
hidden: 0,
Location: [
{
id: 24,
path: "/Music"
}
]
},
{
allowSync: true,
art: "/:/resources/movie-fanart.jpg",
composite: "/library/sections/5/composite/1893047123",
filters: true,
refreshing: false,
thumb: "/:/resources/video.png",
key: "5",
type: "movie",
title: "Graduation",
agent: "com.plexapp.agents.none",
scanner: "Plex Video Files Scanner",
language: "xn",
uuid: "f67890a1b2c3d4e5",
updatedAt: 1684974733,
createdAt: 1598475949,
scannedAt: 1893047123,
content: true,
directory: true,
contentChangedAt: 3828909,
hidden: 0,
Location: [
{
id: 14,
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 {describe, it} from 'vitest'
import { validateResponseSpec } from "@utils"
import { describe, it } from "vitest"
describe('GET /media/providers', () => {
it('should validate the 200 response when the API spec is valid', () => {
const response = {
"MediaContainer": {
"size": 7,
"allowCameraUpload": false,
"allowChannelAccess": false,
"allowSharing": true,
"allowSync": true,
"allowTuners": false,
"backgroundProcessing": true,
"certificate": true,
"companionProxy": true,
"countryCode": "uk",
"diagnostics": "streaminglogs,databases",
"eventStream": true,
"friendlyName": "desktop-titan",
"livetv": 12,
"machineIdentifier": "cf18e74b-7e92-403f-b95a-a99e1f83f77b",
"musicAnalysis": 3,
"myPlex": true,
"myPlexMappingState": "linked",
"myPlexSigninState": "active",
"myPlexSubscription": true,
"myPlexUsername": "random.jason@outlook.com",
"offlineTranscode": 4,
"ownerFeatures": "5f36ef7d-bf9e-48a4-9399-6fddf0ea47b8,2e5687c9-9e71-4712-aec5-0198a93ff56f,3b84a6a9-bcfa-438b-b732-62cb3fcb6732,7d197f42-dc48-4e7b-a758-b6d52ffb216d",
"platform": "Linux",
"platformVersion": "18.04 (Build 12345)",
"pluginHost": true,
"pushNotifications": true,
"readOnlyLibraries": true,
"streamingBrainABRVersion": 5,
"streamingBrainVersion": 4,
"sync": true,
"transcoderActiveVideoSessions": 2,
"transcoderAudio": true,
"transcoderLyrics": true,
"transcoderSubtitles": true,
"transcoderVideo": true,
"transcoderVideoBitrates": "150,250,350,500,1000,2000,4000",
"transcoderVideoQualities": "2,3,5,7,9",
"transcoderVideoResolutions": "160,320,480,720,1080",
"updatedAt": 1835421007,
"updater": true,
"version": "3.40.9.1536-745a67c45",
"voiceSearch": true,
"MediaProvider": [
{
"identifier": "com.plexapp.plugins.library",
"title": "Random Library",
"types": "photo,audio,video",
"protocols": "stream,http",
"Feature": [
{
"key": "/library/sections/new",
"type": "content",
"Directory": [
{
"hubKey": "/hubs/home",
"title": "Main Hub"
},
{
"agent": "tv.plex.agents.movie",
"language": "fr-FR",
"refreshing": false,
"scanner": "Random Movie Scanner",
"uuid": "9b8e23c4-592c-4d3d-b2b6-7e5d1843c7a8",
"id": "5",
"key": "/library/sections/5",
"hubKey": "/hubs/sections/5",
"type": "movie",
"title": "Films",
"updatedAt": 1835420739,
"scannedAt": 1835420123,
"Pivot": [
{
"id": "recommended",
"key": "/hubs/sections/5",
"type": "hub",
"title": "Popular",
"context": "content.popular",
"symbol": "star"
},
{
"id": "library",
"key": "/library/sections/5/all?type=5",
"type": "list",
"title": "Film Library",
"context": "content.library",
"symbol": "library"
},
{
"id": "categories",
"key": "/library/sections/5/categories",
"type": "list",
"title": "Film Categories",
"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"
}
]
}
describe("GET /media/providers", () => {
it("should validate the 200 response when the API spec is valid", () => {
const response = {
MediaContainer: {
size: 7,
allowCameraUpload: false,
allowChannelAccess: false,
allowSharing: true,
allowSync: true,
allowTuners: false,
backgroundProcessing: true,
certificate: true,
companionProxy: true,
countryCode: "uk",
diagnostics: "streaminglogs,databases",
eventStream: true,
friendlyName: "desktop-titan",
livetv: 12,
machineIdentifier: "cf18e74b-7e92-403f-b95a-a99e1f83f77b",
musicAnalysis: 3,
myPlex: true,
myPlexMappingState: "linked",
myPlexSigninState: "active",
myPlexSubscription: true,
myPlexUsername: "random.jason@outlook.com",
offlineTranscode: 4,
ownerFeatures:
"5f36ef7d-bf9e-48a4-9399-6fddf0ea47b8,2e5687c9-9e71-4712-aec5-0198a93ff56f,3b84a6a9-bcfa-438b-b732-62cb3fcb6732,7d197f42-dc48-4e7b-a758-b6d52ffb216d",
platform: "Linux",
platformVersion: "18.04 (Build 12345)",
pluginHost: true,
pushNotifications: true,
readOnlyLibraries: true,
streamingBrainABRVersion: 5,
streamingBrainVersion: 4,
sync: true,
transcoderActiveVideoSessions: 2,
transcoderAudio: true,
transcoderLyrics: true,
transcoderSubtitles: true,
transcoderVideo: true,
transcoderVideoBitrates: "150,250,350,500,1000,2000,4000",
transcoderVideoQualities: "2,3,5,7,9",
transcoderVideoResolutions: "160,320,480,720,1080",
updatedAt: 1835421007,
updater: true,
version: "3.40.9.1536-745a67c45",
voiceSearch: true,
MediaProvider: [
{
identifier: "com.plexapp.plugins.library",
title: "Random Library",
types: "photo,audio,video",
protocols: "stream,http",
Feature: [
{
key: "/library/sections/new",
type: "content",
Directory: [
{
hubKey: "/hubs/home",
title: "Main Hub"
},
{
agent: "tv.plex.agents.movie",
language: "fr-FR",
refreshing: false,
scanner: "Random Movie Scanner",
uuid: "9b8e23c4-592c-4d3d-b2b6-7e5d1843c7a8",
id: "5",
key: "/library/sections/5",
hubKey: "/hubs/sections/5",
type: "movie",
title: "Films",
updatedAt: 1835420739,
scannedAt: 1835420123,
Pivot: [
{
id: "recommended",
key: "/hubs/sections/5",
type: "hub",
title: "Popular",
context: "content.popular",
symbol: "star"
},
{
id: "library",
key: "/library/sections/5/all?type=5",
type: "list",
title: "Film Library",
context: "content.library",
symbol: "library"
},
{
id: "categories",
key: "/library/sections/5/categories",
type: "list",
title: "Film Categories",
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"
}
]
}
]
}
}
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 Ajv from "ajv";
import addFormats from "ajv-formats";
import {expect} from 'vitest'
import PMSSpec from "../../output/plex-media-server-spec-dereferenced.yaml"
import Ajv from "ajv"
import addFormats from "ajv-formats"
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});
ajv.addSchema(PMSSpec, "API.yaml");
addFormats(ajv);
const validate = ajv.validate({ $ref: "API.yaml#" + pathPointer }, response)
if (!validate) {
console.error(ajv.errors)
}
// Convert JSONPath to JSON Pointer
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);
expect(validate).toBe(true)
}

View File

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

View File

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

View File

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