mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-10 12:37:45 +00:00
182 lines
17 KiB
Markdown
182 lines
17 KiB
Markdown
# Sessions
|
|
(*sessions*)
|
|
|
|
## Overview
|
|
|
|
API Calls that perform search operations with Plex Media Server Sessions
|
|
|
|
|
|
### Available Operations
|
|
|
|
* [getSessions](#getsessions) - Get Active Sessions
|
|
* [getSessionHistory](#getsessionhistory) - Get Session History
|
|
* [getTranscodeSessions](#gettranscodesessions) - Get Transcode Sessions
|
|
* [stopTranscodeSession](#stoptranscodesession) - Stop a Transcode Session
|
|
|
|
## getSessions
|
|
|
|
This will retrieve the "Now Playing" Information of the PMS.
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
async function run() {
|
|
const sdk = new PlexAPI({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const result = await sdk.sessions.getSessions();
|
|
|
|
// 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. |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.GetSessionsResponse](../../models/operations/getsessionsresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------------ | ------------------------------ | ------------------------------ |
|
|
| errors.GetSessionsResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
## getSessionHistory
|
|
|
|
This will Retrieve a listing of all history views.
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
async function run() {
|
|
const sdk = new PlexAPI({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const result = await sdk.sessions.getSessionHistory();
|
|
|
|
// 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. |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.GetSessionHistoryResponse](../../models/operations/getsessionhistoryresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
|
|
| errors.GetSessionHistoryResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
## getTranscodeSessions
|
|
|
|
Get Transcode Sessions
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
async function run() {
|
|
const sdk = new PlexAPI({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const result = await sdk.sessions.getTranscodeSessions();
|
|
|
|
// 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. |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.GetTranscodeSessionsResponse](../../models/operations/gettranscodesessionsresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
|
| errors.GetTranscodeSessionsResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
## stopTranscodeSession
|
|
|
|
Stop a Transcode Session
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
async function run() {
|
|
const sdk = new PlexAPI({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep";
|
|
|
|
const result = await sdk.sessions.stopTranscodeSession(sessionKey);
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description | Example |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `sessionKey` | *string* | :heavy_check_mark: | the Key of the transcode session to stop | [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. | |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.StopTranscodeSessionResponse](../../models/operations/stoptranscodesessionresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
|
| errors.StopTranscodeSessionResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|