Files
plexgo/docs/sdks/statistics

Statistics

(Statistics)

Overview

API Calls that perform operations with Plex Media Server Statistics

Available Operations

GetStatistics

This will return the media statistics for the server

Example Usage

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.Pointer[int64](4))
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
timespan *int64 The timespan to retrieve statistics for
the exact meaning of this parameter is not known
4
opts []operations.Option The options for this request.

Response

*operations.GetStatisticsResponse, 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

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.Pointer[int64](4))
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
timespan *int64 The timespan to retrieve statistics for
the exact meaning of this parameter is not known
4
opts []operations.Option The options for this request.

Response

*operations.GetResourcesStatisticsResponse, 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

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.Pointer[int64](4))
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
timespan *int64 The timespan to retrieve statistics for
the exact meaning of this parameter is not known
4
opts []operations.Option The options for this request.

Response

*operations.GetBandwidthStatisticsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.GetBandwidthStatisticsBadRequest 400 application/json
sdkerrors.GetBandwidthStatisticsUnauthorized 401 application/json
sdkerrors.SDKError 4XX, 5XX */*