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", "description": "An open source Plex Media Server API Specification",
"main": "src/pms-spec.yaml", "main": "src/pms-spec.yaml",
"scripts": { "scripts": {
"dev": "redocly preview --product=redoc -d=./src", "dev": "redocly preview -d=./src",
"stats": "redocly stats ./src/pms-spec.yaml", "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": "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", "build-redocly": "redocly bundle ./src/pms-spec.yaml --ext yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
@@ -18,7 +18,8 @@
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.1.0", "@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", "@types/node": "^22.5.0",
"swagger-cli": "^4.0.4", "swagger-cli": "^4.0.4",
"typescript": "^5.5.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 By default this is 50
schema: schema:
type: integer type: integer
example: 0 default: 50
example: 50
required: false required: false

View File

@@ -5,5 +5,6 @@ description: |
By default this is 0 By default this is 0
schema: schema:
type: integer type: integer
default: 0
example: 0 example: 0
required: false 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 - 1
example: 1 example: 1
required: false required: false
- name: type - $ref: "../../../parameters/type.yaml"
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/container-start.yaml" - $ref: "../../../parameters/container-start.yaml"
- $ref: "../../../parameters/container-size.yaml" - $ref: "../../../parameters/container-size.yaml"
- $ref: "../../../parameters/accept-application-json.yaml"
responses: responses:
"200": "200":
description: The contents of the library by section and tag 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 description: the Id of the library to query
schema: schema:
type: integer type: integer
- name: type - $ref: "../../parameters/accept-application-json.yaml"
description: Plex content type to search for - $ref: "../../parameters/type.yaml"
in: query
schema:
type: integer
enum:
- 1
- 2
- 3
- 4
required: true
responses: responses:
"200": "200":
description: The contents of the library by section and type description: The contents of the library by section and type

View File

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

View File

@@ -2,10 +2,12 @@ get:
servers: servers:
- url: 'https://plex.tv/api/v2' - url: 'https://plex.tv/api/v2'
tags: tags:
- Plex - User
summary: Get UserData By Token summary: Get UserData 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:
- $ref: '../../parameters/plex-token.yaml'
responses: responses:
'200': '200':
description: Logged in user details description: Logged in user details

View File

@@ -41,6 +41,15 @@ components:
name: X-Plex-Token name: X-Plex-Token
paths: 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 # Plex Media Server endpoints
# Colon Endpoints # Colon Endpoints
@@ -116,7 +125,7 @@ paths:
/library/hashes: /library/hashes:
$ref: "./paths/library/hashes.yaml" $ref: "./paths/library/hashes.yaml"
/library/recentlyAdded: /library/recentlyAdded:
$ref: "./paths/library/recentlyadded.yaml" $ref: "./paths/library/get-recently-added.yaml"
/library/sections: /library/sections:
$ref: "./paths/library/get-all-libraries.yaml" $ref: "./paths/library/get-all-libraries.yaml"
/library/sections/{sectionId}: /library/sections/{sectionId}: