Skip to content

Commit

Permalink
Merge pull request #39 from LukeHagar/improve
Browse files Browse the repository at this point in the history
Improve
  • Loading branch information
JasonLandbridge authored Aug 25, 2024
2 parents 340ab35 + 33cc477 commit 415ad39
Show file tree
Hide file tree
Showing 11 changed files with 1,156 additions and 60 deletions.
17 changes: 6 additions & 11 deletions models/PastSubscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ properties:
- string
- 'null'
renewsAt:
type:
- integer
- 'null'
description: Unix epoch datetime
format: int32
oneOf:
- $ref: './common/PlexDateTime.yaml'
- type: 'null'
endsAt:
type:
- integer
- 'null'
example: 1556281940
description: Unix epoch datetime
format: int32
oneOf:
- $ref: './common/PlexDateTime.yaml'
- type: 'null'
canceled:
type: boolean
example: false
Expand Down
5 changes: 5 additions & 0 deletions models/common/PlexDateTime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type:
- integer
example: 1556281940
description: Unix epoch datetime
format: int32
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ get:
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
operationId: getLibrary
operationId: get-library-details
parameters:
- name: sectionId
description: the Id of the library to query
description: The id of the library
in: path
schema:
type: number
example: 1000
example: 15
required: true
- name: includeDetails
description: |
Expand Down Expand Up @@ -233,28 +233,29 @@ get:
type: string
example: is
"400":
$ref: "../../responses/400.yaml"
$ref: "../../../responses/400.yaml"
"401":
$ref: "../../responses/401.yaml"
$ref: "../../../responses/401.yaml"

# TODO Move the deleteLibrary operation to its own file, there is currently a bug in the SDKEasy lint that prevents this referencing two methods from the same path url
delete:
tags:
- Library
summary: Delete Library Section
description: Delate a library using a specific section
description: Delete a library using a specific section id
operationId: deleteLibrary
parameters:
- name: sectionId
description: the Id of the library to query
description: The id of the library
in: path
schema:
type: number
example: 1000
example: 15
required: true
responses:
"200":
description: The library is deleted
"400":
$ref: "../../responses/400.yaml"
$ref: "../../../responses/400.yaml"
"401":
$ref: "../../responses/401.yaml"
$ref: "../../../responses/401.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
get:
tags:
- Library
summary: Refresh Metadata Of The Library
description: |
This endpoint Refreshes all the Metadata of the library.
operationId: get-refresh-library-metadata
parameters:
- name: sectionId
description: The id of the library
in: path
schema:
type: number
example: 15
required: true
- name: force
description: Force the refresh even if the library is already being refreshed.
in: query
schema:
type: enum
example: 0
enum:
- 0
- 1
required: false

responses:
"200":
description: The library is refreshing
"400":
$ref: "../../../../responses/400.yaml"
"401":
$ref: "../../../../responses/401.yaml"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ get:
tags:
- Library
summary: Get All Libraries
operationId: getLibraries
operationId: get-all-libraries
description: |
A library section (commonly referred to as just a library) is a collection of media.
Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media.
Expand All @@ -20,6 +20,10 @@ get:
properties:
MediaContainer:
type: object
required:
- size
- allowSync
- title1
properties:
size:
type: integer
Expand Down Expand Up @@ -56,7 +60,7 @@ get:
example: /:/resources/movie.png
key:
type: string
example: "1"
example: '1'
type:
type: string
example: movie
Expand All @@ -76,17 +80,11 @@ get:
type: string
example: 322a231a-b7f7-49f5-920f-14c61199cd30
updatedAt:
type: integer
format: int32
example: 1705615634
$ref: '../../models/common/PlexDateTime.yaml'
createdAt:
type: integer
format: int32
example: 1654131312
$ref: '../../models/common/PlexDateTime.yaml'
scannedAt:
type: integer
format: int32
example: 1705615584
$ref: '../../models/common/PlexDateTime.yaml'
content:
type: boolean
example: true
Expand Down
22 changes: 0 additions & 22 deletions paths/library/refresh.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions paths/users/post-sign-in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ post:
- url: 'https://plex.tv/api/v2'
security: []
tags:
- User
- Authentication
summary: Get User SignIn Data
description: Sign in user with username and password and return user data with Plex authentication token
operationId: post-sign-in
operationId: post-users-sign-in-data
parameters:
- $ref: "../../parameters/ClientIdentifier.yaml"
requestBody:
Expand Down
8 changes: 5 additions & 3 deletions pms-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ paths:
/library/recentlyAdded:
$ref: "./paths/library/recentlyadded.yaml"
/library/sections:
$ref: "./paths/library/libraries.yaml"
$ref: "./paths/library/get-all-libraries.yaml"
/library/sections/{sectionId}:
$ref: "./paths/library/library.yaml"
$ref: "./paths/library/[sectionId]/get-and-delete-library-details.yaml"


/library/sections/{sectionId}/{tag}:
$ref: "./paths/library/content.yaml"
/library/sections/{sectionId}/refresh:
$ref: "./paths/library/refresh.yaml"
$ref: "./paths/library/[sectionId]/refresh/get-refresh-library-metadata.yaml"
/library/sections/{sectionId}/search:
$ref: "./paths/library/content-search.yaml"
/library/metadata/{ratingKey}:
Expand Down
5 changes: 4 additions & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"main": "index.js",
"scripts": {
"bundle": "swagger-cli bundle --dereference ../pms-spec.yaml -t yaml -o ../plex-media-server-spec-dereferenced.yaml",
"test": "bun run bundle && vitest --run"
"test": "bun run bundle && vitest --run",
"setup-speakeasy-cli": "curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh",
"lint": "speakeasy lint openapi -s ../pms-spec.yaml",
"lint-bundled": "bun run bundle && speakeasy lint openapi -s ../plex-media-server-spec-dereferenced.yaml"
},
"keywords": [],
"author": "",
Expand Down
Loading

0 comments on commit 415ad39

Please sign in to comment.