Files
plexgo/docs/sdks/statistics/README.md

172 lines
11 KiB
Markdown

# Statistics
(*Statistics*)
## Overview
API Calls that perform operations with Plex Media Server Statistics
### Available Operations
* [GetStatistics](#getstatistics) - Get Media Statistics
* [GetResourcesStatistics](#getresourcesstatistics) - Get Resources Statistics
* [GetBandwidthStatistics](#getbandwidthstatistics) - Get Bandwidth Statistics
## GetStatistics
This will return the media statistics for the server
### Example Usage
<!-- UsageSnippet language="go" operationID="getStatistics" method="get" path="/statistics/media" -->
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4))
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | |
| `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for<br/>the exact meaning of this parameter is not known<br/> | 4 |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | |
### Response
**[*operations.GetStatisticsResponse](../../models/operations/getstatisticsresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
| sdkerrors.GetStatisticsBadRequest | 400 | application/json |
| sdkerrors.GetStatisticsUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
## GetResourcesStatistics
This will return the resources for the server
### Example Usage
<!-- UsageSnippet language="go" operationID="getResourcesStatistics" method="get" path="/statistics/resources" -->
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4))
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | |
| `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for<br/>the exact meaning of this parameter is not known<br/> | 4 |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | |
### Response
**[*operations.GetResourcesStatisticsResponse](../../models/operations/getresourcesstatisticsresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
| sdkerrors.GetResourcesStatisticsBadRequest | 400 | application/json |
| sdkerrors.GetResourcesStatisticsUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
## GetBandwidthStatistics
This will return the bandwidth statistics for the server
### Example Usage
<!-- UsageSnippet language="go" operationID="getBandwidthStatistics" method="get" path="/statistics/bandwidth" -->
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4))
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | |
| `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for<br/>the exact meaning of this parameter is not known<br/> | 4 |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | |
### Response
**[*operations.GetBandwidthStatisticsResponse](../../models/operations/getbandwidthstatisticsresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
| sdkerrors.GetBandwidthStatisticsBadRequest | 400 | application/json |
| sdkerrors.GetBandwidthStatisticsUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |