mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 12:37:46 +00:00
Server
(Server)
Overview
Operations against the Plex Media Server System.
Available Operations
- GetServerCapabilities - Server Capabilities
- GetServerPreferences - Get Server Preferences
- GetAvailableClients - Get Available Clients
- GetDevices - Get Devices
- GetServerIdentity - Get Server Identity
- GetMyPlexAccount - Get MyPlex Account
- GetResizedPhoto - Get a Resized Photo
- GetServerList - Get Server List
GetServerCapabilities
Server Capabilities
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"),
)
ctx := context.Background()
res, err := s.Server.GetServerCapabilities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetServerCapabilitiesResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetServerCapabilitiesResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetServerPreferences
Get Server Preferences
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"),
)
ctx := context.Background()
res, err := s.Server.GetServerPreferences(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetServerPreferencesResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetServerPreferencesResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetAvailableClients
Get Available Clients
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"),
)
ctx := context.Background()
res, err := s.Server.GetAvailableClients(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetAvailableClientsResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetAvailableClientsResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetDevices
Get Devices
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"),
)
ctx := context.Background()
res, err := s.Server.GetDevices(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetDevicesResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetDevicesResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetServerIdentity
Get Server Identity
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"),
)
ctx := context.Background()
res, err := s.Server.GetServerIdentity(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetServerIdentityResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetServerIdentityResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetMyPlexAccount
Returns MyPlex Account Information
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"),
)
ctx := context.Background()
res, err := s.Server.GetMyPlexAccount(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetMyPlexAccountResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetMyPlexAccountResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetResizedPhoto
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
Example Usage
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.GetResizedPhotoRequest{
Width: 110,
Height: 165,
Opacity: 100,
Blur: 20,
MinSize: operations.MinSizeOne,
Upscale: operations.UpscaleZero,
URL: "/library/metadata/49564/thumb/1654258204",
}
ctx := context.Background()
res, err := s.Server.GetResizedPhoto(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetResizedPhotoRequest | ✔️ | The request object to use for the request. |
Response
*operations.GetResizedPhotoResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetResizedPhotoResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetServerList
Get Server List
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"),
)
ctx := context.Background()
res, err := s.Server.GetServerList(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
Response
*operations.GetServerListResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetServerListResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |