Skip to content

Commit

Permalink
Added pins endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeHagar committed Jan 31, 2024
1 parent 26b46fd commit eb1573a
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plextv/plextv-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ components:
ClientIdentifier: # arbitrary name for the security scheme
description: Plex Authentication Token
type: apiKey
in: header # can be "header", "query" or "cookie"
in:
- header
- query
- cookie # can be "header", "query" or "cookie"
name: X-Plex-Client-Identifier # name of the header, query parameter or cookie
DeviceName: # arbitrary name for the security scheme
description: Primary name for the device eg. `Plex Web (Chrome)`
Expand Down
49 changes: 49 additions & 0 deletions pms/paths/pins-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
get:
servers:
- url: https://plex.tv/api/v2
tags:
- Plex.tv
summary: Get Access Token
operationId: getToken
description: Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
parameters:
- name: pinID
description: The PinID to retrieve an access token for
in: path
schema:
type: string
required: true
- name: X-Plex-Client-Identifier
description: Plex Authentication Token
in:
- header
- query
- cookie
schema:
type: string
required: true

responses:
"200":
description: Access Token
"400":
description: X-Plex-Client-Identifier is missing
content:
application/json:
schema:
type: object
properties:
errors:
type: array
items:
type: object
properties:
code:
type: number
example: 1000
message:
type: string
example: X-Plex-Client-Identifier is missing
status:
type: number
example: 400
125 changes: 125 additions & 0 deletions pms/paths/pins.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
post:
servers:
- url: https://plex.tv/api/v2
tags:
- Plex.tv
summary: Get a Pin
operationId: getPin
description: Retrieve a Pin from Plex.tv for authentication flows
parameters:
- name: X-Plex-Client-Identifier
description: Plex Authentication Token
in: header
schema:
type: string
required: true
- name: strong
description: |
Determines the kind of code returned by the API call
Strong codes are used for Pin authentication flows
Non-Strong codes are used for `Plex.tv/link`
in: query
schema:
type: boolean
default: false
required: false

responses:
"200":
description: The Pin
content:
application/json:
schema:
type: object
properties:
id:
description: PinID for use with authentication
type: number
example: 1272322473
code:
type: string
example: 3patfx1a78ukcbr7x0n9bl26t
product:
type: string
example: Plex Web
trusted:
type: boolean
qr:
description: |
a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
type: string
example: https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t
clientIdentifier:
type: string
example: Postman
location:
type: object
properties:
code:
type: string
example: US
european_union_member:
type: boolean
continent_code:
type: string
example: NA
country:
type: string
example: United States
city:
type: string
example: Austin
time_zone:
type: string
example: America/Chicago
postal_code:
type: number
example: 78732
in_privacy_restricted_country:
type: boolean
subdivisions:
type: string
example: Texas
coordinates:
type: string
example: 30.3768 -97.8935
expiresIn:
type: number
example: 1800
createdAt:
type: string
format: date-time
example: 2023-04-12T17:00:03Z
expiresAt:
type: string
format: date-time
example: 2023-04-12T17:30:03Z
authToken:
type: string
format: nullable
newRegistration:
type: string
format: nullable
"400":
description: X-Plex-Client-Identifier is missing
content:
application/json:
schema:
type: object
properties:
errors:
type: array
items:
type: object
properties:
code:
type: number
example: 1000
message:
type: string
example: X-Plex-Client-Identifier is missing
status:
type: number
example: 400
6 changes: 6 additions & 0 deletions pms/pms-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ paths:

/photo/:/transcode:
$ref: "./paths/photo-transcode.yaml"

/pins:
$ref: "./paths/pins.yaml"
/pins/{pinID}:
$ref: "./paths/pins-id.yaml"

/playlists:
$ref: "./paths/playlists.yaml"
/playlists/{playlistID}:
Expand Down

0 comments on commit eb1573a

Please sign in to comment.