mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4dd496e24 | ||
|
|
cdda7f840f | ||
|
|
2c04752d88 | ||
|
|
242d7d78f2 | ||
|
|
779aa2dc9e | ||
|
|
0d73a769fb | ||
|
|
eeadc8c329 |
@@ -1,5 +1,4 @@
|
|||||||
/*
|
**/*
|
||||||
/docs/**/*.md
|
|
||||||
!/**/*.ts
|
!/**/*.ts
|
||||||
!/**/*.js
|
!/**/*.js
|
||||||
!/**/*.map
|
!/**/*.map
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
lockVersion: 2.0.0
|
lockVersion: 2.0.0
|
||||||
id: 16f22cbf-f23f-4419-8924-3a4b06381947
|
id: 16f22cbf-f23f-4419-8924-3a4b06381947
|
||||||
management:
|
management:
|
||||||
docChecksum: e34dac84738ebf2d447ea2b9055a6eeb
|
docChecksum: 7a43cd3413d535205cfaee20a4b6a250
|
||||||
docVersion: 0.0.3
|
docVersion: 0.0.3
|
||||||
speakeasyVersion: 1.227.0
|
speakeasyVersion: 1.267.2
|
||||||
generationVersion: 2.291.0
|
generationVersion: 2.312.1
|
||||||
releaseVersion: 0.11.0
|
releaseVersion: 0.13.1
|
||||||
configChecksum: 8ed91aa4573f3ab00f3d32ae29436c8f
|
configChecksum: 1ff69678442629cebb3690db99f39502
|
||||||
repoURL: https://github.com/LukeHagar/plexjs.git
|
repoURL: https://github.com/LukeHagar/plexjs.git
|
||||||
repoSubDirectory: .
|
repoSubDirectory: .
|
||||||
installationURL: https://github.com/LukeHagar/plexjs
|
installationURL: https://github.com/LukeHagar/plexjs
|
||||||
@@ -14,13 +14,14 @@ management:
|
|||||||
features:
|
features:
|
||||||
typescript:
|
typescript:
|
||||||
constsAndDefaults: 0.1.5
|
constsAndDefaults: 0.1.5
|
||||||
core: 3.7.0
|
core: 3.8.0
|
||||||
flattening: 2.81.1
|
flattening: 2.81.1
|
||||||
globalSecurity: 2.82.8
|
globalSecurity: 2.82.9
|
||||||
globalServerURLs: 2.82.4
|
globalServerURLs: 2.82.4
|
||||||
|
globals: 2.82.1
|
||||||
methodServerURLs: 2.82.1
|
methodServerURLs: 2.82.1
|
||||||
nameOverrides: 2.81.1
|
nameOverrides: 2.81.2
|
||||||
responseFormat: 0.2.2
|
responseFormat: 0.2.3
|
||||||
generatedFiles:
|
generatedFiles:
|
||||||
- src/sdk/server.ts
|
- src/sdk/server.ts
|
||||||
- src/sdk/media.ts
|
- src/sdk/media.ts
|
||||||
@@ -41,6 +42,7 @@ generatedFiles:
|
|||||||
- .eslintrc.js
|
- .eslintrc.js
|
||||||
- .npmignore
|
- .npmignore
|
||||||
- RUNTIMES.md
|
- RUNTIMES.md
|
||||||
|
- jsr.json
|
||||||
- package.json
|
- package.json
|
||||||
- src/index.ts
|
- src/index.ts
|
||||||
- src/lib/base64.ts
|
- src/lib/base64.ts
|
||||||
|
|||||||
21
.speakeasy/workflow.lock
Normal file
21
.speakeasy/workflow.lock
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
speakeasyVersion: 1.267.2
|
||||||
|
sources:
|
||||||
|
my-source: {}
|
||||||
|
targets:
|
||||||
|
plexjs:
|
||||||
|
source: my-source
|
||||||
|
outLocation: /github/workspace/repo
|
||||||
|
workflow:
|
||||||
|
workflowVersion: 1.0.0
|
||||||
|
speakeasyVersion: latest
|
||||||
|
sources:
|
||||||
|
my-source:
|
||||||
|
inputs:
|
||||||
|
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml
|
||||||
|
targets:
|
||||||
|
plexjs:
|
||||||
|
target: typescript
|
||||||
|
source: my-source
|
||||||
|
publish:
|
||||||
|
npm:
|
||||||
|
token: $NPM_TOKEN
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
|
speakeasyVersion: latest
|
||||||
sources:
|
sources:
|
||||||
my-source:
|
my-source:
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
113
README.md
113
README.md
@@ -31,12 +31,13 @@ yarn add @lukehagar/plexjs
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@@ -173,14 +174,15 @@ Validation errors can also occur when either method arguments or data returned f
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import * as errors from "@lukehagar/plexjs/models/errors";
|
import * as errors from "@lukehagar/plexjs/models/errors";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
result = await sdk.server.getServerCapabilities();
|
result = await plexAPI.server.getServerCapabilities();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case err instanceof errors.SDKValidationError: {
|
case err instanceof errors.SDKValidationError: {
|
||||||
@@ -223,13 +225,14 @@ You can override the default server globally by passing a server index to the `s
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
serverIdx: 0,
|
||||||
serverIdx: 0,
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@@ -253,13 +256,14 @@ The default server can also be overridden globally by passing a URL to the `serv
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
serverURL: "{protocol}://{ip}:{port}",
|
||||||
serverURL: "{protocol}://{ip}:{port}",
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@@ -275,13 +279,15 @@ The server URL can also be overridden on a per-operation basis, provided a serve
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
|
const plexAPI = new PlexAPI({
|
||||||
|
xPlexClientIdentifier: "Postman",
|
||||||
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const sdk = new PlexAPI();
|
|
||||||
|
|
||||||
const xPlexClientIdentifier = "<value>";
|
|
||||||
const strong = false;
|
const strong = false;
|
||||||
|
const xPlexClientIdentifier = "Postman";
|
||||||
|
|
||||||
const result = await sdk.plex.getPin(xPlexClientIdentifier, strong, {
|
const result = await plexAPI.plex.getPin(strong, xPlexClientIdentifier, {
|
||||||
serverURL: "https://plex.tv/api/v2",
|
serverURL: "https://plex.tv/api/v2",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -358,12 +364,13 @@ To authenticate with the API the `accessToken` parameter must be set when initia
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@@ -380,6 +387,50 @@ run();
|
|||||||
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
||||||
<!-- End Requirements [requirements] -->
|
<!-- End Requirements [requirements] -->
|
||||||
|
|
||||||
|
<!-- Start Global Parameters [global-parameters] -->
|
||||||
|
## Global Parameters
|
||||||
|
|
||||||
|
A parameter is configured globally. This parameter must be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
|
||||||
|
|
||||||
|
For example, you can set `X-Plex-Client-Identifier` to `"Postman"` at SDK initialization and then you do not have to pass the same value on calls to operations like `getPin`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
|
||||||
|
|
||||||
|
|
||||||
|
### Available Globals
|
||||||
|
|
||||||
|
The following global parameter is available. The required parameter must be set when you initialize the SDK client.
|
||||||
|
|
||||||
|
| Name | Type | Required | Description |
|
||||||
|
| ---- | ---- |:--------:| ----------- |
|
||||||
|
| xPlexClientIdentifier | string | ✔️ | The unique identifier for the client application
|
||||||
|
This is used to track the client application and its usage
|
||||||
|
(UUID, serial number, or other number unique per device)
|
||||||
|
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
|
const plexAPI = new PlexAPI({
|
||||||
|
xPlexClientIdentifier: "Postman",
|
||||||
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
const strong = false;
|
||||||
|
const xPlexClientIdentifier = "Postman";
|
||||||
|
|
||||||
|
const result = await plexAPI.plex.getPin(strong, xPlexClientIdentifier);
|
||||||
|
|
||||||
|
// Handle the result
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
|
|
||||||
|
```
|
||||||
|
<!-- End Global Parameters [global-parameters] -->
|
||||||
|
|
||||||
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|||||||
70
RELEASES.md
70
RELEASES.md
@@ -279,3 +279,73 @@ Based on:
|
|||||||
- [typescript v0.11.0] .
|
- [typescript v0.11.0] .
|
||||||
### Releases
|
### Releases
|
||||||
- [NPM v0.11.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.11.0 - .
|
- [NPM v0.11.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.11.0 - .
|
||||||
|
|
||||||
|
## 2024-03-29 16:36:42
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.228.1 (2.292.0) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.12.0] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.12.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.12.0 - .
|
||||||
|
|
||||||
|
## 2024-04-02 00:26:20
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.231.1 (2.295.1) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.12.1] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.12.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.12.1 - .
|
||||||
|
|
||||||
|
## 2024-04-13 00:23:00
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.252.0 (2.306.0) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.12.2] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.12.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.12.2 - .
|
||||||
|
|
||||||
|
## 2024-04-18 00:26:16
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.257.1 (2.308.2) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.12.3] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.12.3] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.12.3 - .
|
||||||
|
|
||||||
|
## 2024-04-19 00:26:47
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.260.6 (2.311.1) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.13.0] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.13.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.13.0 - .
|
||||||
|
|
||||||
|
## 2024-04-20 00:26:02
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.267.0 (2.312.0) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.13.0] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.13.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.13.0 - .
|
||||||
|
|
||||||
|
## 2024-04-22 16:14:48
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.267.2 (2.312.1) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [typescript v0.13.1] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.13.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.13.1 - .
|
||||||
11
USAGE.md
11
USAGE.md
@@ -2,12 +2,13 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
|
| `strong` | *boolean* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> | |
|
||||||
| `strong` | *boolean* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> |
|
| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> | Postman |
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | |
|
||||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
|
| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> | Postman |
|
||||||
@@ -26,12 +26,13 @@ Get Server Activities
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.activities.getServerActivities();
|
async function run() {
|
||||||
|
const result = await plexAPI.activities.getServerActivities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -67,14 +68,15 @@ Cancel Server Activities
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const activityUUID = "<value>";
|
const activityUUID = "<value>";
|
||||||
|
|
||||||
const result = await sdk.activities.cancelServerActivities(activityUUID);
|
const result = await plexAPI.activities.cancelServerActivities(activityUUID);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -22,15 +22,16 @@ This endpoint provides the caller with a temporary token with the same access le
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { GetTransientTokenQueryParamType, Scope } from "@lukehagar/plexjs/models/operations";
|
import { GetTransientTokenQueryParamType, Scope } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const type = GetTransientTokenQueryParamType.Delegation;
|
const type = GetTransientTokenQueryParamType.Delegation;
|
||||||
const scope = Scope.All;
|
const scope = Scope.All;
|
||||||
|
|
||||||
const result = await sdk.authentication.getTransientToken(type, scope);
|
const result = await plexAPI.authentication.getTransientToken(type, scope);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -70,14 +71,15 @@ Note: requires Plex Media Server >= 1.15.4.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const source = "server://client-identifier";
|
const source = "server://client-identifier";
|
||||||
|
|
||||||
const result = await sdk.authentication.getSourceConnectionInformation(source);
|
const result = await plexAPI.authentication.getSourceConnectionInformation(source);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ Returns a list of butler tasks
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.butler.getButlerTasks();
|
async function run() {
|
||||||
|
const result = await plexAPI.butler.getButlerTasks();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -69,12 +70,13 @@ This endpoint will attempt to start all Butler tasks that are enabled in the set
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.butler.startAllTasks();
|
async function run() {
|
||||||
|
const result = await plexAPI.butler.startAllTasks();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -111,12 +113,13 @@ This endpoint will stop all currently running tasks and remove any scheduled tas
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.butler.stopAllTasks();
|
async function run() {
|
||||||
|
const result = await plexAPI.butler.stopAllTasks();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -158,14 +161,15 @@ This endpoint will attempt to start a single Butler task that is enabled in the
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { TaskName } from "@lukehagar/plexjs/models/operations";
|
import { TaskName } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const taskName = TaskName.CleanOldBundles;
|
const taskName = TaskName.CleanOldBundles;
|
||||||
|
|
||||||
const result = await sdk.butler.startTask(taskName);
|
const result = await plexAPI.butler.startTask(taskName);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -204,14 +208,15 @@ This endpoint will stop a currently running task by name, or remove it from the
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { PathParamTaskName } from "@lukehagar/plexjs/models/operations";
|
import { PathParamTaskName } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const taskName = PathParamTaskName.BackupDatabase;
|
const taskName = PathParamTaskName.BackupDatabase;
|
||||||
|
|
||||||
const result = await sdk.butler.stopTask(taskName);
|
const result = await plexAPI.butler.stopTask(taskName);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -21,15 +21,16 @@ Get Global Hubs filtered by the parameters provided.
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { OnlyTransient } from "@lukehagar/plexjs/models/operations";
|
import { OnlyTransient } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const count = 1262.49;
|
const count = 1262.49;
|
||||||
const onlyTransient = OnlyTransient.One;
|
const onlyTransient = OnlyTransient.One;
|
||||||
|
|
||||||
const result = await sdk.hubs.getGlobalHubs(count, onlyTransient);
|
const result = await plexAPI.hubs.getGlobalHubs(count, onlyTransient);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -69,16 +70,17 @@ This endpoint will return a list of library specific hubs
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { QueryParamOnlyTransient } from "@lukehagar/plexjs/models/operations";
|
import { QueryParamOnlyTransient } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 6728.76;
|
const sectionId = 6728.76;
|
||||||
const count = 9010.22;
|
const count = 9010.22;
|
||||||
const onlyTransient = QueryParamOnlyTransient.Zero;
|
const onlyTransient = QueryParamOnlyTransient.Zero;
|
||||||
|
|
||||||
const result = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient);
|
const result = await plexAPI.hubs.getLibraryHubs(sectionId, count, onlyTransient);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -29,15 +29,16 @@ This resource returns hash values for local files
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const url = "file://C:\Image.png&type=13";
|
const url = "file://C:\Image.png&type=13";
|
||||||
const type = 4462.17;
|
const type = 4462.17;
|
||||||
|
|
||||||
const result = await sdk.library.getFileHash(url, type);
|
const result = await plexAPI.library.getFileHash(url, type);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -76,12 +77,13 @@ This endpoint will return the recently added content.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.library.getRecentlyAdded();
|
async function run() {
|
||||||
|
const result = await plexAPI.library.getRecentlyAdded();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -123,12 +125,13 @@ This allows a client to provide a rich interface around the media (e.g. allow so
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.library.getLibraries();
|
async function run() {
|
||||||
|
const result = await plexAPI.library.getLibraries();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -204,15 +207,16 @@ Each type in the library comes with a set of filters and sorts, aiding in buildi
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { IncludeDetails } from "@lukehagar/plexjs/models/operations";
|
import { IncludeDetails } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 1000;
|
const sectionId = 1000;
|
||||||
const includeDetails = IncludeDetails.Zero;
|
const includeDetails = IncludeDetails.Zero;
|
||||||
|
|
||||||
const result = await sdk.library.getLibrary(sectionId, includeDetails);
|
const result = await plexAPI.library.getLibrary(sectionId, includeDetails);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -250,14 +254,15 @@ Delate a library using a specific section
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 1000;
|
const sectionId = 1000;
|
||||||
|
|
||||||
const result = await sdk.library.deleteLibrary(sectionId);
|
const result = await plexAPI.library.deleteLibrary(sectionId);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -315,15 +320,16 @@ Fetches details from a specific section of the library identified by a section k
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Tag } from "@lukehagar/plexjs/models/operations";
|
import { Tag } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 451092;
|
const sectionId = 451092;
|
||||||
const tag = Tag.Unwatched;
|
const tag = Tag.Unwatched;
|
||||||
|
|
||||||
const result = await sdk.library.getLibraryItems(sectionId, tag);
|
const result = await plexAPI.library.getLibraryItems(sectionId, tag);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -361,14 +367,15 @@ This endpoint Refreshes the library.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 934.16;
|
const sectionId = 934.16;
|
||||||
|
|
||||||
const result = await sdk.library.refreshLibrary(sectionId);
|
const result = await plexAPI.library.refreshLibrary(sectionId);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -424,15 +431,16 @@ Each type in the library comes with a set of filters and sorts, aiding in buildi
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Type } from "@lukehagar/plexjs/models/operations";
|
import { Type } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sectionId = 933505;
|
const sectionId = 933505;
|
||||||
const type = Type.Four;
|
const type = Type.Four;
|
||||||
|
|
||||||
const result = await sdk.library.searchLibrary(sectionId, type);
|
const result = await plexAPI.library.searchLibrary(sectionId, type);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -470,14 +478,15 @@ This endpoint will return the metadata of a library item specified with the rati
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const ratingKey = 8382.31;
|
const ratingKey = 8382.31;
|
||||||
|
|
||||||
const result = await sdk.library.getMetadata(ratingKey);
|
const result = await plexAPI.library.getMetadata(ratingKey);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -515,14 +524,15 @@ This endpoint will return the children of of a library item specified with the r
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const ratingKey = 1539.14;
|
const ratingKey = 1539.14;
|
||||||
|
|
||||||
const result = await sdk.library.getMetadataChildren(ratingKey);
|
const result = await plexAPI.library.getMetadataChildren(ratingKey);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -560,12 +570,13 @@ This endpoint will return the on deck content.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.library.getOnDeck();
|
async function run() {
|
||||||
|
const result = await plexAPI.library.getOnDeck();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -23,16 +23,17 @@ This endpoint will write a single-line log message, including a level and source
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Level } from "@lukehagar/plexjs/models/operations";
|
import { Level } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const level = Level.Three;
|
const level = Level.Three;
|
||||||
const message = "Test log message";
|
const message = "Test log message";
|
||||||
const source = "Postman";
|
const source = "Postman";
|
||||||
|
|
||||||
const result = await sdk.log.logLine(level, message, source);
|
const result = await plexAPI.log.logLine(level, message, source);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -92,12 +93,13 @@ Ensure each parameter is properly URL-encoded to avoid interpretation issues.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.log.logMultiLine("level=4&message=Test%20message%201&source=postman
|
async function run() {
|
||||||
|
const result = await plexAPI.log.logMultiLine("level=4&message=Test%20message%201&source=postman
|
||||||
level=3&message=Test%20message%202&source=postman
|
level=3&message=Test%20message%202&source=postman
|
||||||
level=1&message=Test%20message%203&source=postman");
|
level=1&message=Test%20message%203&source=postman");
|
||||||
|
|
||||||
@@ -137,12 +139,13 @@ This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.log.enablePaperTrail();
|
async function run() {
|
||||||
|
const result = await plexAPI.log.enablePaperTrail();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -21,14 +21,15 @@ This will mark the provided media key as Played.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const key = 59398;
|
const key = 59398;
|
||||||
|
|
||||||
const result = await sdk.media.markPlayed(key);
|
const result = await plexAPI.media.markPlayed(key);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -65,14 +66,15 @@ This will mark the provided media key as Unplayed.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const key = 59398;
|
const key = 59398;
|
||||||
|
|
||||||
const result = await sdk.media.markUnplayed(key);
|
const result = await plexAPI.media.markUnplayed(key);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -110,16 +112,17 @@ This API command can be used to update the play progress of a media item.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const key = "<value>";
|
const key = "<value>";
|
||||||
const time = 6900.91;
|
const time = 6900.91;
|
||||||
const state = "<value>";
|
const state = "<value>";
|
||||||
|
|
||||||
const result = await sdk.media.updatePlayProgress(key, time, state);
|
const result = await plexAPI.media.updatePlayProgress(key, time, state);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -34,12 +34,13 @@ Create a new playlist. By default the playlist is blank. To create a playlist al
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { QueryParamType, Smart } from "@lukehagar/plexjs/models/operations";
|
import { QueryParamType, Smart } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.playlists.createPlaylist({
|
async function run() {
|
||||||
|
const result = await plexAPI.playlists.createPlaylist({
|
||||||
title: "<value>",
|
title: "<value>",
|
||||||
type: QueryParamType.Photo,
|
type: QueryParamType.Photo,
|
||||||
smart: Smart.One,
|
smart: Smart.One,
|
||||||
@@ -82,15 +83,16 @@ Get All Playlists given the specified filters.
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { PlaylistType, QueryParamSmart } from "@lukehagar/plexjs/models/operations";
|
import { PlaylistType, QueryParamSmart } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistType = PlaylistType.Audio;
|
const playlistType = PlaylistType.Audio;
|
||||||
const smart = QueryParamSmart.Zero;
|
const smart = QueryParamSmart.Zero;
|
||||||
|
|
||||||
const result = await sdk.playlists.getPlaylists(playlistType, smart);
|
const result = await plexAPI.playlists.getPlaylists(playlistType, smart);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -130,14 +132,15 @@ Smart playlist details contain the `content` attribute. This is the content URI
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 4109.48;
|
const playlistID = 4109.48;
|
||||||
|
|
||||||
const result = await sdk.playlists.getPlaylist(playlistID);
|
const result = await plexAPI.playlists.getPlaylist(playlistID);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -175,14 +178,15 @@ This endpoint will delete a playlist
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 216.22;
|
const playlistID = 216.22;
|
||||||
|
|
||||||
const result = await sdk.playlists.deletePlaylist(playlistID);
|
const result = await plexAPI.playlists.deletePlaylist(playlistID);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -220,16 +224,17 @@ From PMS version 1.9.1 clients can also edit playlist metadata using this endpoi
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 3915;
|
const playlistID = 3915;
|
||||||
const title = "<value>";
|
const title = "<value>";
|
||||||
const summary = "<value>";
|
const summary = "<value>";
|
||||||
|
|
||||||
const result = await sdk.playlists.updatePlaylist(playlistID, title, summary);
|
const result = await plexAPI.playlists.updatePlaylist(playlistID, title, summary);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -272,15 +277,16 @@ Note that for dumb playlists, items have a `playlistItemID` attribute which is u
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 5004.46;
|
const playlistID = 5004.46;
|
||||||
const type = 9403.59;
|
const type = 9403.59;
|
||||||
|
|
||||||
const result = await sdk.playlists.getPlaylistContents(playlistID, type);
|
const result = await plexAPI.playlists.getPlaylistContents(playlistID, type);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -319,14 +325,15 @@ Clears a playlist, only works with dumb playlists. Returns the playlist.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 1893.18;
|
const playlistID = 1893.18;
|
||||||
|
|
||||||
const result = await sdk.playlists.clearPlaylistContents(playlistID);
|
const result = await plexAPI.playlists.clearPlaylistContents(playlistID);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -365,16 +372,17 @@ With a smart playlist, passing a new `uri` parameter replaces the rules for the
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const playlistID = 8502.01;
|
const playlistID = 8502.01;
|
||||||
const uri = "server://12345/com.plexapp.plugins.library/library/metadata/1";
|
const uri = "server://12345/com.plexapp.plugins.library/library/metadata/1";
|
||||||
const playQueueID = 123;
|
const playQueueID = 123;
|
||||||
|
|
||||||
const result = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID);
|
const result = await plexAPI.playlists.addPlaylistContents(playlistID, uri, playQueueID);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -415,15 +423,16 @@ Imports m3u playlists by passing a path on the server to scan for m3u-formatted
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Force } from "@lukehagar/plexjs/models/operations";
|
import { Force } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const path = "/home/barkley/playlist.m3u";
|
const path = "/home/barkley/playlist.m3u";
|
||||||
const force = Force.Zero;
|
const force = Force.Zero;
|
||||||
|
|
||||||
const result = await sdk.playlists.uploadPlaylist(path, force);
|
const result = await plexAPI.playlists.uploadPlaylist(path, force);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ Retrieve a Pin from Plex.tv for authentication flows
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
|
const plexAPI = new PlexAPI({
|
||||||
|
xPlexClientIdentifier: "Postman",
|
||||||
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const sdk = new PlexAPI();
|
|
||||||
|
|
||||||
const xPlexClientIdentifier = "<value>";
|
|
||||||
const strong = false;
|
const strong = false;
|
||||||
|
const xPlexClientIdentifier = "Postman";
|
||||||
|
|
||||||
const result = await sdk.plex.getPin(xPlexClientIdentifier, strong);
|
const result = await plexAPI.plex.getPin(strong, xPlexClientIdentifier);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -37,13 +39,13 @@ run();
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
| Parameter | Type | Required | Description |
|
| Parameter | Type | Required | Description | Example |
|
||||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
|
| `strong` | *boolean* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> | |
|
||||||
| `strong` | *boolean* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> |
|
| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> | [object Object] |
|
||||||
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
|
||||||
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
|
||||||
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
|
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 |
|
||||||
|
|
||||||
|
|
||||||
### Response
|
### Response
|
||||||
@@ -65,13 +67,15 @@ Retrieve an Access Token from Plex.tv after the Pin has already been authenticat
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
|
const plexAPI = new PlexAPI({
|
||||||
|
xPlexClientIdentifier: "Postman",
|
||||||
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const sdk = new PlexAPI();
|
|
||||||
|
|
||||||
const pinID = "<value>";
|
const pinID = "<value>";
|
||||||
const xPlexClientIdentifier = "<value>";
|
const xPlexClientIdentifier = "Postman";
|
||||||
|
|
||||||
const result = await sdk.plex.getToken(pinID, xPlexClientIdentifier);
|
const result = await plexAPI.plex.getToken(pinID, xPlexClientIdentifier);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -82,13 +86,13 @@ run();
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
| Parameter | Type | Required | Description |
|
| Parameter | Type | Required | Description | Example |
|
||||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | |
|
||||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
|
| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> | [object Object] |
|
||||||
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
|
||||||
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
|
||||||
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
|
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 |
|
||||||
|
|
||||||
|
|
||||||
### Response
|
### Response
|
||||||
|
|||||||
@@ -33,16 +33,17 @@ This request is intended to be very fast, and called as the user types.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const query = "dylan";
|
const query = "dylan";
|
||||||
const sectionId = 1516.53;
|
const sectionId = 1516.53;
|
||||||
const limit = 5;
|
const limit = 5;
|
||||||
|
|
||||||
const result = await sdk.search.performSearch(query, sectionId, limit);
|
const result = await plexAPI.search.performSearch(query, sectionId, limit);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -85,16 +86,17 @@ Results, as well as their containing per-type hubs, contain a `distance` attribu
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const query = "dead+poop";
|
const query = "dead+poop";
|
||||||
const sectionId = 4094.8;
|
const sectionId = 4094.8;
|
||||||
const limit = 5;
|
const limit = 5;
|
||||||
|
|
||||||
const result = await sdk.search.performVoiceSearch(query, sectionId, limit);
|
const result = await plexAPI.search.performVoiceSearch(query, sectionId, limit);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -133,14 +135,15 @@ This will search the database for the string provided.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const query = "110";
|
const query = "110";
|
||||||
|
|
||||||
const result = await sdk.search.getSearchResults(query);
|
const result = await plexAPI.search.getSearchResults(query);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ Server Capabilities
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerCapabilities();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerCapabilities();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -67,12 +68,13 @@ Get Server Preferences
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerPreferences();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerPreferences();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -108,12 +110,13 @@ Get Available Clients
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getAvailableClients();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getAvailableClients();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -149,12 +152,13 @@ Get Devices
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getDevices();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getDevices();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -190,12 +194,13 @@ Get Server Identity
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerIdentity();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerIdentity();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -231,12 +236,13 @@ Returns MyPlex Account Information
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getMyPlexAccount();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getMyPlexAccount();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -274,12 +280,13 @@ Plex's Photo transcoder is used throughout the service to serve images at specif
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { MinSize, Upscale } from "@lukehagar/plexjs/models/operations";
|
import { MinSize, Upscale } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getResizedPhoto({
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getResizedPhoto({
|
||||||
width: 110,
|
width: 110,
|
||||||
height: 165,
|
height: 165,
|
||||||
opacity: 100,
|
opacity: 100,
|
||||||
@@ -324,12 +331,13 @@ Get Server List
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.server.getServerList();
|
async function run() {
|
||||||
|
const result = await plexAPI.server.getServerList();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ This will retrieve the "Now Playing" Information of the PMS.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.sessions.getSessions();
|
async function run() {
|
||||||
|
const result = await plexAPI.sessions.getSessions();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -63,12 +64,13 @@ This will Retrieve a listing of all history views.
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.sessions.getSessionHistory();
|
async function run() {
|
||||||
|
const result = await plexAPI.sessions.getSessionHistory();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -104,12 +106,13 @@ Get Transcode Sessions
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.sessions.getTranscodeSessions();
|
async function run() {
|
||||||
|
const result = await plexAPI.sessions.getTranscodeSessions();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -145,14 +148,15 @@ Stop a Transcode Session
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep";
|
const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep";
|
||||||
|
|
||||||
const result = await sdk.sessions.stopTranscodeSession(sessionKey);
|
const result = await plexAPI.sessions.stopTranscodeSession(sessionKey);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -19,14 +19,15 @@ This will return the media statistics for the server
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const timespan = 411769;
|
const timespan = 411769;
|
||||||
|
|
||||||
const result = await sdk.statistics.getStatistics(timespan);
|
const result = await plexAPI.statistics.getStatistics(timespan);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ Querying status of updates
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.updater.getUpdateStatus();
|
async function run() {
|
||||||
|
const result = await plexAPI.updater.getUpdateStatus();
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -64,14 +65,15 @@ Checking for updates
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Download } from "@lukehagar/plexjs/models/operations";
|
import { Download } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const download = Download.One;
|
const download = Download.One;
|
||||||
|
|
||||||
const result = await sdk.updater.checkForUpdates(download);
|
const result = await plexAPI.updater.checkForUpdates(download);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
@@ -110,15 +112,16 @@ Note that these two parameters are effectively mutually exclusive. The `tonight`
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { Skip, Tonight } from "@lukehagar/plexjs/models/operations";
|
import { Skip, Tonight } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function run() {
|
||||||
const tonight = Tonight.One;
|
const tonight = Tonight.One;
|
||||||
const skip = Skip.Zero;
|
const skip = Skip.Zero;
|
||||||
|
|
||||||
const result = await sdk.updater.applyUpdates(tonight, skip);
|
const result = await plexAPI.updater.applyUpdates(tonight, skip);
|
||||||
|
|
||||||
// Handle the result
|
// Handle the result
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ Get the timeline for a media item
|
|||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
import { State } from "@lukehagar/plexjs/models/operations";
|
import { State } from "@lukehagar/plexjs/models/operations";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.video.getTimeline({
|
async function run() {
|
||||||
|
const result = await plexAPI.video.getTimeline({
|
||||||
ratingKey: 716.56,
|
ratingKey: 716.56,
|
||||||
key: "<key>",
|
key: "<key>",
|
||||||
state: State.Paused,
|
state: State.Paused,
|
||||||
@@ -74,12 +75,13 @@ Begin a Universal Transcode Session
|
|||||||
```typescript
|
```typescript
|
||||||
import { PlexAPI } from "@lukehagar/plexjs";
|
import { PlexAPI } from "@lukehagar/plexjs";
|
||||||
|
|
||||||
async function run() {
|
const plexAPI = new PlexAPI({
|
||||||
const sdk = new PlexAPI({
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
xPlexClientIdentifier: "Postman",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await sdk.video.startUniversalTranscode({
|
async function run() {
|
||||||
|
const result = await plexAPI.video.startUniversalTranscode({
|
||||||
hasMDE: 8924.99,
|
hasMDE: 8924.99,
|
||||||
path: "/etc/mail",
|
path: "/etc/mail",
|
||||||
mediaIndex: 9962.95,
|
mediaIndex: 9962.95,
|
||||||
|
|||||||
4
gen.yaml
4
gen.yaml
@@ -12,13 +12,15 @@ generation:
|
|||||||
auth:
|
auth:
|
||||||
oAuth2ClientCredentialsEnabled: false
|
oAuth2ClientCredentialsEnabled: false
|
||||||
typescript:
|
typescript:
|
||||||
version: 0.11.0
|
version: 0.13.1
|
||||||
additionalDependencies:
|
additionalDependencies:
|
||||||
dependencies: {}
|
dependencies: {}
|
||||||
devDependencies: {}
|
devDependencies: {}
|
||||||
peerDependencies: {}
|
peerDependencies: {}
|
||||||
|
additionalPackageJSON: {}
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
clientServerStatusCodesAsErrors: true
|
clientServerStatusCodesAsErrors: true
|
||||||
|
enumFormat: enum
|
||||||
flattenGlobalSecurity: true
|
flattenGlobalSecurity: true
|
||||||
imports:
|
imports:
|
||||||
option: openapi
|
option: openapi
|
||||||
|
|||||||
26
jsr.json
Normal file
26
jsr.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "@lukehagar/plexjs",
|
||||||
|
"version": "0.13.1",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.ts",
|
||||||
|
"./models/errors": "./src/models/errors/index.ts",
|
||||||
|
"./models/components": "./src/models/components/index.ts",
|
||||||
|
"./models/operations": "./src/models/operations/index.ts",
|
||||||
|
"./lib/config": "./src/lib/config.ts",
|
||||||
|
"./lib/http": "./src/lib/http.ts",
|
||||||
|
"./lib/retries": "./src/lib/retries.ts",
|
||||||
|
"./lib/sdks": "./src/lib/sdks.ts",
|
||||||
|
"./types": "./src/types/index.ts"
|
||||||
|
},
|
||||||
|
"publish": {
|
||||||
|
"include": [
|
||||||
|
"LICENSE",
|
||||||
|
"README.md",
|
||||||
|
"RUNTIMES.md",
|
||||||
|
"USAGE.md",
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.11.0",
|
"version": "0.13.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.11.0",
|
"version": "0.13.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jsonpath": "^0.2.4",
|
"@types/jsonpath": "^0.2.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.11.0",
|
"version": "0.13.1",
|
||||||
"author": "LukeHagar",
|
"author": "LukeHagar",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"prepare": "npm run build"
|
"prepare": "npm run build"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"zod": ">= 3"
|
"zod": ">= 3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import { HTTPClient } from "./http";
|
import { HTTPClient } from "./http";
|
||||||
import { RetryConfig } from "./retries";
|
import { RetryConfig } from "./retries";
|
||||||
import { pathToFunc } from "./url";
|
import { Params, pathToFunc } from "./url";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the list of servers available to the SDK
|
* Contains the list of servers available to the SDK
|
||||||
@@ -27,6 +27,11 @@ export enum ServerProtocol {
|
|||||||
export type SDKOptions = {
|
export type SDKOptions = {
|
||||||
accessToken?: string | (() => Promise<string>);
|
accessToken?: string | (() => Promise<string>);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows setting the xPlexClientIdentifier parameter for all supported operations
|
||||||
|
*/
|
||||||
|
xPlexClientIdentifier?: string;
|
||||||
|
|
||||||
httpClient?: HTTPClient;
|
httpClient?: HTTPClient;
|
||||||
/**
|
/**
|
||||||
* Allows overriding the default server used by the SDK
|
* Allows overriding the default server used by the SDK
|
||||||
@@ -57,14 +62,14 @@ export type SDKOptions = {
|
|||||||
export function serverURLFromOptions(options: SDKOptions): URL | null {
|
export function serverURLFromOptions(options: SDKOptions): URL | null {
|
||||||
let serverURL = options.serverURL;
|
let serverURL = options.serverURL;
|
||||||
|
|
||||||
const serverParams = [
|
const serverParams: Params[] = [
|
||||||
{
|
{
|
||||||
protocol: options.protocol?.toString() ?? "http",
|
protocol: options.protocol ?? "http",
|
||||||
ip: options.ip?.toString() ?? "10.10.10.47",
|
ip: options.ip ?? "10.10.10.47",
|
||||||
port: options.port?.toString() ?? "32400",
|
port: options.port ?? "32400",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let params: Record<string, string> = {};
|
let params: Params = {};
|
||||||
|
|
||||||
if (!serverURL) {
|
if (!serverURL) {
|
||||||
const serverIdx = options.serverIdx ?? 0;
|
const serverIdx = options.serverIdx ?? 0;
|
||||||
@@ -79,10 +84,10 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|||||||
return new URL(u);
|
return new URL(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SDK_METADATA = Object.freeze({
|
export const SDK_METADATA = {
|
||||||
language: "typescript",
|
language: "typescript",
|
||||||
openapiDocVersion: "0.0.3",
|
openapiDocVersion: "0.0.3",
|
||||||
sdkVersion: "0.11.0",
|
sdkVersion: "0.13.1",
|
||||||
genVersion: "2.291.0",
|
genVersion: "2.312.1",
|
||||||
userAgent: "speakeasy-sdk/typescript 0.11.0 2.291.0 0.0.3 @lukehagar/plexjs",
|
userAgent: "speakeasy-sdk/typescript 0.13.1 2.312.1 0.0.3 @lukehagar/plexjs",
|
||||||
});
|
} as const;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function encodeMatrix(
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
) {
|
): string {
|
||||||
let out = "";
|
let out = "";
|
||||||
const pairs: [string, unknown][] = options?.explode
|
const pairs: [string, unknown][] = options?.explode
|
||||||
? explode(key, value)
|
? explode(key, value)
|
||||||
@@ -65,7 +65,7 @@ export function encodeLabel(
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
) {
|
): string {
|
||||||
let out = "";
|
let out = "";
|
||||||
const pairs: [string, unknown][] = options?.explode
|
const pairs: [string, unknown][] = options?.explode
|
||||||
? explode(key, value)
|
? explode(key, value)
|
||||||
@@ -100,7 +100,13 @@ export function encodeLabel(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formEncoder(sep: string) {
|
type FormEncoder = (
|
||||||
|
key: string,
|
||||||
|
value: unknown,
|
||||||
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
|
) => string;
|
||||||
|
|
||||||
|
function formEncoder(sep: string): FormEncoder {
|
||||||
return (
|
return (
|
||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
@@ -157,7 +163,7 @@ export function encodeBodyForm(
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
) {
|
): string {
|
||||||
let out = "";
|
let out = "";
|
||||||
const pairs: [string, unknown][] = options?.explode
|
const pairs: [string, unknown][] = options?.explode
|
||||||
? explode(key, value)
|
? explode(key, value)
|
||||||
@@ -200,7 +206,7 @@ export function encodeDeepObject(
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { charEncoding?: "percent" | "none" },
|
options?: { charEncoding?: "percent" | "none" },
|
||||||
) {
|
): string {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -247,7 +253,7 @@ export function encodeJSON(
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
) {
|
): string {
|
||||||
if (typeof value === "undefined") {
|
if (typeof value === "undefined") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -265,7 +271,7 @@ export const encodeSimple = (
|
|||||||
key: string,
|
key: string,
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
||||||
) => {
|
): string => {
|
||||||
let out = "";
|
let out = "";
|
||||||
const pairs: [string, unknown][] = options?.explode
|
const pairs: [string, unknown][] = options?.explode
|
||||||
? explode(key, value)
|
? explode(key, value)
|
||||||
@@ -337,7 +343,7 @@ function serializeValue(value: unknown): string {
|
|||||||
return `${value}`;
|
return `${value}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonReplacer(_: string, value: unknown) {
|
function jsonReplacer(_: string, value: unknown): unknown {
|
||||||
if (value instanceof Uint8Array) {
|
if (value instanceof Uint8Array) {
|
||||||
return bytesToBase64(value);
|
return bytesToBase64(value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export type Fetcher = (
|
|||||||
init?: RequestInit,
|
init?: RequestInit,
|
||||||
) => Promise<Response>;
|
) => Promise<Response>;
|
||||||
|
|
||||||
type Awaitable<T> = T | Promise<T>;
|
export type Awaitable<T> = T | Promise<T>;
|
||||||
|
|
||||||
const DEFAULT_FETCHER: Fetcher = (input, init) => fetch(input, init);
|
const DEFAULT_FETCHER: Fetcher = (input, init) => fetch(input, init);
|
||||||
|
|
||||||
@@ -15,9 +15,9 @@ export interface HTTPClientOptions {
|
|||||||
fetcher?: Fetcher;
|
fetcher?: Fetcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BeforeRequestHook = (req: Request) => Awaitable<Request | void>;
|
export type BeforeRequestHook = (req: Request) => Awaitable<Request | void>;
|
||||||
type RequestErrorHook = (err: unknown, req: Request) => Awaitable<void>;
|
export type RequestErrorHook = (err: unknown, req: Request) => Awaitable<void>;
|
||||||
type ResponseHook = (res: Response, req: Request) => Awaitable<void>;
|
export type ResponseHook = (res: Response, req: Request) => Awaitable<void>;
|
||||||
|
|
||||||
export class HTTPClient {
|
export class HTTPClient {
|
||||||
private fetcher: Fetcher;
|
private fetcher: Fetcher;
|
||||||
@@ -100,7 +100,7 @@ export class HTTPClient {
|
|||||||
| [hook: "beforeRequest", fn: BeforeRequestHook]
|
| [hook: "beforeRequest", fn: BeforeRequestHook]
|
||||||
| [hook: "requestError", fn: RequestErrorHook]
|
| [hook: "requestError", fn: RequestErrorHook]
|
||||||
| [hook: "response", fn: ResponseHook]
|
| [hook: "response", fn: ResponseHook]
|
||||||
) {
|
): this {
|
||||||
let target: unknown[];
|
let target: unknown[];
|
||||||
if (args[0] === "beforeRequest") {
|
if (args[0] === "beforeRequest") {
|
||||||
target = this.requestHooks;
|
target = this.requestHooks;
|
||||||
@@ -120,7 +120,7 @@ export class HTTPClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
clone(): HTTPClient {
|
||||||
const child = new HTTPClient(this.options);
|
const child = new HTTPClient(this.options);
|
||||||
child.requestHooks = this.requestHooks.slice();
|
child.requestHooks = this.requestHooks.slice();
|
||||||
child.requestErrorHooks = this.requestErrorHooks.slice();
|
child.requestErrorHooks = this.requestErrorHooks.slice();
|
||||||
@@ -160,7 +160,7 @@ const codeRangeRE = new RegExp("^[0-9]xx$", "i");
|
|||||||
export function matchStatusCode(
|
export function matchStatusCode(
|
||||||
response: Response,
|
response: Response,
|
||||||
codes: number | string | (number | string)[],
|
codes: number | string | (number | string)[],
|
||||||
) {
|
): boolean {
|
||||||
const actual = `${response.status}`;
|
const actual = `${response.status}`;
|
||||||
const expectedCodes = Array.isArray(codes) ? codes : [codes];
|
const expectedCodes = Array.isArray(codes) ? codes : [codes];
|
||||||
if (!expectedCodes.length) {
|
if (!expectedCodes.length) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class ClientSDK {
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected createRequest$(conf: RequestConfig, options?: RequestOptions) {
|
protected createRequest$(conf: RequestConfig, options?: RequestOptions): Request {
|
||||||
const { method, path, query, headers: opHeaders, security } = conf;
|
const { method, path, query, headers: opHeaders, security } = conf;
|
||||||
|
|
||||||
const base = conf.baseURL ?? this.baseURL;
|
const base = conf.baseURL ?? this.baseURL;
|
||||||
@@ -109,7 +109,7 @@ export class ClientSDK {
|
|||||||
context: HookContext;
|
context: HookContext;
|
||||||
errorCodes: number | string | (number | string)[];
|
errorCodes: number | string | (number | string)[];
|
||||||
}
|
}
|
||||||
) {
|
): Promise<Response> {
|
||||||
const { context, errorCodes } = options;
|
const { context, errorCodes } = options;
|
||||||
|
|
||||||
let response = await this.client.request(await this.hooks$.beforeRequest(context, req));
|
let response = await this.client.request(await this.hooks$.beforeRequest(context, req));
|
||||||
|
|||||||
@@ -89,17 +89,16 @@ export function resolveSecurity(...options: SecurityInput[][]): SecurityState |
|
|||||||
|
|
||||||
const option = options.find((opts) => {
|
const option = options.find((opts) => {
|
||||||
return opts.every((o) => {
|
return opts.every((o) => {
|
||||||
switch (true) {
|
if (o.value == null) {
|
||||||
case o.value == null:
|
return false;
|
||||||
return false;
|
} else if (o.type === "http:basic") {
|
||||||
case o.type === "http:basic":
|
return o.value.username != null || o.value.password != null;
|
||||||
return o.value.username != null || o.value.password != null;
|
} else if (typeof o.value === "string") {
|
||||||
case typeof o.value === "string":
|
return !!o.value;
|
||||||
return !!o.value;
|
} else {
|
||||||
default:
|
throw new Error(
|
||||||
throw new Error(
|
`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`
|
||||||
`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -170,7 +169,9 @@ function applyBearer(
|
|||||||
|
|
||||||
state.headers[spec.fieldName] = value;
|
state.headers[spec.fieldName] = value;
|
||||||
}
|
}
|
||||||
export function resolveGlobalSecurity(security: Partial<components.Security> | null | undefined) {
|
export function resolveGlobalSecurity(
|
||||||
|
security: Partial<components.Security> | null | undefined
|
||||||
|
): SecurityState | null {
|
||||||
return resolveSecurity([
|
return resolveSecurity([
|
||||||
{
|
{
|
||||||
fieldName: "X-Plex-Token",
|
fieldName: "X-Plex-Token",
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
const hasOwn = Object.prototype.hasOwnProperty;
|
const hasOwn = Object.prototype.hasOwnProperty;
|
||||||
|
|
||||||
|
export type Params = Partial<Record<string, string | number>>;
|
||||||
|
|
||||||
export function pathToFunc(
|
export function pathToFunc(
|
||||||
pathPattern: string,
|
pathPattern: string,
|
||||||
options?: { charEncoding?: "percent" | "none" },
|
options?: { charEncoding?: "percent" | "none" },
|
||||||
): (params?: Record<string, string | number>) => string {
|
): (params?: Params) => string {
|
||||||
const paramRE = /\{([a-zA-Z0-9_]+?)\}/g;
|
const paramRE = /\{([a-zA-Z0-9_]+?)\}/g;
|
||||||
|
|
||||||
return function buildURLPath(params: Record<string, unknown> = {}): string {
|
return function buildURLPath(params: Record<string, unknown> = {}): string {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class SDKValidationError extends Error {
|
|||||||
this.rawValue = rawValue;
|
this.rawValue = rawValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override toString() {
|
public override toString(): string {
|
||||||
return `${this.message}: ${this.cause}`;
|
return `${this.message}: ${this.cause}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ export class SDKValidationError extends Error {
|
|||||||
* is a ZodError or some other recognized error type, otherwise return the
|
* is a ZodError or some other recognized error type, otherwise return the
|
||||||
* default error message.
|
* default error message.
|
||||||
*/
|
*/
|
||||||
public pretty() {
|
public pretty(): string {
|
||||||
if (this.cause instanceof z.ZodError) {
|
if (this.cause instanceof z.ZodError) {
|
||||||
return `${this.message}\n${formatZodError(this.cause)}`;
|
return `${this.message}\n${formatZodError(this.cause)}`;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ export type ApplyUpdatesResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Tonight$ = z.nativeEnum(Tonight);
|
export const Tonight$: z.ZodNativeEnum<typeof Tonight> = z.nativeEnum(Tonight);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Skip$ = z.nativeEnum(Skip);
|
export const Skip$: z.ZodNativeEnum<typeof Skip> = z.nativeEnum(Skip);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace ApplyUpdatesRequest$ {
|
export namespace ApplyUpdatesRequest$ {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export type CheckForUpdatesResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Download$ = z.nativeEnum(Download);
|
export const Download$: z.ZodNativeEnum<typeof Download> = z.nativeEnum(Download);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace CheckForUpdatesRequest$ {
|
export namespace CheckForUpdatesRequest$ {
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ export type CreatePlaylistResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const QueryParamType$ = z.nativeEnum(QueryParamType);
|
export const QueryParamType$: z.ZodNativeEnum<typeof QueryParamType> = z.nativeEnum(QueryParamType);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Smart$ = z.nativeEnum(Smart);
|
export const Smart$: z.ZodNativeEnum<typeof Smart> = z.nativeEnum(Smart);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace CreatePlaylistRequest$ {
|
export namespace CreatePlaylistRequest$ {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export type GetGlobalHubsResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const OnlyTransient$ = z.nativeEnum(OnlyTransient);
|
export const OnlyTransient$: z.ZodNativeEnum<typeof OnlyTransient> = z.nativeEnum(OnlyTransient);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetGlobalHubsRequest$ {
|
export namespace GetGlobalHubsRequest$ {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export type GetLibraryResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const IncludeDetails$ = z.nativeEnum(IncludeDetails);
|
export const IncludeDetails$: z.ZodNativeEnum<typeof IncludeDetails> = z.nativeEnum(IncludeDetails);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetLibraryRequest$ {
|
export namespace GetLibraryRequest$ {
|
||||||
|
|||||||
@@ -170,7 +170,8 @@ export type GetLibraryHubsResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const QueryParamOnlyTransient$ = z.nativeEnum(QueryParamOnlyTransient);
|
export const QueryParamOnlyTransient$: z.ZodNativeEnum<typeof QueryParamOnlyTransient> =
|
||||||
|
z.nativeEnum(QueryParamOnlyTransient);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetLibraryHubsRequest$ {
|
export namespace GetLibraryHubsRequest$ {
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export type GetLibraryItemsResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Tag$ = z.nativeEnum(Tag);
|
export const Tag$: z.ZodNativeEnum<typeof Tag> = z.nativeEnum(Tag);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetLibraryItemsRequest$ {
|
export namespace GetLibraryItemsRequest$ {
|
||||||
|
|||||||
@@ -7,15 +7,6 @@ import * as z from "zod";
|
|||||||
export const GetPinServerList = ["https://plex.tv/api/v2"] as const;
|
export const GetPinServerList = ["https://plex.tv/api/v2"] as const;
|
||||||
|
|
||||||
export type GetPinRequest = {
|
export type GetPinRequest = {
|
||||||
/**
|
|
||||||
* The unique identifier for the client application
|
|
||||||
*
|
|
||||||
* @remarks
|
|
||||||
* This is used to track the client application and its usage
|
|
||||||
* (UUID, serial number, or other number unique per device)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
xPlexClientIdentifier: string;
|
|
||||||
/**
|
/**
|
||||||
* Determines the kind of code returned by the API call
|
* Determines the kind of code returned by the API call
|
||||||
*
|
*
|
||||||
@@ -25,6 +16,15 @@ export type GetPinRequest = {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
strong?: boolean | undefined;
|
strong?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The unique identifier for the client application
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* This is used to track the client application and its usage
|
||||||
|
* (UUID, serial number, or other number unique per device)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
xPlexClientIdentifier?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Location = {
|
export type Location = {
|
||||||
@@ -91,36 +91,40 @@ export type GetPinResponse = {
|
|||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetPinRequest$ {
|
export namespace GetPinRequest$ {
|
||||||
export type Inbound = {
|
export type Inbound = {
|
||||||
"X-Plex-Client-Identifier": string;
|
|
||||||
strong?: boolean | undefined;
|
strong?: boolean | undefined;
|
||||||
|
"X-Plex-Client-Identifier"?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const inboundSchema: z.ZodType<GetPinRequest, z.ZodTypeDef, Inbound> = z
|
export const inboundSchema: z.ZodType<GetPinRequest, z.ZodTypeDef, Inbound> = z
|
||||||
.object({
|
.object({
|
||||||
"X-Plex-Client-Identifier": z.string(),
|
|
||||||
strong: z.boolean().default(false),
|
strong: z.boolean().default(false),
|
||||||
|
"X-Plex-Client-Identifier": z.string().optional(),
|
||||||
})
|
})
|
||||||
.transform((v) => {
|
.transform((v) => {
|
||||||
return {
|
return {
|
||||||
xPlexClientIdentifier: v["X-Plex-Client-Identifier"],
|
|
||||||
strong: v.strong,
|
strong: v.strong,
|
||||||
|
...(v["X-Plex-Client-Identifier"] === undefined
|
||||||
|
? null
|
||||||
|
: { xPlexClientIdentifier: v["X-Plex-Client-Identifier"] }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export type Outbound = {
|
export type Outbound = {
|
||||||
"X-Plex-Client-Identifier": string;
|
|
||||||
strong: boolean;
|
strong: boolean;
|
||||||
|
"X-Plex-Client-Identifier"?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetPinRequest> = z
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetPinRequest> = z
|
||||||
.object({
|
.object({
|
||||||
xPlexClientIdentifier: z.string(),
|
|
||||||
strong: z.boolean().default(false),
|
strong: z.boolean().default(false),
|
||||||
|
xPlexClientIdentifier: z.string().optional(),
|
||||||
})
|
})
|
||||||
.transform((v) => {
|
.transform((v) => {
|
||||||
return {
|
return {
|
||||||
"X-Plex-Client-Identifier": v.xPlexClientIdentifier,
|
|
||||||
strong: v.strong,
|
strong: v.strong,
|
||||||
|
...(v.xPlexClientIdentifier === undefined
|
||||||
|
? null
|
||||||
|
: { "X-Plex-Client-Identifier": v.xPlexClientIdentifier }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,10 +83,11 @@ export type GetPlaylistsResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const PlaylistType$ = z.nativeEnum(PlaylistType);
|
export const PlaylistType$: z.ZodNativeEnum<typeof PlaylistType> = z.nativeEnum(PlaylistType);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const QueryParamSmart$ = z.nativeEnum(QueryParamSmart);
|
export const QueryParamSmart$: z.ZodNativeEnum<typeof QueryParamSmart> =
|
||||||
|
z.nativeEnum(QueryParamSmart);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetPlaylistsRequest$ {
|
export namespace GetPlaylistsRequest$ {
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ export type GetResizedPhotoResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const MinSize$ = z.nativeEnum(MinSize);
|
export const MinSize$: z.ZodNativeEnum<typeof MinSize> = z.nativeEnum(MinSize);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Upscale$ = z.nativeEnum(Upscale);
|
export const Upscale$: z.ZodNativeEnum<typeof Upscale> = z.nativeEnum(Upscale);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetResizedPhotoRequest$ {
|
export namespace GetResizedPhotoRequest$ {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export type GetTimelineResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const State$ = z.nativeEnum(State);
|
export const State$: z.ZodNativeEnum<typeof State> = z.nativeEnum(State);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetTimelineRequest$ {
|
export namespace GetTimelineRequest$ {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export type GetTokenRequest = {
|
|||||||
* (UUID, serial number, or other number unique per device)
|
* (UUID, serial number, or other number unique per device)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
xPlexClientIdentifier: string;
|
xPlexClientIdentifier?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetTokenResponse = {
|
export type GetTokenResponse = {
|
||||||
@@ -41,35 +41,39 @@ export type GetTokenResponse = {
|
|||||||
export namespace GetTokenRequest$ {
|
export namespace GetTokenRequest$ {
|
||||||
export type Inbound = {
|
export type Inbound = {
|
||||||
pinID: string;
|
pinID: string;
|
||||||
"X-Plex-Client-Identifier": string;
|
"X-Plex-Client-Identifier"?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const inboundSchema: z.ZodType<GetTokenRequest, z.ZodTypeDef, Inbound> = z
|
export const inboundSchema: z.ZodType<GetTokenRequest, z.ZodTypeDef, Inbound> = z
|
||||||
.object({
|
.object({
|
||||||
pinID: z.string(),
|
pinID: z.string(),
|
||||||
"X-Plex-Client-Identifier": z.string(),
|
"X-Plex-Client-Identifier": z.string().optional(),
|
||||||
})
|
})
|
||||||
.transform((v) => {
|
.transform((v) => {
|
||||||
return {
|
return {
|
||||||
pinID: v.pinID,
|
pinID: v.pinID,
|
||||||
xPlexClientIdentifier: v["X-Plex-Client-Identifier"],
|
...(v["X-Plex-Client-Identifier"] === undefined
|
||||||
|
? null
|
||||||
|
: { xPlexClientIdentifier: v["X-Plex-Client-Identifier"] }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export type Outbound = {
|
export type Outbound = {
|
||||||
pinID: string;
|
pinID: string;
|
||||||
"X-Plex-Client-Identifier": string;
|
"X-Plex-Client-Identifier"?: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetTokenRequest> = z
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetTokenRequest> = z
|
||||||
.object({
|
.object({
|
||||||
pinID: z.string(),
|
pinID: z.string(),
|
||||||
xPlexClientIdentifier: z.string(),
|
xPlexClientIdentifier: z.string().optional(),
|
||||||
})
|
})
|
||||||
.transform((v) => {
|
.transform((v) => {
|
||||||
return {
|
return {
|
||||||
pinID: v.pinID,
|
pinID: v.pinID,
|
||||||
"X-Plex-Client-Identifier": v.xPlexClientIdentifier,
|
...(v.xPlexClientIdentifier === undefined
|
||||||
|
? null
|
||||||
|
: { "X-Plex-Client-Identifier": v.xPlexClientIdentifier }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,12 @@ export type GetTransientTokenResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const GetTransientTokenQueryParamType$ = z.nativeEnum(GetTransientTokenQueryParamType);
|
export const GetTransientTokenQueryParamType$: z.ZodNativeEnum<
|
||||||
|
typeof GetTransientTokenQueryParamType
|
||||||
|
> = z.nativeEnum(GetTransientTokenQueryParamType);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Scope$ = z.nativeEnum(Scope);
|
export const Scope$: z.ZodNativeEnum<typeof Scope> = z.nativeEnum(Scope);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetTransientTokenRequest$ {
|
export namespace GetTransientTokenRequest$ {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export type LogLineResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Level$ = z.nativeEnum(Level);
|
export const Level$: z.ZodNativeEnum<typeof Level> = z.nativeEnum(Level);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace LogLineRequest$ {
|
export namespace LogLineRequest$ {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export type SearchLibraryResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Type$ = z.nativeEnum(Type);
|
export const Type$: z.ZodNativeEnum<typeof Type> = z.nativeEnum(Type);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace SearchLibraryRequest$ {
|
export namespace SearchLibraryRequest$ {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export type StartTaskResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const TaskName$ = z.nativeEnum(TaskName);
|
export const TaskName$: z.ZodNativeEnum<typeof TaskName> = z.nativeEnum(TaskName);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace StartTaskRequest$ {
|
export namespace StartTaskRequest$ {
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ export type StopTaskResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const PathParamTaskName$ = z.nativeEnum(PathParamTaskName);
|
export const PathParamTaskName$: z.ZodNativeEnum<typeof PathParamTaskName> =
|
||||||
|
z.nativeEnum(PathParamTaskName);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace StopTaskRequest$ {
|
export namespace StopTaskRequest$ {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export type UploadPlaylistResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const Force$ = z.nativeEnum(Force);
|
export const Force$: z.ZodNativeEnum<typeof Force> = z.nativeEnum(Force);
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace UploadPlaylistRequest$ {
|
export namespace UploadPlaylistRequest$ {
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ export class Plex extends ClientSDK {
|
|||||||
* Retrieve a Pin from Plex.tv for authentication flows
|
* Retrieve a Pin from Plex.tv for authentication flows
|
||||||
*/
|
*/
|
||||||
async getPin(
|
async getPin(
|
||||||
xPlexClientIdentifier: string,
|
|
||||||
strong?: boolean | undefined,
|
strong?: boolean | undefined,
|
||||||
|
xPlexClientIdentifier?: string | undefined,
|
||||||
options?: RequestOptions & { serverURL?: string }
|
options?: RequestOptions & { serverURL?: string }
|
||||||
): Promise<operations.GetPinResponse> {
|
): Promise<operations.GetPinResponse> {
|
||||||
const input$: operations.GetPinRequest = {
|
const input$: operations.GetPinRequest = {
|
||||||
xPlexClientIdentifier: xPlexClientIdentifier,
|
|
||||||
strong: strong,
|
strong: strong,
|
||||||
|
xPlexClientIdentifier: xPlexClientIdentifier,
|
||||||
};
|
};
|
||||||
const headers$ = new Headers();
|
const headers$ = new Headers();
|
||||||
headers$.set("user-agent", SDK_METADATA.userAgent);
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
||||||
@@ -79,10 +79,11 @@ export class Plex extends ClientSDK {
|
|||||||
|
|
||||||
headers$.set(
|
headers$.set(
|
||||||
"X-Plex-Client-Identifier",
|
"X-Plex-Client-Identifier",
|
||||||
enc$.encodeSimple("X-Plex-Client-Identifier", payload$["X-Plex-Client-Identifier"], {
|
enc$.encodeSimple(
|
||||||
explode: false,
|
"X-Plex-Client-Identifier",
|
||||||
charEncoding: "none",
|
payload$["X-Plex-Client-Identifier"] ?? this.options$.xPlexClientIdentifier,
|
||||||
})
|
{ explode: false, charEncoding: "none" }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
const context = { operationID: "getPin", oAuth2Scopes: [], securitySource: null };
|
const context = { operationID: "getPin", oAuth2Scopes: [], securitySource: null };
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ export class Plex extends ClientSDK {
|
|||||||
*/
|
*/
|
||||||
async getToken(
|
async getToken(
|
||||||
pinID: string,
|
pinID: string,
|
||||||
xPlexClientIdentifier: string,
|
xPlexClientIdentifier?: string | undefined,
|
||||||
options?: RequestOptions & { serverURL?: string }
|
options?: RequestOptions & { serverURL?: string }
|
||||||
): Promise<operations.GetTokenResponse> {
|
): Promise<operations.GetTokenResponse> {
|
||||||
const input$: operations.GetTokenRequest = {
|
const input$: operations.GetTokenRequest = {
|
||||||
@@ -182,10 +183,11 @@ export class Plex extends ClientSDK {
|
|||||||
|
|
||||||
headers$.set(
|
headers$.set(
|
||||||
"X-Plex-Client-Identifier",
|
"X-Plex-Client-Identifier",
|
||||||
enc$.encodeSimple("X-Plex-Client-Identifier", payload$["X-Plex-Client-Identifier"], {
|
enc$.encodeSimple(
|
||||||
explode: false,
|
"X-Plex-Client-Identifier",
|
||||||
charEncoding: "none",
|
payload$["X-Plex-Client-Identifier"] ?? this.options$.xPlexClientIdentifier,
|
||||||
})
|
{ explode: false, charEncoding: "none" }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
const context = { operationID: "getToken", oAuth2Scopes: [], securitySource: null };
|
const context = { operationID: "getToken", oAuth2Scopes: [], securitySource: null };
|
||||||
|
|
||||||
|
|||||||
@@ -50,77 +50,77 @@ export class PlexAPI extends ClientSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _server?: Server;
|
private _server?: Server;
|
||||||
get server() {
|
get server(): Server {
|
||||||
return (this._server ??= new Server(this.options$));
|
return (this._server ??= new Server(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _media?: Media;
|
private _media?: Media;
|
||||||
get media() {
|
get media(): Media {
|
||||||
return (this._media ??= new Media(this.options$));
|
return (this._media ??= new Media(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _video?: Video;
|
private _video?: Video;
|
||||||
get video() {
|
get video(): Video {
|
||||||
return (this._video ??= new Video(this.options$));
|
return (this._video ??= new Video(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _activities?: Activities;
|
private _activities?: Activities;
|
||||||
get activities() {
|
get activities(): Activities {
|
||||||
return (this._activities ??= new Activities(this.options$));
|
return (this._activities ??= new Activities(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _butler?: Butler;
|
private _butler?: Butler;
|
||||||
get butler() {
|
get butler(): Butler {
|
||||||
return (this._butler ??= new Butler(this.options$));
|
return (this._butler ??= new Butler(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _hubs?: Hubs;
|
private _hubs?: Hubs;
|
||||||
get hubs() {
|
get hubs(): Hubs {
|
||||||
return (this._hubs ??= new Hubs(this.options$));
|
return (this._hubs ??= new Hubs(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _search?: Search;
|
private _search?: Search;
|
||||||
get search() {
|
get search(): Search {
|
||||||
return (this._search ??= new Search(this.options$));
|
return (this._search ??= new Search(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _library?: Library;
|
private _library?: Library;
|
||||||
get library() {
|
get library(): Library {
|
||||||
return (this._library ??= new Library(this.options$));
|
return (this._library ??= new Library(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _log?: Log;
|
private _log?: Log;
|
||||||
get log() {
|
get log(): Log {
|
||||||
return (this._log ??= new Log(this.options$));
|
return (this._log ??= new Log(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _plex?: Plex;
|
private _plex?: Plex;
|
||||||
get plex() {
|
get plex(): Plex {
|
||||||
return (this._plex ??= new Plex(this.options$));
|
return (this._plex ??= new Plex(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _playlists?: Playlists;
|
private _playlists?: Playlists;
|
||||||
get playlists() {
|
get playlists(): Playlists {
|
||||||
return (this._playlists ??= new Playlists(this.options$));
|
return (this._playlists ??= new Playlists(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _authentication?: Authentication;
|
private _authentication?: Authentication;
|
||||||
get authentication() {
|
get authentication(): Authentication {
|
||||||
return (this._authentication ??= new Authentication(this.options$));
|
return (this._authentication ??= new Authentication(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _statistics?: Statistics;
|
private _statistics?: Statistics;
|
||||||
get statistics() {
|
get statistics(): Statistics {
|
||||||
return (this._statistics ??= new Statistics(this.options$));
|
return (this._statistics ??= new Statistics(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _sessions?: Sessions;
|
private _sessions?: Sessions;
|
||||||
get sessions() {
|
get sessions(): Sessions {
|
||||||
return (this._sessions ??= new Sessions(this.options$));
|
return (this._sessions ??= new Sessions(this.options$));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updater?: Updater;
|
private _updater?: Updater;
|
||||||
get updater() {
|
get updater(): Updater {
|
||||||
return (this._updater ??= new Updater(this.options$));
|
return (this._updater ??= new Updater(this.options$));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
|
|
||||||
export const blobLikeSchema = z.custom<Blob>(isBlobLike, {
|
export const blobLikeSchema: z.ZodType<Blob, z.ZodTypeDef, Blob> =
|
||||||
message: "expected a Blob, File or Blob-like object",
|
z.custom<Blob>(isBlobLike, {
|
||||||
fatal: true,
|
message: "expected a Blob, File or Blob-like object",
|
||||||
});
|
fatal: true,
|
||||||
|
});
|
||||||
|
|
||||||
export function isBlobLike(val: unknown): val is Blob {
|
export function isBlobLike(val: unknown): val is Blob {
|
||||||
if (val instanceof Blob) {
|
if (val instanceof Blob) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export type PageIterator<Result> = Result & {
|
|||||||
|
|
||||||
export function createPageIterator<Result>(
|
export function createPageIterator<Result>(
|
||||||
page: Result & { next: Paginator<Result> },
|
page: Result & { next: Paginator<Result> },
|
||||||
) {
|
): { [Symbol.asyncIterator]: () => AsyncIterableIterator<Result> } {
|
||||||
return {
|
return {
|
||||||
[Symbol.asyncIterator]: async function* paginator() {
|
[Symbol.asyncIterator]: async function* paginator() {
|
||||||
yield page;
|
yield page;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class RFCDate {
|
|||||||
/**
|
/**
|
||||||
* Creates a new RFCDate instance using today's date.
|
* Creates a new RFCDate instance using today's date.
|
||||||
*/
|
*/
|
||||||
static today() {
|
static today(): RFCDate {
|
||||||
return new RFCDate(new Date());
|
return new RFCDate(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user