added accept header

This commit is contained in:
JasonLandbridge
2024-09-03 11:40:53 +02:00
parent bea43947d0
commit 24f9bb82df
13 changed files with 81 additions and 36 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -4,7 +4,7 @@
"description": "An open source Plex Media Server API Specification",
"main": "src/pms-spec.yaml",
"scripts": {
"dev": "redocly preview --product=redoc -d=./src",
"dev": "redocly preview -d=./src",
"stats": "redocly stats ./src/pms-spec.yaml",
"build": "swagger-cli bundle --dereference ./src/pms-spec.yaml -t yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"build-redocly": "redocly bundle ./src/pms-spec.yaml --ext yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
@@ -18,7 +18,8 @@
"license": "ISC",
"devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.1.0",
"@redocly/cli": "^1.22.0",
"@redocly/cli": "latest",
"@scalar/cli": "^0.2.190",
"@types/node": "^22.5.0",
"swagger-cli": "^4.0.4",
"typescript": "^5.5.4",

View File

@@ -0,0 +1,16 @@
type: integer
enum:
- 0
- 1
- 2
- 3
- 4
example: 2
default: 0
description: |
The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries

View File

@@ -0,0 +1,9 @@
name: Accept
in: header
required: false
schema:
type: string
enum:
- application/json
- application/xml
example: application/json

View File

@@ -5,5 +5,6 @@ description: |
By default this is 50
schema:
type: integer
example: 0
default: 50
example: 50
required: false

View File

@@ -5,5 +5,6 @@ description: |
By default this is 0
schema:
type: integer
example: 0
default: 0
example: 0
required: false

View File

@@ -0,0 +1,7 @@
name: X-Plex-Token
in: query
description: Plex Authentication Token
schema:
type: string
example: CV5xoxjTpFKUzBTShsaf
required: true

21
src/parameters/type.yaml Normal file
View File

@@ -0,0 +1,21 @@
#name: type
#in: query
#description: |
# Filter the type of media to retrieve
#required: false
#schema:
# $ref: '../models/common/PlexMediaType.yaml'
#
#
name: type
in: query
description: Plex content type to search for
schema:
type: integer
enum:
- 1
- 2
- 3
- 4
example: 2
required: true

View File

@@ -79,27 +79,10 @@ get:
- 1
example: 1
required: false
- name: type
in: query
description: |
Filter the type of media to retrieve
1 is movie
2 is tv shows
3 is seasons
4 is episodes
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
schema:
type: integer
enum:
- 0
- 1
- 2
- 3
- 4
example: 2
required: false
- $ref: "../../../parameters/type.yaml"
- $ref: "../../../parameters/container-start.yaml"
- $ref: "../../../parameters/container-size.yaml"
- $ref: "../../../parameters/accept-application-json.yaml"
responses:
"200":
description: The contents of the library by section and tag

View File

@@ -29,17 +29,8 @@ get:
description: the Id of the library to query
schema:
type: integer
- name: type
description: Plex content type to search for
in: query
schema:
type: integer
enum:
- 1
- 2
- 3
- 4
required: true
- $ref: "../../parameters/accept-application-json.yaml"
- $ref: "../../parameters/type.yaml"
responses:
"200":
description: The contents of the library by section and type

View File

@@ -5,6 +5,10 @@ get:
description: |
This endpoint will return the recently added content.
operationId: getRecentlyAdded
parameters:
- $ref: "../../parameters/accept-application-json.yaml"
- $ref: "../../parameters/container-start.yaml"
- $ref: "../../parameters/container-size.yaml"
responses:
"200":
description: The recently added content

View File

@@ -2,10 +2,12 @@ get:
servers:
- url: 'https://plex.tv/api/v2'
tags:
- Plex
- User
summary: Get UserData By Token
description: Get the User data from the provided X-Plex-Token
operationId: getUserDetails
parameters:
- $ref: '../../parameters/plex-token.yaml'
responses:
'200':
description: Logged in user details

View File

@@ -41,6 +41,15 @@ components:
name: X-Plex-Token
paths:
parameters:
- name: Accept
in: header
required: true
schema:
type: string
enum: [application/json]
description: Specifies that the client expects a JSON response.
# Plex Media Server endpoints
# Colon Endpoints
@@ -116,7 +125,7 @@ paths:
/library/hashes:
$ref: "./paths/library/hashes.yaml"
/library/recentlyAdded:
$ref: "./paths/library/recentlyadded.yaml"
$ref: "./paths/library/get-recently-added.yaml"
/library/sections:
$ref: "./paths/library/get-all-libraries.yaml"
/library/sections/{sectionId}: