mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
55 lines
5.5 KiB
Markdown
55 lines
5.5 KiB
Markdown
# Statistics
|
|
(*statistics*)
|
|
|
|
## Overview
|
|
|
|
API Calls that perform operations with Plex Media Server Statistics
|
|
|
|
|
|
### Available Operations
|
|
|
|
* [getStatistics](#getstatistics) - Get Media Statistics
|
|
|
|
## getStatistics
|
|
|
|
This will return the media statistics for the server
|
|
|
|
### 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.statistics.getStatistics(4);
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description | Example |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `timespan` | *number* | :heavy_minus_sign: | The timespan to retrieve statistics for<br/>the exact meaning of this parameter is not known<br/> | [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.GetStatisticsResponse](../../models/operations/getstatisticsresponse.md)\>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
| errors.GetStatisticsResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|