mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.390.7
This commit is contained in:
@@ -12,10 +12,9 @@ API Calls that perform operations directly against https://Plex.tv
|
||||
* [getUserFriends](#getuserfriends) - Get list of friends of the user logged in
|
||||
* [getGeoData](#getgeodata) - Get Geo Data
|
||||
* [getHomeData](#gethomedata) - Get Plex Home Data
|
||||
* [getResources](#getresources) - Get Resources
|
||||
* [getServerResources](#getserverresources) - Get Server Resources
|
||||
* [getPin](#getpin) - Get a Pin
|
||||
* [getTokenByPinId](#gettokenbypinid) - Get Access Token by PinId
|
||||
* [getUserDetails](#getuserdetails) - Get UserData By Token
|
||||
|
||||
## getCompanionsData
|
||||
|
||||
@@ -28,12 +27,12 @@ import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getCompanionsData();
|
||||
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -53,7 +52,7 @@ import { plexGetCompanionsData } from "@lukehagar/plexjs/funcs/plexGetCompanions
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
@@ -104,12 +103,12 @@ import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getUserFriends();
|
||||
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -129,7 +128,7 @@ import { plexGetUserFriends } from "@lukehagar/plexjs/funcs/plexGetUserFriends.j
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
@@ -179,12 +178,12 @@ Returns the geolocation and locale data of the caller
|
||||
import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getGeoData();
|
||||
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -203,7 +202,7 @@ import { plexGetGeoData } from "@lukehagar/plexjs/funcs/plexGetGeoData.js";
|
||||
// Use `PlexAPICore` for best tree-shaking performance.
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
@@ -254,12 +253,12 @@ import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getHomeData();
|
||||
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -279,7 +278,7 @@ import { plexGetHomeData } from "@lukehagar/plexjs/funcs/plexGetHomeData.js";
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
@@ -318,22 +317,28 @@ run();
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
|
||||
|
||||
## getResources
|
||||
## getServerResources
|
||||
|
||||
Get Resources
|
||||
Get Plex server access tokens and server connections
|
||||
|
||||
### Example Usage
|
||||
|
||||
```typescript
|
||||
import { PlexAPI } from "@lukehagar/plexjs";
|
||||
import { IncludeHttps, IncludeIPv6, IncludeRelay, PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getResources("Postman");
|
||||
|
||||
const result = await plexAPI.plex.getServerResources({
|
||||
xPlexToken: "CV5xoxjTpFKUzBTShsaf",
|
||||
includeHttps: IncludeHttps.One,
|
||||
includeRelay: IncludeRelay.One,
|
||||
includeIPv6: IncludeIPv6.One,
|
||||
});
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -346,17 +351,24 @@ run();
|
||||
The standalone function version of this method:
|
||||
|
||||
```typescript
|
||||
import { IncludeHttps, IncludeIPv6, IncludeRelay } from "@lukehagar/plexjs";
|
||||
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
||||
import { plexGetResources } from "@lukehagar/plexjs/funcs/plexGetResources.js";
|
||||
import { plexGetServerResources } from "@lukehagar/plexjs/funcs/plexGetServerResources.js";
|
||||
|
||||
// Use `PlexAPICore` for best tree-shaking performance.
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const res = await plexGetResources(plexAPI, "Postman");
|
||||
const res = await plexGetServerResources(plexAPI, {
|
||||
xPlexToken: "CV5xoxjTpFKUzBTShsaf",
|
||||
includeHttps: IncludeHttps.One,
|
||||
includeRelay: IncludeRelay.One,
|
||||
includeIPv6: IncludeIPv6.One,
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw res.error;
|
||||
@@ -373,27 +385,24 @@ run();
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `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] |
|
||||
| `includeHttps` | [models.IncludeHttps](../../models/includehttps.md) | :heavy_minus_sign: | Include Https entries in the results | |
|
||||
| `includeRelay` | [models.IncludeRelay](../../models/includerelay.md) | :heavy_minus_sign: | Include Relay addresses in the results | |
|
||||
| `includeIPv6` | [models.IncludeIPv6](../../models/includeipv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | |
|
||||
| `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.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
|
||||
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 |
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `request` | [models.GetServerResourcesRequest](../../models/getserverresourcesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
||||
| `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.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
||||
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
|
||||
|
||||
### Response
|
||||
|
||||
**Promise\<[models.GetResourcesResponse](../../models/getresourcesresponse.md)\>**
|
||||
**Promise\<[models.GetServerResourcesResponse](../../models/getserverresourcesresponse.md)\>**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| models.GetResourcesResponseBody | 401 | application/json |
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
||||
| models.GetServerResourcesResponseBody | 401 | application/json |
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
|
||||
|
||||
## getPin
|
||||
@@ -406,12 +415,12 @@ Retrieve a Pin from Plex.tv for authentication flows
|
||||
import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getPin("Postman", "Postman");
|
||||
|
||||
const result = await plexAPI.plex.getPin("gcgzw5rz2xovp84b4vha3a40", "Plex Web");
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -430,11 +439,11 @@ import { plexGetPin } from "@lukehagar/plexjs/funcs/plexGetPin.js";
|
||||
// Use `PlexAPICore` for best tree-shaking performance.
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const res = await plexGetPin(plexAPI, "Postman", "Postman");
|
||||
const res = await plexGetPin(plexAPI, "gcgzw5rz2xovp84b4vha3a40", "Plex Web");
|
||||
|
||||
if (!res.ok) {
|
||||
throw res.error;
|
||||
@@ -453,9 +462,9 @@ run();
|
||||
|
||||
| Parameter | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `xPlexProduct` | *string* | :heavy_check_mark: | Product name of the application shown in the list of devices<br/> | [object Object] |
|
||||
| `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] |
|
||||
| `xPlexProduct` | *string* | :heavy_minus_sign: | N/A | [object Object] |
|
||||
| `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.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
|
||||
@@ -483,12 +492,12 @@ Retrieve an Access Token from Plex.tv after the Pin has been authenticated
|
||||
import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getTokenByPinId(408895, "Postman");
|
||||
|
||||
const result = await plexAPI.plex.getTokenByPinId(408895, "gcgzw5rz2xovp84b4vha3a40");
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
@@ -507,11 +516,11 @@ import { plexGetTokenByPinId } from "@lukehagar/plexjs/funcs/plexGetTokenByPinId
|
||||
// Use `PlexAPICore` for best tree-shaking performance.
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
xPlexClientIdentifier: "Postman",
|
||||
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const res = await plexGetTokenByPinId(plexAPI, 537318, "Postman");
|
||||
const res = await plexGetTokenByPinId(plexAPI, 537318, "gcgzw5rz2xovp84b4vha3a40");
|
||||
|
||||
if (!res.ok) {
|
||||
throw res.error;
|
||||
@@ -543,83 +552,8 @@ run();
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| models.GetTokenByPinIdResponseBody | 404 | application/json |
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
|
||||
|
||||
## getUserDetails
|
||||
|
||||
Get the User data from the provided X-Plex-Token
|
||||
|
||||
### Example Usage
|
||||
|
||||
```typescript
|
||||
import { PlexAPI } from "@lukehagar/plexjs";
|
||||
|
||||
const plexAPI = new PlexAPI({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await plexAPI.plex.getUserDetails();
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
|
||||
run();
|
||||
```
|
||||
|
||||
### Standalone function
|
||||
|
||||
The standalone function version of this method:
|
||||
|
||||
```typescript
|
||||
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
||||
import { plexGetUserDetails } from "@lukehagar/plexjs/funcs/plexGetUserDetails.js";
|
||||
|
||||
// Use `PlexAPICore` for best tree-shaking performance.
|
||||
// You can create one instance of it to use across an application.
|
||||
const plexAPI = new PlexAPICore({
|
||||
accessToken: "<YOUR_API_KEY_HERE>",
|
||||
xPlexClientIdentifier: "Postman",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const res = await plexGetUserDetails(plexAPI);
|
||||
|
||||
if (!res.ok) {
|
||||
throw res.error;
|
||||
}
|
||||
|
||||
const { value: result } = res;
|
||||
|
||||
// Handle the result
|
||||
console.log(result)
|
||||
}
|
||||
|
||||
run();
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `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.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
||||
| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
|
||||
|
||||
### Response
|
||||
|
||||
**Promise\<[models.GetUserDetailsResponse](../../models/getuserdetailsresponse.md)\>**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| models.GetUserDetailsResponseBody | 401 | application/json |
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| models.GetTokenByPinIdResponseBody | 400 | application/json |
|
||||
| models.GetTokenByPinIdPlexResponseBody | 404 | application/json |
|
||||
| models.SDKError | 4xx-5xx | */* |
|
||||
|
||||
Reference in New Issue
Block a user