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

9.5 KiB
Raw Blame History

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(
	"github.com/LukeHagar/plexgo"
	"context"
	"log"
)

func main() {
    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
        plexgo.WithXPlexClientIdentifier("Postman"),
    )
    var timespan *int64 = plexgo.Int64(4)
    ctx := context.Background()
    res, err := s.Statistics.GetStatistics(ctx, timespan)
    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

Response

*operations.GetStatisticsResponse, error

Error Object Status Code Content Type
sdkerrors.GetStatisticsResponseBody 401 application/json
sdkerrors.SDKError 4xx-5xx /

GetResourcesStatistics

This will return the resources for the server

Example Usage

package main

import(
	"github.com/LukeHagar/plexgo"
	"context"
	"log"
)

func main() {
    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
        plexgo.WithXPlexClientIdentifier("Postman"),
    )
    var timespan *int64 = plexgo.Int64(4)
    ctx := context.Background()
    res, err := s.Statistics.GetResourcesStatistics(ctx, timespan)
    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

Response

*operations.GetResourcesStatisticsResponse, error

Error Object Status Code Content Type
sdkerrors.GetResourcesStatisticsResponseBody 401 application/json
sdkerrors.SDKError 4xx-5xx /

GetBandwidthStatistics

This will return the bandwidth statistics for the server

Example Usage

package main

import(
	"github.com/LukeHagar/plexgo"
	"context"
	"log"
)

func main() {
    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
        plexgo.WithXPlexClientIdentifier("Postman"),
    )
    var timespan *int64 = plexgo.Int64(4)
    ctx := context.Background()
    res, err := s.Statistics.GetBandwidthStatistics(ctx, timespan)
    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

Response

*operations.GetBandwidthStatisticsResponse, error

Error Object Status Code Content Type
sdkerrors.GetBandwidthStatisticsResponseBody 401 application/json
sdkerrors.SDKError 4xx-5xx /