mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 04:20:46 +00:00
Hubs
(Hubs)
Overview
Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
Available Operations
- GetGlobalHubs - Get Global Hubs
- GetLibraryHubs - Get library specific hubs
GetGlobalHubs
Get Global Hubs filtered by the parameters provided.
Example Usage
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"),
)
ctx := context.Background()
res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil)
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. |
count |
*float64 | ➖ | The number of items to return with each hub. |
onlyTransient |
*operations.OnlyTransient | ➖ | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). |
opts |
[]operations.Option | ➖ | The options for this request. |
Response
*operations.GetGlobalHubsResponse, error
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetGlobalHubsBadRequest | 400 | application/json |
| sdkerrors.GetGlobalHubsUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
GetLibraryHubs
This endpoint will return a list of library specific hubs
Example Usage
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"),
)
ctx := context.Background()
res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil)
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. |
sectionID |
float64 | ✔️ | the Id of the library to query |
count |
*float64 | ➖ | The number of items to return with each hub. |
onlyTransient |
*operations.QueryParamOnlyTransient | ➖ | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). |
opts |
[]operations.Option | ➖ | The options for this request. |
Response
*operations.GetLibraryHubsResponse, error
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.GetLibraryHubsBadRequest | 400 | application/json |
| sdkerrors.GetLibraryHubsUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |