diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0394e57..60fc090 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 management: - docChecksum: 37654ea0982ab5e87a9a9576014c9d19 + docChecksum: e73920abd3a55e8d249592f2e3090574 docVersion: 0.0.3 - speakeasyVersion: 1.308.1 - generationVersion: 2.342.6 - releaseVersion: 0.9.0 - configChecksum: 21802bb6ef89f8b23e39a8afe2761568 + speakeasyVersion: 1.314.2 + generationVersion: 2.349.6 + releaseVersion: 0.10.0 + configChecksum: 28df6cdfff7ddcd30cd89a07a82b5e6c repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -15,7 +15,7 @@ features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.4 - core: 3.4.11 + core: 3.4.14 flattening: 2.81.1 globalSecurity: 2.82.9 globalSecurityCallbacks: 0.1.0 @@ -25,9 +25,11 @@ features: intellisenseMarkdownSupport: 0.1.0 methodServerURLs: 2.82.1 nameOverrides: 2.81.2 + nullables: 0.1.0 responseFormat: 0.1.2 sdkHooks: 0.1.0 typeOverrides: 2.81.1 + unions: 2.85.8 generatedFiles: - server.go - media.go @@ -102,6 +104,7 @@ generatedFiles: - /models/operations/searchlibrary.go - /models/operations/getmetadata.go - /models/operations/getmetadatachildren.go + - /models/operations/gettopwatchedcontent.go - /models/operations/getondeck.go - /models/operations/logline.go - /models/operations/logmultiline.go @@ -118,6 +121,8 @@ generatedFiles: - /models/operations/gettransienttoken.go - /models/operations/getsourceconnectioninformation.go - /models/operations/getstatistics.go + - /models/operations/getresourcesstatistics.go + - /models/operations/getbandwidthstatistics.go - /models/operations/getsessions.go - /models/operations/getsessionhistory.go - /models/operations/gettranscodesessions.go @@ -180,6 +185,8 @@ generatedFiles: - /models/sdkerrors/gettransienttoken.go - /models/sdkerrors/getsourceconnectioninformation.go - /models/sdkerrors/getstatistics.go + - /models/sdkerrors/getresourcesstatistics.go + - /models/sdkerrors/getbandwidthstatistics.go - /models/sdkerrors/getsessions.go - /models/sdkerrors/getsessionhistory.go - /models/sdkerrors/gettranscodesessions.go @@ -334,6 +341,7 @@ generatedFiles: - docs/models/operations/deletelibraryresponse.md - docs/models/operations/tag.md - docs/models/operations/getlibraryitemsrequest.md + - docs/models/operations/librarysectionid.md - docs/models/operations/getlibraryitemspart.md - docs/models/operations/getlibraryitemsmedia.md - docs/models/operations/getlibraryitemsgenre.md @@ -375,6 +383,16 @@ generatedFiles: - docs/models/operations/getmetadatachildrenmediacontainer.md - docs/models/operations/getmetadatachildrenresponsebody.md - docs/models/operations/getmetadatachildrenresponse.md + - docs/models/operations/gettopwatchedcontentrequest.md + - docs/models/operations/gettopwatchedcontentgenre.md + - docs/models/operations/gettopwatchedcontentcountry.md + - docs/models/operations/gettopwatchedcontentguids.md + - docs/models/operations/gettopwatchedcontentrole.md + - docs/models/operations/user.md + - docs/models/operations/gettopwatchedcontentmetadata.md + - docs/models/operations/gettopwatchedcontentmediacontainer.md + - docs/models/operations/gettopwatchedcontentresponsebody.md + - docs/models/operations/gettopwatchedcontentresponse.md - docs/models/operations/getondeckstream.md - docs/models/operations/getondeckpart.md - docs/models/operations/getondeckmedia.md @@ -446,16 +464,30 @@ generatedFiles: - docs/models/operations/getstatisticsmediacontainer.md - docs/models/operations/getstatisticsresponsebody.md - docs/models/operations/getstatisticsresponse.md + - docs/models/operations/getresourcesstatisticsrequest.md + - docs/models/operations/statisticsresources.md + - docs/models/operations/getresourcesstatisticsmediacontainer.md + - docs/models/operations/getresourcesstatisticsresponsebody.md + - docs/models/operations/getresourcesstatisticsresponse.md + - docs/models/operations/getbandwidthstatisticsrequest.md + - docs/models/operations/getbandwidthstatisticsdevice.md + - docs/models/operations/getbandwidthstatisticsaccount.md + - docs/models/operations/statisticsbandwidth.md + - docs/models/operations/getbandwidthstatisticsmediacontainer.md + - docs/models/operations/getbandwidthstatisticsresponsebody.md + - docs/models/operations/getbandwidthstatisticsresponse.md - docs/models/operations/getsessionsstream.md - docs/models/operations/getsessionspart.md - docs/models/operations/getsessionsmedia.md - - docs/models/operations/user.md + - docs/models/operations/getsessionsuser.md - docs/models/operations/player.md - docs/models/operations/session.md - docs/models/operations/getsessionsmetadata.md - docs/models/operations/getsessionsmediacontainer.md - docs/models/operations/getsessionsresponsebody.md - docs/models/operations/getsessionsresponse.md + - docs/models/operations/filter.md + - docs/models/operations/getsessionhistoryrequest.md - docs/models/operations/getsessionhistorymetadata.md - docs/models/operations/getsessionhistorymediacontainer.md - docs/models/operations/getsessionhistoryresponsebody.md @@ -477,7 +509,7 @@ generatedFiles: - docs/models/operations/skip.md - docs/models/operations/applyupdatesrequest.md - docs/models/operations/applyupdatesresponse.md - - docs/models/operations/filter.md + - docs/models/operations/pathparamfilter.md - docs/models/operations/libtype.md - docs/models/operations/includecollections.md - docs/models/operations/includeexternalmedia.md @@ -594,6 +626,10 @@ generatedFiles: - docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md - docs/models/sdkerrors/getstatisticserrors.md - docs/models/sdkerrors/getstatisticsresponsebody.md + - docs/models/sdkerrors/getresourcesstatisticserrors.md + - docs/models/sdkerrors/getresourcesstatisticsresponsebody.md + - docs/models/sdkerrors/getbandwidthstatisticserrors.md + - docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md - docs/models/sdkerrors/getsessionserrors.md - docs/models/sdkerrors/getsessionsresponsebody.md - docs/models/sdkerrors/getsessionhistoryerrors.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1cd8f90..b89870d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.9.0 + version: 0.10.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ac0b0c2..530c2c6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.308.1 +speakeasyVersion: 1.314.2 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:7c8d6aba90098356ba6c93b2ec679c4a6b7bf28eebdfbe12ab238a47b31eebd9 - sourceBlobDigest: sha256:673b2e8e0f4802ebdce582bd11cf375fb435a50e5a67b08b56ede08efc49aefe + sourceRevisionDigest: sha256:ad15d1a2b523f5d9e0181ff1209075e67ee181fbad77338d2f52a32479a609b9 + sourceBlobDigest: sha256:c170ffd0095c169f643ab932861e3967964d95741801676fd864d538490d3895 tags: - latest - main @@ -11,8 +11,8 @@ targets: plexgo: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:7c8d6aba90098356ba6c93b2ec679c4a6b7bf28eebdfbe12ab238a47b31eebd9 - sourceBlobDigest: sha256:673b2e8e0f4802ebdce582bd11cf375fb435a50e5a67b08b56ede08efc49aefe + sourceRevisionDigest: sha256:ad15d1a2b523f5d9e0181ff1209075e67ee181fbad77338d2f52a32479a609b9 + sourceBlobDigest: sha256:c170ffd0095c169f643ab932861e3967964d95741801676fd864d538490d3895 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/README.md b/README.md index d13b4ef..a4a0764 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ func main() { ### [Server](docs/sdks/server/README.md) -* [GetServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Server Capabilities +* [GetServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities * [GetServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences * [GetAvailableClients](docs/sdks/server/README.md#getavailableclients) - Get Available Clients * [GetDevices](docs/sdks/server/README.md#getdevices) - Get Devices @@ -115,6 +115,7 @@ func main() { * [SearchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library * [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata * [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children +* [GetTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content * [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck ### [Log](docs/sdks/log/README.md) @@ -143,6 +144,8 @@ func main() { ### [Statistics](docs/sdks/statistics/README.md) * [GetStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics +* [GetResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics +* [GetBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) - Get Bandwidth Statistics ### [Sessions](docs/sdks/sessions/README.md) @@ -424,18 +427,18 @@ d6 := types.MustDateFromString("2019-01-01") // returns types.Date and panics on ## Global Parameters -A parameter is configured globally. This parameter must be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed. +A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed. For example, you can set `X-Plex-Client-Identifier` to `"Postman"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetPin`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. ### Available Globals -The following global parameter is available. The required parameter must be set when you initialize the SDK client. +The following global parameter is available. | Name | Type | Required | Description | | ---- | ---- |:--------:| ----------- | -| XPlexClientIdentifier | string | ✔️ | The unique identifier for the client application +| XPlexClientIdentifier | string | | The unique identifier for the client application This is used to track the client application and its usage (UUID, serial number, or other number unique per device) | diff --git a/RELEASES.md b/RELEASES.md index 6b166ea..8a976ef 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -642,4 +642,14 @@ Based on: ### Generated - [go v0.9.0] . ### Releases -- [Go v0.9.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.9.0 - . \ No newline at end of file +- [Go v0.9.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.9.0 - . + +## 2024-06-22 00:10:02 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.314.2 (2.349.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.10.0] . +### Releases +- [Go v0.10.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.10.0 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index f42a9e2..b95cae1 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,11 +3,11 @@ info: title: CodeSamples overlay for go target version: 0.0.0 actions: - - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] + - target: $["paths"]["/butler"]["post"] update: x-codeSamples: - lang: go - label: stopTranscodeSession + label: startAllTasks source: |- package main @@ -22,9 +22,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var sessionKey string = "zz7llzqlx8w9vnrsbnwhbmep" + ctx := context.Background() - res, err := s.Sessions.StopTranscodeSession(ctx, sessionKey) + res, err := s.Butler.StartAllTasks(ctx) if err != nil { log.Fatal(err) } @@ -32,11 +32,11 @@ actions: // handle response } } - - target: $["paths"]["/clients"]["get"] + - target: $["paths"]["/statistics/bandwidth"]["get"] update: x-codeSamples: - lang: go - label: getAvailableClients + label: getBandwidthStatistics source: |- package main @@ -51,9 +51,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - + var timespan *int64 = plexgo.Int64(4) ctx := context.Background() - res, err := s.Server.GetAvailableClients(ctx) + res, err := s.Statistics.GetBandwidthStatistics(ctx, timespan) if err != nil { log.Fatal(err) } @@ -61,11 +61,44 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/{sectionId}"]["delete"] + - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] update: x-codeSamples: - lang: go - label: deleteLibrary + label: getWatchlist + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + request := operations.GetWatchlistRequest{ + Filter: operations.PathParamFilterReleased, + XPlexToken: "", + } + ctx := context.Background() + res, err := s.Watchlist.GetWatchlist(ctx, request) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + update: + x-codeSamples: + - lang: go + label: getMetadataChildren source: |- package main @@ -80,13 +113,104 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var sectionID float64 = 1000 + var ratingKey float64 = 1539.14 + + var includeElements *string = plexgo.String("") ctx := context.Background() - res, err := s.Library.DeleteLibrary(ctx, sectionID) + res, err := s.Library.GetMetadataChildren(ctx, ratingKey, includeElements) if err != nil { log.Fatal(err) } - if res != nil { + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/library/onDeck"]["get"] + update: + x-codeSamples: + - lang: go + label: getOnDeck + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Library.GetOnDeck(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/playlists/{playlistID}/items"]["get"] + update: + x-codeSamples: + - lang: go + label: getPlaylistContents + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var playlistID float64 = 5004.46 + + var type_ float64 = 9403.59 + ctx := context.Background() + res, err := s.Playlists.GetPlaylistContents(ctx, playlistID, type_) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/status/sessions"]["get"] + update: + x-codeSamples: + - lang: go + label: getSessions + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Sessions.GetSessions(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { // handle response } } @@ -119,11 +243,11 @@ actions: // handle response } } - - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + - target: $["paths"]["/playlists/{playlistID}"]["get"] update: x-codeSamples: - lang: go - label: getMetadataChildren + label: getPlaylist source: |- package main @@ -138,9 +262,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var ratingKey float64 = 1539.14 + var playlistID float64 = 4109.48 ctx := context.Background() - res, err := s.Library.GetMetadataChildren(ctx, ratingKey) + res, err := s.Playlists.GetPlaylist(ctx, playlistID) if err != nil { log.Fatal(err) } @@ -148,11 +272,11 @@ actions: // handle response } } - - target: $["paths"]["/activities"]["get"] + - target: $["paths"]["/playlists/{playlistID}"]["delete"] update: x-codeSamples: - lang: go - label: getServerActivities + label: deletePlaylist source: |- package main @@ -167,41 +291,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - + var playlistID float64 = 216.22 ctx := context.Background() - res, err := s.Activities.GetServerActivities(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/updater/apply"]["put"] - update: - x-codeSamples: - - lang: go - label: applyUpdates - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var tonight *operations.Tonight = operations.TonightOne.ToPointer() - - var skip *operations.Skip = operations.SkipOne.ToPointer() - ctx := context.Background() - res, err := s.Updater.ApplyUpdates(ctx, tonight, skip) + res, err := s.Playlists.DeletePlaylist(ctx, playlistID) if err != nil { log.Fatal(err) } @@ -209,6 +301,35 @@ actions: // handle response } } + - target: $["paths"]["/identity"]["get"] + update: + x-codeSamples: + - lang: go + label: getServerIdentity + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Server.GetServerIdentity(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - target: $["paths"]["/photo/:/transcode"]["get"] update: x-codeSamples: @@ -247,69 +368,11 @@ actions: // handle response } } - - target: $["paths"]["/:/unscrobble"]["get"] + - target: $["paths"]["/activities"]["get"] update: x-codeSamples: - lang: go - label: markUnplayed - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var key float64 = 59398 - ctx := context.Background() - res, err := s.Media.MarkUnplayed(ctx, key) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/playlists/{playlistID}"]["get"] - update: - x-codeSamples: - - lang: go - label: getPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 4109.48 - ctx := context.Background() - res, err := s.Playlists.GetPlaylist(ctx, playlistID) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/butler"]["delete"] - update: - x-codeSamples: - - lang: go - label: stopAllTasks + label: getServerActivities source: |- package main @@ -326,524 +389,7 @@ actions: ) ctx := context.Background() - res, err := s.Butler.StopAllTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] - update: - x-codeSamples: - - lang: go - label: getLibraryItems - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID any = "" - - var tag operations.Tag = operations.TagGenre - ctx := context.Background() - res, err := s.Library.GetLibraryItems(ctx, sectionID, tag) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/library/hashes"]["get"] - update: - x-codeSamples: - - lang: go - label: getFileHash - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var url_ string = "file://C:\Image.png&type=13" - - var type_ *float64 = plexgo.Float64(4462.17) - ctx := context.Background() - res, err := s.Library.GetFileHash(ctx, url_, type_) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] - update: - x-codeSamples: - - lang: go - label: refreshLibrary - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 934.16 - ctx := context.Background() - res, err := s.Library.RefreshLibrary(ctx, sectionID) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/playlists/upload"]["post"] - update: - x-codeSamples: - - lang: go - label: uploadPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var path string = "/home/barkley/playlist.m3u" - - var force operations.Force = operations.ForceZero - ctx := context.Background() - res, err := s.Playlists.UploadPlaylist(ctx, path, force) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/:/prefs"]["get"] - update: - x-codeSamples: - - lang: go - label: getServerPreferences - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerPreferences(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/butler/{taskName}"]["post"] - update: - x-codeSamples: - - lang: go - label: startTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var taskName operations.TaskName = operations.TaskNameCleanOldBundles - ctx := context.Background() - res, err := s.Butler.StartTask(ctx, taskName) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/security/resources"]["get"] - update: - x-codeSamples: - - lang: go - label: getSourceConnectionInformation - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var source string = "server://client-identifier" - ctx := context.Background() - res, err := s.Authentication.GetSourceConnectionInformation(ctx, source) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/transcode/sessions"]["get"] - update: - x-codeSamples: - - lang: go - label: getTranscodeSessions - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetTranscodeSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/updater/check"]["put"] - update: - x-codeSamples: - - lang: go - label: checkForUpdates - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var download *operations.Download = operations.DownloadOne.ToPointer() - ctx := context.Background() - res, err := s.Updater.CheckForUpdates(ctx, download) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/identity"]["get"] - update: - x-codeSamples: - - lang: go - label: getServerIdentity - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerIdentity(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/home"]["get"] - update: - x-codeSamples: - - lang: go - label: getHomeData - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Plex.GetHomeData(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/playlists/{playlistID}"]["put"] - update: - x-codeSamples: - - lang: go - label: updatePlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 3915 - - var title *string = plexgo.String("") - - var summary *string = plexgo.String("") - ctx := context.Background() - res, err := s.Playlists.UpdatePlaylist(ctx, playlistID, title, summary) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/security/token"]["get"] - update: - x-codeSamples: - - lang: go - label: getTransientToken - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation - - var scope operations.Scope = operations.ScopeAll - ctx := context.Background() - res, err := s.Authentication.GetTransientToken(ctx, type_, scope) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/status/sessions"]["get"] - update: - x-codeSamples: - - lang: go - label: getSessions - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/devices"]["get"] - update: - x-codeSamples: - - lang: go - label: getDevices - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Server.GetDevices(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/:/progress"]["post"] - update: - x-codeSamples: - - lang: go - label: updatePlayProgress - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var key string = "" - - var time float64 = 90000 - - var state string = "played" - ctx := context.Background() - res, err := s.Media.UpdatePlayProgress(ctx, key, time, state) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/hubs"]["get"] - update: - x-codeSamples: - - lang: go - label: getGlobalHubs - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var count *float64 = plexgo.Float64(1262.49) - - var onlyTransient *operations.OnlyTransient = operations.OnlyTransientOne.ToPointer() - ctx := context.Background() - res, err := s.Hubs.GetGlobalHubs(ctx, count, onlyTransient) + res, err := s.Activities.GetServerActivities(ctx) if err != nil { log.Fatal(err) } @@ -883,11 +429,73 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] + - target: $["paths"]["/:/scrobble"]["get"] update: x-codeSamples: - lang: go - label: searchLibrary + label: markPlayed + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var key float64 = 59398 + ctx := context.Background() + res, err := s.Media.MarkPlayed(ctx, key) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/hubs/search"]["get"] + update: + x-codeSamples: + - lang: go + label: performSearch + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var query string = "dylan" + + var sectionID *float64 = plexgo.Float64(1516.53) + + var limit *float64 = plexgo.Float64(5) + ctx := context.Background() + res, err := s.Search.PerformSearch(ctx, query, sectionID, limit) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/playlists"]["get"] + update: + x-codeSamples: + - lang: go + label: getPlaylists source: |- package main @@ -903,11 +511,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var sectionID int64 = 933505 + var playlistType *operations.PlaylistType = operations.PlaylistTypeAudio.ToPointer() - var type_ operations.Type = operations.TypeFour + var smart *operations.QueryParamSmart = operations.QueryParamSmartZero.ToPointer() ctx := context.Background() - res, err := s.Library.SearchLibrary(ctx, sectionID, type_) + res, err := s.Playlists.GetPlaylists(ctx, playlistType, smart) if err != nil { log.Fatal(err) } @@ -915,11 +523,72 @@ actions: // handle response } } - - target: $["paths"]["/library/onDeck"]["get"] + - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] update: x-codeSamples: - lang: go - label: getOnDeck + label: getMetadata + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var ratingKey float64 = 8382.31 + ctx := context.Background() + res, err := s.Library.GetMetadata(ctx, ratingKey) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/updater/apply"]["put"] + update: + x-codeSamples: + - lang: go + label: applyUpdates + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var tonight *operations.Tonight = operations.TonightOne.ToPointer() + + var skip *operations.Skip = operations.SkipOne.ToPointer() + ctx := context.Background() + res, err := s.Updater.ApplyUpdates(ctx, tonight, skip) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/myplex/account"]["get"] + update: + x-codeSamples: + - lang: go + label: getMyPlexAccount source: |- package main @@ -936,7 +605,7 @@ actions: ) ctx := context.Background() - res, err := s.Library.GetOnDeck(ctx) + res, err := s.Server.GetMyPlexAccount(ctx) if err != nil { log.Fatal(err) } @@ -944,11 +613,70 @@ actions: // handle response } } - - target: $["paths"]["/servers"]["get"] + - target: $["paths"]["/activities/{activityUUID}"]["delete"] update: x-codeSamples: - lang: go - label: getServerList + label: cancelServerActivities + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var activityUUID string = "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" + ctx := context.Background() + res, err := s.Activities.CancelServerActivities(ctx, activityUUID) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/butler/{taskName}"]["delete"] + update: + x-codeSamples: + - lang: go + label: stopTask + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var taskName operations.PathParamTaskName = operations.PathParamTaskNameBackupDatabase + ctx := context.Background() + res, err := s.Butler.StopTask(ctx, taskName) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/library/recentlyAdded"]["get"] + update: + x-codeSamples: + - lang: go + label: getRecentlyAdded source: |- package main @@ -965,7 +693,7 @@ actions: ) ctx := context.Background() - res, err := s.Server.GetServerList(ctx) + res, err := s.Library.GetRecentlyAdded(ctx) if err != nil { log.Fatal(err) } @@ -973,6 +701,192 @@ actions: // handle response } } + - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getLibraryHubs + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var sectionID float64 = 6728.76 + + var count *float64 = plexgo.Float64(9010.22) + + var onlyTransient *operations.QueryParamOnlyTransient = operations.QueryParamOnlyTransientZero.ToPointer() + ctx := context.Background() + res, err := s.Hubs.GetLibraryHubs(ctx, sectionID, count, onlyTransient) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/library/sections/{sectionId}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteLibrary + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var sectionID float64 = 1000 + ctx := context.Background() + res, err := s.Library.DeleteLibrary(ctx, sectionID) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] + update: + x-codeSamples: + - lang: go + label: getLibraryItems + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var sectionID any = "" + + var tag operations.Tag = operations.TagGenre + + var includeGuids *int64 = plexgo.Int64(1) + ctx := context.Background() + res, err := s.Library.GetLibraryItems(ctx, sectionID, tag, includeGuids) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/log"]["post"] + update: + x-codeSamples: + - lang: go + label: logMultiLine + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var request string = "level=4&message=Test%20message%201&source=postman + level=3&message=Test%20message%202&source=postman + level=1&message=Test%20message%203&source=postman" + ctx := context.Background() + res, err := s.Log.LogMultiLine(ctx, request) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/clients"]["get"] + update: + x-codeSamples: + - lang: go + label: getAvailableClients + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Server.GetAvailableClients(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/:/unscrobble"]["get"] + update: + x-codeSamples: + - lang: go + label: markUnplayed + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var key float64 = 59398 + ctx := context.Background() + res, err := s.Media.MarkUnplayed(ctx, key) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"] update: x-codeSamples: @@ -1020,6 +934,343 @@ actions: // handle response } } + - target: $["paths"]["/home"]["get"] + update: + x-codeSamples: + - lang: go + label: getHomeData + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Plex.GetHomeData(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/statistics/resources"]["get"] + update: + x-codeSamples: + - lang: go + label: getResourcesStatistics + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + 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 + } + } + - target: $["paths"]["/statistics/media"]["get"] + update: + x-codeSamples: + - lang: go + label: getStatistics + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + 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 + } + } + - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] + update: + x-codeSamples: + - lang: go + label: stopTranscodeSession + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var sessionKey string = "zz7llzqlx8w9vnrsbnwhbmep" + ctx := context.Background() + res, err := s.Sessions.StopTranscodeSession(ctx, sessionKey) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/:/progress"]["post"] + update: + x-codeSamples: + - lang: go + label: updatePlayProgress + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var key string = "" + + var time float64 = 90000 + + var state string = "played" + ctx := context.Background() + res, err := s.Media.UpdatePlayProgress(ctx, key, time, state) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/butler/{taskName}"]["post"] + update: + x-codeSamples: + - lang: go + label: startTask + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var taskName operations.TaskName = operations.TaskNameCleanOldBundles + ctx := context.Background() + res, err := s.Butler.StartTask(ctx, taskName) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/playlists/upload"]["post"] + update: + x-codeSamples: + - lang: go + label: uploadPlaylist + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var path string = "/home/barkley/playlist.m3u" + + var force operations.Force = operations.ForceZero + ctx := context.Background() + res, err := s.Playlists.UploadPlaylist(ctx, path, force) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/security/resources"]["get"] + update: + x-codeSamples: + - lang: go + label: getSourceConnectionInformation + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var source string = "server://client-identifier" + ctx := context.Background() + res, err := s.Authentication.GetSourceConnectionInformation(ctx, source) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/playlists"]["post"] + update: + x-codeSamples: + - lang: go + label: createPlaylist + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + request := operations.CreatePlaylistRequest{ + Title: "", + Type: operations.QueryParamTypePhoto, + Smart: operations.SmartOne, + URI: "https://inborn-brochure.biz", + } + ctx := context.Background() + res, err := s.Playlists.CreatePlaylist(ctx, request) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/updater/check"]["put"] + update: + x-codeSamples: + - lang: go + label: checkForUpdates + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var download *operations.Download = operations.DownloadOne.ToPointer() + ctx := context.Background() + res, err := s.Updater.CheckForUpdates(ctx, download) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/hubs"]["get"] + update: + x-codeSamples: + - lang: go + label: getGlobalHubs + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var count *float64 = plexgo.Float64(1262.49) + + var onlyTransient *operations.OnlyTransient = operations.OnlyTransientOne.ToPointer() + ctx := context.Background() + res, err := s.Hubs.GetGlobalHubs(ctx, count, onlyTransient) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - target: $["paths"]["/hubs/search/voice"]["get"] update: x-codeSamples: @@ -1053,11 +1304,11 @@ actions: // handle response } } - - target: $["paths"]["/log"]["post"] + - target: $["paths"]["/library/hashes"]["get"] update: x-codeSamples: - lang: go - label: logMultiLine + label: getFileHash source: |- package main @@ -1072,11 +1323,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var request string = "level=4&message=Test%20message%201&source=postman - level=3&message=Test%20message%202&source=postman - level=1&message=Test%20message%203&source=postman" + var url_ string = "file://C:\Image.png&type=13" + + var type_ *float64 = plexgo.Float64(4462.17) ctx := context.Background() - res, err := s.Log.LogMultiLine(ctx, request) + res, err := s.Library.GetFileHash(ctx, url_, type_) if err != nil { log.Fatal(err) } @@ -1084,11 +1335,11 @@ actions: // handle response } } - - target: $["paths"]["/playlists"]["get"] + - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] update: x-codeSamples: - lang: go - label: getPlaylists + label: searchLibrary source: |- package main @@ -1104,11 +1355,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var playlistType *operations.PlaylistType = operations.PlaylistTypeAudio.ToPointer() + var sectionID int64 = 933505 - var smart *operations.QueryParamSmart = operations.QueryParamSmartZero.ToPointer() + var type_ operations.Type = operations.TypeFour ctx := context.Background() - res, err := s.Playlists.GetPlaylists(ctx, playlistType, smart) + res, err := s.Library.SearchLibrary(ctx, sectionID, type_) if err != nil { log.Fatal(err) } @@ -1116,11 +1367,11 @@ actions: // handle response } } - - target: $["paths"]["/playlists/{playlistID}"]["delete"] + - target: $["paths"]["/:/prefs"]["get"] update: x-codeSamples: - lang: go - label: deletePlaylist + label: getServerPreferences source: |- package main @@ -1135,9 +1386,43 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var playlistID float64 = 216.22 + ctx := context.Background() - res, err := s.Playlists.DeletePlaylist(ctx, playlistID) + res, err := s.Server.GetServerPreferences(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/log"]["get"] + update: + x-codeSamples: + - lang: go + label: logLine + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var level operations.Level = operations.LevelThree + + var message string = "Test log message" + + var source string = "Postman" + ctx := context.Background() + res, err := s.Log.LogLine(ctx, level, message, source) if err != nil { log.Fatal(err) } @@ -1145,11 +1430,11 @@ actions: // handle response } } - - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] + - target: $["paths"]["/updater/status"]["get"] update: x-codeSamples: - lang: go - label: clearPlaylistContents + label: getUpdateStatus source: |- package main @@ -1164,21 +1449,21 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var playlistID float64 = 1893.18 + ctx := context.Background() - res, err := s.Playlists.ClearPlaylistContents(ctx, playlistID) + res, err := s.Updater.GetUpdateStatus(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.Object != nil { // handle response } } - - target: $["paths"]["/status/sessions/history/all"]["get"] + - target: $["paths"]["/transcode/sessions"]["get"] update: x-codeSamples: - lang: go - label: getSessionHistory + label: getTranscodeSessions source: |- package main @@ -1195,7 +1480,7 @@ actions: ) ctx := context.Background() - res, err := s.Sessions.GetSessionHistory(ctx) + res, err := s.Sessions.GetTranscodeSessions(ctx) if err != nil { log.Fatal(err) } @@ -1244,157 +1529,6 @@ actions: // handle response } } - - target: $["paths"]["/butler"]["get"] - update: - x-codeSamples: - - lang: go - label: getButlerTasks - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Butler.GetButlerTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/updater/status"]["get"] - update: - x-codeSamples: - - lang: go - label: getUpdateStatus - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Updater.GetUpdateStatus(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] - update: - x-codeSamples: - - lang: go - label: getLibraryHubs - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 6728.76 - - var count *float64 = plexgo.Float64(9010.22) - - var onlyTransient *operations.QueryParamOnlyTransient = operations.QueryParamOnlyTransientZero.ToPointer() - ctx := context.Background() - res, err := s.Hubs.GetLibraryHubs(ctx, sectionID, count, onlyTransient) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] - update: - x-codeSamples: - - lang: go - label: getMetadata - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var ratingKey float64 = 8382.31 - ctx := context.Background() - res, err := s.Library.GetMetadata(ctx, ratingKey) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/butler/{taskName}"]["delete"] - update: - x-codeSamples: - - lang: go - label: stopTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var taskName operations.PathParamTaskName = operations.PathParamTaskNameBackupDatabase - ctx := context.Background() - res, err := s.Butler.StopTask(ctx, taskName) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - target: $["paths"]["/pins/{pinID}"]["get"] update: x-codeSamples: @@ -1425,11 +1559,11 @@ actions: // handle response } } - - target: $["paths"]["/library/recentlyAdded"]["get"] + - target: $["paths"]["/search"]["get"] update: x-codeSamples: - lang: go - label: getRecentlyAdded + label: getSearchResults source: |- package main @@ -1444,9 +1578,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - + var query string = "110" ctx := context.Background() - res, err := s.Library.GetRecentlyAdded(ctx) + res, err := s.Search.GetSearchResults(ctx, query) if err != nil { log.Fatal(err) } @@ -1454,11 +1588,11 @@ actions: // handle response } } - - target: $["paths"]["/log"]["get"] + - target: $["paths"]["/security/token"]["get"] update: x-codeSamples: - lang: go - label: logLine + label: getTransientToken source: |- package main @@ -1474,13 +1608,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var level operations.Level = operations.LevelThree + var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation - var message string = "Test log message" - - var source string = "Postman" + var scope operations.Scope = operations.ScopeAll ctx := context.Background() - res, err := s.Log.LogLine(ctx, level, message, source) + res, err := s.Authentication.GetTransientToken(ctx, type_, scope) if err != nil { log.Fatal(err) } @@ -1488,11 +1620,11 @@ actions: // handle response } } - - target: $["paths"]["/log/networked"]["get"] + - target: $["paths"]["/servers"]["get"] update: x-codeSamples: - lang: go - label: enablePaperTrail + label: getServerList source: |- package main @@ -1509,19 +1641,19 @@ actions: ) ctx := context.Background() - res, err := s.Log.EnablePaperTrail(ctx) + res, err := s.Server.GetServerList(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.Object != nil { // handle response } } - - target: $["paths"]["/playlists"]["post"] + - target: $["paths"]["/library/sections/{sectionId}"]["get"] update: x-codeSamples: - lang: go - label: createPlaylist + label: getLibrary source: |- package main @@ -1537,14 +1669,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - request := operations.CreatePlaylistRequest{ - Title: "", - Type: operations.QueryParamTypePhoto, - Smart: operations.SmartOne, - URI: "https://inborn-brochure.biz", - } + var sectionID float64 = 1000 + + var includeDetails *operations.IncludeDetails = operations.IncludeDetailsZero.ToPointer() ctx := context.Background() - res, err := s.Playlists.CreatePlaylist(ctx, request) + res, err := s.Library.GetLibrary(ctx, sectionID, includeDetails) if err != nil { log.Fatal(err) } @@ -1552,11 +1681,11 @@ actions: // handle response } } - - target: $["paths"]["/playlists/{playlistID}/items"]["put"] + - target: $["paths"]["/library/all/top"]["get"] update: x-codeSamples: - lang: go - label: addPlaylistContents + label: getTopWatchedContent source: |- package main @@ -1571,13 +1700,11 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var playlistID float64 = 8502.01 + var type_ int64 = 505531 - var uri string = "server://12345/com.plexapp.plugins.library/library/metadata/1" - - var playQueueID *float64 = plexgo.Float64(123) + var includeGuids *int64 = plexgo.Int64(1) ctx := context.Background() - res, err := s.Playlists.AddPlaylistContents(ctx, playlistID, uri, playQueueID) + res, err := s.Library.GetTopWatchedContent(ctx, type_, includeGuids) if err != nil { log.Fatal(err) } @@ -1585,11 +1712,11 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] + - target: $["paths"]["/status/sessions/history/all"]["get"] update: x-codeSamples: - lang: go - label: getWatchlist + label: getSessionHistory source: |- package main @@ -1605,103 +1732,15 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - request := operations.GetWatchlistRequest{ - Filter: operations.FilterReleased, - XPlexToken: "", - } + var sort *string = plexgo.String("") + + var accountID *int64 = plexgo.Int64(1) + + var filter *operations.Filter = &operations.Filter{} + + var librarySectionID *int64 = plexgo.Int64(12) ctx := context.Background() - res, err := s.Watchlist.GetWatchlist(ctx, request) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/activities/{activityUUID}"]["delete"] - update: - x-codeSamples: - - lang: go - label: cancelServerActivities - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var activityUUID string = "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" - ctx := context.Background() - res, err := s.Activities.CancelServerActivities(ctx, activityUUID) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/hubs/search"]["get"] - update: - x-codeSamples: - - lang: go - label: performSearch - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var query string = "dylan" - - var sectionID *float64 = plexgo.Float64(1516.53) - - var limit *float64 = plexgo.Float64(5) - ctx := context.Background() - res, err := s.Search.PerformSearch(ctx, query, sectionID, limit) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/statistics/media"]["get"] - update: - x-codeSamples: - - lang: go - label: getStatistics - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var timespan *int64 = plexgo.Int64(4) - ctx := context.Background() - res, err := s.Statistics.GetStatistics(ctx, timespan) + res, err := s.Sessions.GetSessionHistory(ctx, sort, accountID, filter, librarySectionID) if err != nil { log.Fatal(err) } @@ -1738,11 +1777,11 @@ actions: // handle response } } - - target: $["paths"]["/butler"]["post"] + - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] update: x-codeSamples: - lang: go - label: startAllTasks + label: refreshLibrary source: |- package main @@ -1757,9 +1796,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - + var sectionID float64 = 934.16 ctx := context.Background() - res, err := s.Butler.StartAllTasks(ctx) + res, err := s.Library.RefreshLibrary(ctx, sectionID) if err != nil { log.Fatal(err) } @@ -1767,43 +1806,11 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/{sectionId}"]["get"] + - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] update: x-codeSamples: - lang: go - label: getLibrary - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 1000 - - var includeDetails *operations.IncludeDetails = operations.IncludeDetailsZero.ToPointer() - ctx := context.Background() - res, err := s.Library.GetLibrary(ctx, sectionID, includeDetails) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/playlists/{playlistID}/items"]["get"] - update: - x-codeSamples: - - lang: go - label: getPlaylistContents + label: clearPlaylistContents source: |- package main @@ -1818,40 +1825,9 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var playlistID float64 = 5004.46 - - var type_ float64 = 9403.59 + var playlistID float64 = 1893.18 ctx := context.Background() - res, err := s.Playlists.GetPlaylistContents(ctx, playlistID, type_) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/:/scrobble"]["get"] - update: - x-codeSamples: - - lang: go - label: markPlayed - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var key float64 = 59398 - ctx := context.Background() - res, err := s.Media.MarkPlayed(ctx, key) + res, err := s.Playlists.ClearPlaylistContents(ctx, playlistID) if err != nil { log.Fatal(err) } @@ -1859,11 +1835,11 @@ actions: // handle response } } - - target: $["paths"]["/search"]["get"] + - target: $["paths"]["/playlists/{playlistID}"]["put"] update: x-codeSamples: - lang: go - label: getSearchResults + label: updatePlaylist source: |- package main @@ -1878,9 +1854,46 @@ actions: plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) - var query string = "110" + var playlistID float64 = 3915 + + var title *string = plexgo.String("") + + var summary *string = plexgo.String("") ctx := context.Background() - res, err := s.Search.GetSearchResults(ctx, query) + res, err := s.Playlists.UpdatePlaylist(ctx, playlistID, title, summary) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/playlists/{playlistID}/items"]["put"] + update: + x-codeSamples: + - lang: go + label: addPlaylistContents + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var playlistID float64 = 8502.01 + + var uri string = "server://12345/com.plexapp.plugins.library/library/metadata/1" + + var playQueueID *float64 = plexgo.Float64(123) + ctx := context.Background() + res, err := s.Playlists.AddPlaylistContents(ctx, playlistID, uri, playQueueID) if err != nil { log.Fatal(err) } @@ -1888,11 +1901,11 @@ actions: // handle response } } - - target: $["paths"]["/myplex/account"]["get"] + - target: $["paths"]["/devices"]["get"] update: x-codeSamples: - lang: go - label: getMyPlexAccount + label: getDevices source: |- package main @@ -1909,7 +1922,7 @@ actions: ) ctx := context.Background() - res, err := s.Server.GetMyPlexAccount(ctx) + res, err := s.Server.GetDevices(ctx) if err != nil { log.Fatal(err) } @@ -1917,3 +1930,90 @@ actions: // handle response } } + - target: $["paths"]["/butler"]["get"] + update: + x-codeSamples: + - lang: go + label: getButlerTasks + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Butler.GetButlerTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/butler"]["delete"] + update: + x-codeSamples: + - lang: go + label: stopAllTasks + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Butler.StopAllTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/log/networked"]["get"] + update: + x-codeSamples: + - lang: go + label: enablePaperTrail + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + + ctx := context.Background() + res, err := s.Log.EnablePaperTrail(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } diff --git a/docs/models/operations/filter.md b/docs/models/operations/filter.md index 43a9487..6b3af5a 100644 --- a/docs/models/operations/filter.md +++ b/docs/models/operations/filter.md @@ -1,12 +1,11 @@ # Filter -Filter +Filters content by field and direction/equality +(Unknown if viewedAt is the only supported column) -## Values -| Name | Value | -| ----------------- | ----------------- | -| `FilterAll` | all | -| `FilterAvailable` | available | -| `FilterReleased` | released | \ No newline at end of file +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsaccount.md b/docs/models/operations/getbandwidthstatisticsaccount.md new file mode 100644 index 0000000..f827ff6 --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsaccount.md @@ -0,0 +1,15 @@ +# GetBandwidthStatisticsAccount + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `ID` | **int* | :heavy_minus_sign: | N/A | 238960586 | +| `Key` | **string* | :heavy_minus_sign: | N/A | /accounts/238960586 | +| `Name` | **string* | :heavy_minus_sign: | N/A | Diane | +| `DefaultAudioLanguage` | **string* | :heavy_minus_sign: | N/A | en | +| `AutoSelectAudio` | **bool* | :heavy_minus_sign: | N/A | true | +| `DefaultSubtitleLanguage` | **string* | :heavy_minus_sign: | N/A | en | +| `SubtitleMode` | **int* | :heavy_minus_sign: | N/A | 1 | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | https://plex.tv/users/50d83634246da1de/avatar?c=1707110967 | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsdevice.md b/docs/models/operations/getbandwidthstatisticsdevice.md new file mode 100644 index 0000000..1492e22 --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsdevice.md @@ -0,0 +1,12 @@ +# GetBandwidthStatisticsDevice + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `ID` | **int* | :heavy_minus_sign: | N/A | 208 | +| `Name` | **string* | :heavy_minus_sign: | N/A | Roku Express | +| `Platform` | **string* | :heavy_minus_sign: | N/A | Roku | +| `ClientIdentifier` | **string* | :heavy_minus_sign: | N/A | 793095d235660625108ef785cc7646e9 | +| `CreatedAt` | **int* | :heavy_minus_sign: | N/A | 1706470556 | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsmediacontainer.md b/docs/models/operations/getbandwidthstatisticsmediacontainer.md new file mode 100644 index 0000000..3122b8b --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsmediacontainer.md @@ -0,0 +1,11 @@ +# GetBandwidthStatisticsMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `Size` | **int* | :heavy_minus_sign: | N/A | 5497 | +| `Device` | [][operations.GetBandwidthStatisticsDevice](../../models/operations/getbandwidthstatisticsdevice.md) | :heavy_minus_sign: | N/A | | +| `Account` | [][operations.GetBandwidthStatisticsAccount](../../models/operations/getbandwidthstatisticsaccount.md) | :heavy_minus_sign: | N/A | | +| `StatisticsBandwidth` | [][operations.StatisticsBandwidth](../../models/operations/statisticsbandwidth.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsrequest.md b/docs/models/operations/getbandwidthstatisticsrequest.md new file mode 100644 index 0000000..10fc29e --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsrequest.md @@ -0,0 +1,8 @@ +# GetBandwidthStatisticsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `Timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| 4 | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsresponse.md b/docs/models/operations/getbandwidthstatisticsresponse.md new file mode 100644 index 0000000..4da7b74 --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsresponse.md @@ -0,0 +1,11 @@ +# GetBandwidthStatisticsResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetBandwidthStatisticsResponseBody](../../models/operations/getbandwidthstatisticsresponsebody.md) | :heavy_minus_sign: | Bandwidth Statistics | \ No newline at end of file diff --git a/docs/models/operations/getbandwidthstatisticsresponsebody.md b/docs/models/operations/getbandwidthstatisticsresponsebody.md new file mode 100644 index 0000000..ba31283 --- /dev/null +++ b/docs/models/operations/getbandwidthstatisticsresponsebody.md @@ -0,0 +1,10 @@ +# GetBandwidthStatisticsResponseBody + +Bandwidth Statistics + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetBandwidthStatisticsMediaContainer](../../models/operations/getbandwidthstatisticsmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getlibraryitemsmediacontainer.md b/docs/models/operations/getlibraryitemsmediacontainer.md index bf8ac21..c0aa430 100644 --- a/docs/models/operations/getlibraryitemsmediacontainer.md +++ b/docs/models/operations/getlibraryitemsmediacontainer.md @@ -9,7 +9,7 @@ | `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | | `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | | `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | -| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | +| `LibrarySectionID` | [*operations.LibrarySectionID](../../models/operations/librarysectionid.md) | :heavy_minus_sign: | N/A | | | `LibrarySectionTitle` | **string* | :heavy_minus_sign: | N/A | Movies | | `LibrarySectionUUID` | **string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | | `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | diff --git a/docs/models/operations/getlibraryitemsrequest.md b/docs/models/operations/getlibraryitemsrequest.md index a0bbfc6..305d69d 100644 --- a/docs/models/operations/getlibraryitemsrequest.md +++ b/docs/models/operations/getlibraryitemsrequest.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `SectionID` | *any* | :heavy_check_mark: | the Id of the library to query | -| `Tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `SectionID` | *any* | :heavy_check_mark: | the Id of the library to query | | +| `Tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | +| `IncludeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | \ No newline at end of file diff --git a/docs/models/operations/getmetadatachildrenrequest.md b/docs/models/operations/getmetadatachildrenrequest.md index 4db830d..851ab84 100644 --- a/docs/models/operations/getmetadatachildrenrequest.md +++ b/docs/models/operations/getmetadatachildrenrequest.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `RatingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `RatingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | +| `IncludeElements` | **string* | :heavy_minus_sign: | Adds additional elements to the response. Supported types are (Stream)
| \ No newline at end of file diff --git a/docs/models/operations/getpinglobals.md b/docs/models/operations/getpinglobals.md index 573bc73..9b83ca7 100644 --- a/docs/models/operations/getpinglobals.md +++ b/docs/models/operations/getpinglobals.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `XPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file diff --git a/docs/models/operations/getpinresponsebody.md b/docs/models/operations/getpinresponsebody.md index 9195855..154736b 100644 --- a/docs/models/operations/getpinresponsebody.md +++ b/docs/models/operations/getpinresponsebody.md @@ -18,4 +18,4 @@ The Pin | `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC | | `ExpiresAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC | | `AuthToken` | **string* | :heavy_minus_sign: | N/A | | -| `NewRegistration` | **string* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `NewRegistration` | **bool* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getresourcesstatisticsmediacontainer.md b/docs/models/operations/getresourcesstatisticsmediacontainer.md new file mode 100644 index 0000000..7177cf9 --- /dev/null +++ b/docs/models/operations/getresourcesstatisticsmediacontainer.md @@ -0,0 +1,9 @@ +# GetResourcesStatisticsMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Size` | **int* | :heavy_minus_sign: | N/A | 5497 | +| `StatisticsResources` | [][operations.StatisticsResources](../../models/operations/statisticsresources.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getresourcesstatisticsrequest.md b/docs/models/operations/getresourcesstatisticsrequest.md new file mode 100644 index 0000000..689d41b --- /dev/null +++ b/docs/models/operations/getresourcesstatisticsrequest.md @@ -0,0 +1,8 @@ +# GetResourcesStatisticsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `Timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| 4 | \ No newline at end of file diff --git a/docs/models/operations/getresourcesstatisticsresponse.md b/docs/models/operations/getresourcesstatisticsresponse.md new file mode 100644 index 0000000..7d0c840 --- /dev/null +++ b/docs/models/operations/getresourcesstatisticsresponse.md @@ -0,0 +1,11 @@ +# GetResourcesStatisticsResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetResourcesStatisticsResponseBody](../../models/operations/getresourcesstatisticsresponsebody.md) | :heavy_minus_sign: | Resource Statistics | \ No newline at end of file diff --git a/docs/models/operations/getresourcesstatisticsresponsebody.md b/docs/models/operations/getresourcesstatisticsresponsebody.md new file mode 100644 index 0000000..a46453d --- /dev/null +++ b/docs/models/operations/getresourcesstatisticsresponsebody.md @@ -0,0 +1,10 @@ +# GetResourcesStatisticsResponseBody + +Resource Statistics + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetResourcesStatisticsMediaContainer](../../models/operations/getresourcesstatisticsmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getsessionhistoryrequest.md b/docs/models/operations/getsessionhistoryrequest.md new file mode 100644 index 0000000..ee76742 --- /dev/null +++ b/docs/models/operations/getsessionhistoryrequest.md @@ -0,0 +1,11 @@ +# GetSessionHistoryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Sort` | **string* | :heavy_minus_sign: | Sorts the results by the specified field followed by the direction (asc, desc)
| | +| `AccountID` | **int64* | :heavy_minus_sign: | Filter results by those that are related to a specific users id
| 1 | +| `Filter` | [*operations.Filter](../../models/operations/filter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | +| `LibrarySectionID` | **int64* | :heavy_minus_sign: | Filters the results based on the id of a valid library section
| 12 | \ No newline at end of file diff --git a/docs/models/operations/getsessionsmetadata.md b/docs/models/operations/getsessionsmetadata.md index 48ac726..d47ced3 100644 --- a/docs/models/operations/getsessionsmetadata.md +++ b/docs/models/operations/getsessionsmetadata.md @@ -39,6 +39,6 @@ | `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705543314 | | `ViewOffset` | **int* | :heavy_minus_sign: | N/A | 1000 | | `Media` | [][operations.GetSessionsMedia](../../models/operations/getsessionsmedia.md) | :heavy_minus_sign: | N/A | | -| `User` | [*operations.User](../../models/operations/user.md) | :heavy_minus_sign: | N/A | | +| `User` | [*operations.GetSessionsUser](../../models/operations/getsessionsuser.md) | :heavy_minus_sign: | N/A | | | `Player` | [*operations.Player](../../models/operations/player.md) | :heavy_minus_sign: | N/A | | | `Session` | [*operations.Session](../../models/operations/session.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getsessionsuser.md b/docs/models/operations/getsessionsuser.md new file mode 100644 index 0000000..84fed00 --- /dev/null +++ b/docs/models/operations/getsessionsuser.md @@ -0,0 +1,10 @@ +# GetSessionsUser + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | N/A | 1 | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661 | +| `Title` | **string* | :heavy_minus_sign: | N/A | Blindkitty38 | \ No newline at end of file diff --git a/docs/models/operations/gettokenglobals.md b/docs/models/operations/gettokenglobals.md index 6b92fbd..367b5ed 100644 --- a/docs/models/operations/gettokenglobals.md +++ b/docs/models/operations/gettokenglobals.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `XPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentcountry.md b/docs/models/operations/gettopwatchedcontentcountry.md new file mode 100644 index 0000000..54a9d3c --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentcountry.md @@ -0,0 +1,10 @@ +# GetTopWatchedContentCountry + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `ID` | **int* | :heavy_minus_sign: | N/A | 116 | +| `Filter` | **string* | :heavy_minus_sign: | N/A | country=116 | +| `Tag` | **string* | :heavy_minus_sign: | N/A | United States of America | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentgenre.md b/docs/models/operations/gettopwatchedcontentgenre.md new file mode 100644 index 0000000..743c518 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentgenre.md @@ -0,0 +1,10 @@ +# GetTopWatchedContentGenre + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | **int* | :heavy_minus_sign: | N/A | 184 | +| `Filter` | **string* | :heavy_minus_sign: | N/A | genre=184 | +| `Tag` | **string* | :heavy_minus_sign: | N/A | Thriller | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentguids.md b/docs/models/operations/gettopwatchedcontentguids.md new file mode 100644 index 0000000..0a6c61a --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentguids.md @@ -0,0 +1,8 @@ +# GetTopWatchedContentGuids + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | **string* | :heavy_minus_sign: | N/A | tvdb://2337 | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentmediacontainer.md b/docs/models/operations/gettopwatchedcontentmediacontainer.md new file mode 100644 index 0000000..671c66a --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentmediacontainer.md @@ -0,0 +1,13 @@ +# GetTopWatchedContentMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Size` | **int* | :heavy_minus_sign: | N/A | 1 | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | +| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | +| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | +| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1698860922 | +| `Metadata` | [][operations.GetTopWatchedContentMetadata](../../models/operations/gettopwatchedcontentmetadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentmetadata.md b/docs/models/operations/gettopwatchedcontentmetadata.md new file mode 100644 index 0000000..3954c57 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentmetadata.md @@ -0,0 +1,39 @@ +# GetTopWatchedContentMetadata + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `RatingKey` | **string* | :heavy_minus_sign: | N/A | 17 | +| `Key` | **string* | :heavy_minus_sign: | N/A | /library/metadata/17 | +| `GUID` | **string* | :heavy_minus_sign: | N/A | plex://movie/5d77683f6f4521001ea9dc53 | +| `Slug` | **string* | :heavy_minus_sign: | N/A | waterloo-road | +| `Studio` | **string* | :heavy_minus_sign: | N/A | Universal Pictures | +| `Type` | **string* | :heavy_minus_sign: | N/A | movie | +| `Title` | **string* | :heavy_minus_sign: | N/A | Serenity | +| `LibrarySectionTitle` | **string* | :heavy_minus_sign: | N/A | Movies | +| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | +| `LibrarySectionKey` | **string* | :heavy_minus_sign: | N/A | /library/sections/1 | +| `ContentRating` | **string* | :heavy_minus_sign: | N/A | PG-13 | +| `Summary` | **string* | :heavy_minus_sign: | N/A | Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job. | +| `Index` | **int64* | :heavy_minus_sign: | N/A | 1 | +| `AudienceRating` | **float64* | :heavy_minus_sign: | N/A | 9.1 | +| `Year` | **int* | :heavy_minus_sign: | N/A | 2005 | +| `Tagline` | **string* | :heavy_minus_sign: | N/A | They aim to misbehave. | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/17/thumb/1705637165 | +| `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/17/art/1705637165 | +| `Duration` | **int* | :heavy_minus_sign: | N/A | 141417 | +| `OriginallyAvailableAt` | [*types.Date](../../types/date.md) | :heavy_minus_sign: | N/A | 2005-09-29 00:00:00 +0000 UTC | +| `LeafCount` | **int64* | :heavy_minus_sign: | N/A | 222 | +| `ViewedLeafCount` | **int64* | :heavy_minus_sign: | N/A | 100 | +| `ChildCount` | **int64* | :heavy_minus_sign: | N/A | 13 | +| `AddedAt` | **int* | :heavy_minus_sign: | N/A | 1705637164 | +| `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705637165 | +| `GlobalViewCount` | **int64* | :heavy_minus_sign: | N/A | 80 | +| `AudienceRatingImage` | **string* | :heavy_minus_sign: | N/A | rottentomatoes://image.rating.upright | +| `Genre` | [][operations.GetTopWatchedContentGenre](../../models/operations/gettopwatchedcontentgenre.md) | :heavy_minus_sign: | N/A | | +| `Country` | [][operations.GetTopWatchedContentCountry](../../models/operations/gettopwatchedcontentcountry.md) | :heavy_minus_sign: | N/A | | +| `Guids` | [][operations.GetTopWatchedContentGuids](../../models/operations/gettopwatchedcontentguids.md) | :heavy_minus_sign: | N/A | | +| `Role` | [][operations.GetTopWatchedContentRole](../../models/operations/gettopwatchedcontentrole.md) | :heavy_minus_sign: | N/A | | +| `User` | [][operations.User](../../models/operations/user.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentrequest.md b/docs/models/operations/gettopwatchedcontentrequest.md new file mode 100644 index 0000000..60b0593 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentrequest.md @@ -0,0 +1,9 @@ +# GetTopWatchedContentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `Type` | *int64* | :heavy_check_mark: | the library type (1 - movies, 2 - shows, 3 - music) | | +| `IncludeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentresponse.md b/docs/models/operations/gettopwatchedcontentresponse.md new file mode 100644 index 0000000..2d2cbb2 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentresponse.md @@ -0,0 +1,11 @@ +# GetTopWatchedContentResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetTopWatchedContentResponseBody](../../models/operations/gettopwatchedcontentresponsebody.md) | :heavy_minus_sign: | The metadata of the library item. | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentresponsebody.md b/docs/models/operations/gettopwatchedcontentresponsebody.md new file mode 100644 index 0000000..898c0be --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentresponsebody.md @@ -0,0 +1,10 @@ +# GetTopWatchedContentResponseBody + +The metadata of the library item. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetTopWatchedContentMediaContainer](../../models/operations/gettopwatchedcontentmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentrole.md b/docs/models/operations/gettopwatchedcontentrole.md new file mode 100644 index 0000000..4f5fbb2 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentrole.md @@ -0,0 +1,13 @@ +# GetTopWatchedContentRole + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `ID` | **int* | :heavy_minus_sign: | N/A | 220 | +| `Filter` | **string* | :heavy_minus_sign: | N/A | actor=220 | +| `Tag` | **string* | :heavy_minus_sign: | N/A | Dennis Keiffer | +| `TagKey` | **string* | :heavy_minus_sign: | N/A | 5d77683554f42c001f8c4708 | +| `Role` | **string* | :heavy_minus_sign: | N/A | Bar Guy (uncredited) | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg | \ No newline at end of file diff --git a/docs/models/operations/getwatchlistrequest.md b/docs/models/operations/getwatchlistrequest.md index 1a8926f..1d04e4e 100644 --- a/docs/models/operations/getwatchlistrequest.md +++ b/docs/models/operations/getwatchlistrequest.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Filter` | [operations.Filter](../../models/operations/filter.md) | :heavy_check_mark: | Filter | +| `Filter` | [operations.PathParamFilter](../../models/operations/pathparamfilter.md) | :heavy_check_mark: | Filter | | `Sort` | **string* | :heavy_minus_sign: | In the format "field:dir". Available fields are "watchlistedAt" (Added At),
"titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
"dir" can be "asc" or "desc"
| | `Libtype` | [*operations.Libtype](../../models/operations/libtype.md) | :heavy_minus_sign: | The type of library to filter. Can be "movie" or "show", or all if not present.
| | `Maxresults` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
| diff --git a/docs/models/operations/librarysectionid.md b/docs/models/operations/librarysectionid.md new file mode 100644 index 0000000..85ef6f6 --- /dev/null +++ b/docs/models/operations/librarysectionid.md @@ -0,0 +1,17 @@ +# LibrarySectionID + + +## Supported Types + +### + +```go +librarySectionID := operations.CreateLibrarySectionIDInteger(int64{/* values here */}) +``` + +### + +```go +librarySectionID := operations.CreateLibrarySectionIDStr(string{/* values here */}) +``` + diff --git a/docs/models/operations/pathparamfilter.md b/docs/models/operations/pathparamfilter.md new file mode 100644 index 0000000..ccef5f4 --- /dev/null +++ b/docs/models/operations/pathparamfilter.md @@ -0,0 +1,12 @@ +# PathParamFilter + +Filter + + +## Values + +| Name | Value | +| -------------------------- | -------------------------- | +| `PathParamFilterAll` | all | +| `PathParamFilterAvailable` | available | +| `PathParamFilterReleased` | released | \ No newline at end of file diff --git a/docs/models/operations/statisticsbandwidth.md b/docs/models/operations/statisticsbandwidth.md new file mode 100644 index 0000000..83f4294 --- /dev/null +++ b/docs/models/operations/statisticsbandwidth.md @@ -0,0 +1,13 @@ +# StatisticsBandwidth + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `AccountID` | **int* | :heavy_minus_sign: | N/A | 238960586 | +| `DeviceID` | **int* | :heavy_minus_sign: | N/A | | +| `Timespan` | **int64* | :heavy_minus_sign: | N/A | 6 | +| `At` | **int* | :heavy_minus_sign: | N/A | 1718387650 | +| `Lan` | **bool* | :heavy_minus_sign: | N/A | true | +| `Bytes` | **int64* | :heavy_minus_sign: | N/A | 22 | \ No newline at end of file diff --git a/docs/models/operations/statisticsresources.md b/docs/models/operations/statisticsresources.md new file mode 100644 index 0000000..7520831 --- /dev/null +++ b/docs/models/operations/statisticsresources.md @@ -0,0 +1,13 @@ +# StatisticsResources + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `Timespan` | **int64* | :heavy_minus_sign: | N/A | 6 | +| `At` | **int64* | :heavy_minus_sign: | N/A | 1718384427 | +| `HostCPUUtilization` | **float32* | :heavy_minus_sign: | N/A | 1.276 | +| `ProcessCPUUtilization` | **float32* | :heavy_minus_sign: | N/A | 0.025 | +| `HostMemoryUtilization` | **float32* | :heavy_minus_sign: | N/A | 17.026 | +| `ProcessMemoryUtilization` | **float32* | :heavy_minus_sign: | N/A | 0.493 | \ No newline at end of file diff --git a/docs/models/operations/user.md b/docs/models/operations/user.md index 6362d9a..5e970bb 100644 --- a/docs/models/operations/user.md +++ b/docs/models/operations/user.md @@ -3,8 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `ID` | **string* | :heavy_minus_sign: | N/A | 1 | -| `Thumb` | **string* | :heavy_minus_sign: | N/A | https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661 | -| `Title` | **string* | :heavy_minus_sign: | N/A | Blindkitty38 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | **int* | :heavy_minus_sign: | N/A | 220 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbandwidthstatisticserrors.md b/docs/models/sdkerrors/getbandwidthstatisticserrors.md new file mode 100644 index 0000000..dafd0e2 --- /dev/null +++ b/docs/models/sdkerrors/getbandwidthstatisticserrors.md @@ -0,0 +1,10 @@ +# GetBandwidthStatisticsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md b/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md new file mode 100644 index 0000000..8e7f30a --- /dev/null +++ b/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md @@ -0,0 +1,11 @@ +# GetBandwidthStatisticsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetBandwidthStatisticsErrors](../../models/sdkerrors/getbandwidthstatisticserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresourcesstatisticserrors.md b/docs/models/sdkerrors/getresourcesstatisticserrors.md new file mode 100644 index 0000000..56aad74 --- /dev/null +++ b/docs/models/sdkerrors/getresourcesstatisticserrors.md @@ -0,0 +1,10 @@ +# GetResourcesStatisticsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md b/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md new file mode 100644 index 0000000..53068b0 --- /dev/null +++ b/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md @@ -0,0 +1,11 @@ +# GetResourcesStatisticsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetResourcesStatisticsErrors](../../models/sdkerrors/getresourcesstatisticserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 66c8474..a63c7cc 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -18,6 +18,7 @@ API Calls interacting with Plex Media Server Libraries * [SearchLibrary](#searchlibrary) - Search Library * [GetMetadata](#getmetadata) - Get Items Metadata * [GetMetadataChildren](#getmetadatachildren) - Get Items Children +* [GetTopWatchedContent](#gettopwatchedcontent) - Get Top Watched Content * [GetOnDeck](#getondeck) - Get On Deck ## GetFileHash @@ -355,8 +356,10 @@ func main() { var sectionID any = "" var tag operations.Tag = operations.TagGenre + + var includeGuids *int64 = plexgo.Int64(1) ctx := context.Background() - res, err := s.Library.GetLibraryItems(ctx, sectionID, tag) + res, err := s.Library.GetLibraryItems(ctx, sectionID, tag, includeGuids) if err != nil { log.Fatal(err) } @@ -368,11 +371,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `sectionID` | *any* | :heavy_check_mark: | the Id of the library to query | -| `tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sectionID` | *any* | :heavy_check_mark: | the Id of the library to query | | +| `tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | +| `includeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | ### Response @@ -573,8 +577,10 @@ func main() { plexgo.WithXPlexClientIdentifier("Postman"), ) var ratingKey float64 = 1539.14 + + var includeElements *string = plexgo.String("") ctx := context.Background() - res, err := s.Library.GetMetadataChildren(ctx, ratingKey) + res, err := s.Library.GetMetadataChildren(ctx, ratingKey, includeElements) if err != nil { log.Fatal(err) } @@ -586,10 +592,11 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `ratingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `ratingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | +| `includeElements` | **string* | :heavy_minus_sign: | Adds additional elements to the response. Supported types are (Stream)
| ### Response @@ -600,6 +607,57 @@ func main() { | sdkerrors.GetMetadataChildrenResponseBody | 401 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | +## GetTopWatchedContent + +This endpoint will return the top watched content from libraries of a certain type + + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("Postman"), + ) + var type_ int64 = 505531 + + var includeGuids *int64 = plexgo.Int64(1) + ctx := context.Background() + res, err := s.Library.GetTopWatchedContent(ctx, type_, includeGuids) + 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. | | +| `type_` | *int64* | :heavy_check_mark: | the library type (1 - movies, 2 - shows, 3 - music) | | +| `includeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | + + +### Response + +**[*operations.GetTopWatchedContentResponse](../../models/operations/gettopwatchedcontentresponse.md), error** +| Error Object | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetOnDeck This endpoint will return the on deck content. diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index cc60aa4..729cda3 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -8,7 +8,7 @@ Operations against the Plex Media Server System. ### Available Operations -* [GetServerCapabilities](#getservercapabilities) - Server Capabilities +* [GetServerCapabilities](#getservercapabilities) - Get Server Capabilities * [GetServerPreferences](#getserverpreferences) - Get Server Preferences * [GetAvailableClients](#getavailableclients) - Get Available Clients * [GetDevices](#getdevices) - Get Devices @@ -19,7 +19,7 @@ Operations against the Plex Media Server System. ## GetServerCapabilities -Server Capabilities +Get Server Capabilities ### Example Usage diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index c889aa5..d8aa611 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -71,6 +71,7 @@ package main import( "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -80,9 +81,15 @@ func main() { plexgo.WithSecurity(""), plexgo.WithXPlexClientIdentifier("Postman"), ) + var sort *string = plexgo.String("") + var accountID *int64 = plexgo.Int64(1) + + var filter *operations.Filter = &operations.Filter{} + + var librarySectionID *int64 = plexgo.Int64(12) ctx := context.Background() - res, err := s.Sessions.GetSessionHistory(ctx) + res, err := s.Sessions.GetSessionHistory(ctx, sort, accountID, filter, librarySectionID) if err != nil { log.Fatal(err) } @@ -94,9 +101,13 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sort` | **string* | :heavy_minus_sign: | Sorts the results by the specified field followed by the direction (asc, desc)
| | +| `accountID` | **int64* | :heavy_minus_sign: | Filter results by those that are related to a specific users id
| 1 | +| `filter` | [*operations.Filter](../../models/operations/filter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | +| `librarySectionID` | **int64* | :heavy_minus_sign: | Filters the results based on the id of a valid library section
| 12 | ### Response diff --git a/docs/sdks/statistics/README.md b/docs/sdks/statistics/README.md index df77e61..8f29f7b 100644 --- a/docs/sdks/statistics/README.md +++ b/docs/sdks/statistics/README.md @@ -9,6 +9,8 @@ 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 @@ -57,3 +59,99 @@ func main() { | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.GetStatisticsResponseBody | 401 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + +## GetResourcesStatistics + +This will return the resources for the server + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + 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](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
the exact meaning of this parameter is not known
| 4 | + + +### Response + +**[*operations.GetResourcesStatisticsResponse](../../models/operations/getresourcesstatisticsresponse.md), 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 + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + 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](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
the exact meaning of this parameter is not known
| 4 | + + +### Response + +**[*operations.GetBandwidthStatisticsResponse](../../models/operations/getbandwidthstatisticsresponse.md), error** +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetBandwidthStatisticsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index fcf4899..583ff15 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -32,7 +32,7 @@ func main() { plexgo.WithXPlexClientIdentifier("Postman"), ) request := operations.GetWatchlistRequest{ - Filter: operations.FilterReleased, + Filter: operations.PathParamFilterReleased, XPlexToken: "", } ctx := context.Background() diff --git a/internal/globals/globals.go b/internal/globals/globals.go index c53a33a..c93e2de 100644 --- a/internal/globals/globals.go +++ b/internal/globals/globals.go @@ -7,12 +7,12 @@ type Globals struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` } -func (o *Globals) GetXPlexClientIdentifier() string { +func (o *Globals) GetXPlexClientIdentifier() *string { if o == nil { - return "" + return nil } return o.XPlexClientIdentifier } diff --git a/internal/utils/contenttype.go b/internal/utils/contenttype.go index 8ed13e2..763f2d6 100644 --- a/internal/utils/contenttype.go +++ b/internal/utils/contenttype.go @@ -9,6 +9,10 @@ import ( ) func MatchContentType(contentType string, pattern string) bool { + if contentType == "" { + contentType = "application/octet-stream" + } + if contentType == pattern || pattern == "*" || pattern == "*/*" { return true } diff --git a/library.go b/library.go index fc98541..c446efd 100644 --- a/library.go +++ b/library.go @@ -635,7 +635,7 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat // - `resolution`: Items categorized by resolution. // - `firstCharacter`: Items categorized by the first letter. // - `folder`: Items categorized by folder. -func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operations.Tag) (*operations.GetLibraryItemsResponse, error) { +func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operations.Tag, includeGuids *int64) (*operations.GetLibraryItemsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getLibraryItems", @@ -644,8 +644,9 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat } request := operations.GetLibraryItemsRequest{ - SectionID: sectionID, - Tag: tag, + SectionID: sectionID, + Tag: tag, + IncludeGuids: includeGuids, } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) @@ -661,6 +662,10 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -1099,7 +1104,7 @@ func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operatio // GetMetadataChildren - Get Items Children // This endpoint will return the children of of a library item specified with the ratingKey. -func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64) (*operations.GetMetadataChildrenResponse, error) { +func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, includeElements *string) (*operations.GetMetadataChildrenResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getMetadataChildren", @@ -1108,7 +1113,8 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64) (* } request := operations.GetMetadataChildrenRequest{ - RatingKey: ratingKey, + RatingKey: ratingKey, + IncludeElements: includeElements, } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) @@ -1124,6 +1130,10 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64) (* req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -1210,6 +1220,109 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64) (* } +// GetTopWatchedContent - Get Top Watched Content +// This endpoint will return the top watched content from libraries of a certain type +func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, includeGuids *int64) (*operations.GetTopWatchedContentResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getTopWatchedContent", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetTopWatchedContentRequest{ + Type: type_, + IncludeGuids: includeGuids, + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/library/all/top") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetTopWatchedContentResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetTopWatchedContentResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + // GetOnDeck - Get On Deck // This endpoint will return the on deck content. func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, error) { diff --git a/models/operations/getbandwidthstatistics.go b/models/operations/getbandwidthstatistics.go new file mode 100644 index 0000000..23d0e0b --- /dev/null +++ b/models/operations/getbandwidthstatistics.go @@ -0,0 +1,268 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +type GetBandwidthStatisticsRequest struct { + // The timespan to retrieve statistics for + // the exact meaning of this parameter is not known + // + Timespan *int64 `queryParam:"style=form,explode=true,name=Timespan"` +} + +func (o *GetBandwidthStatisticsRequest) GetTimespan() *int64 { + if o == nil { + return nil + } + return o.Timespan +} + +type GetBandwidthStatisticsDevice struct { + ID *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Platform *string `json:"platform,omitempty"` + ClientIdentifier *string `json:"clientIdentifier,omitempty"` + CreatedAt *int `json:"createdAt,omitempty"` +} + +func (o *GetBandwidthStatisticsDevice) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetBandwidthStatisticsDevice) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *GetBandwidthStatisticsDevice) GetPlatform() *string { + if o == nil { + return nil + } + return o.Platform +} + +func (o *GetBandwidthStatisticsDevice) GetClientIdentifier() *string { + if o == nil { + return nil + } + return o.ClientIdentifier +} + +func (o *GetBandwidthStatisticsDevice) GetCreatedAt() *int { + if o == nil { + return nil + } + return o.CreatedAt +} + +type GetBandwidthStatisticsAccount struct { + ID *int `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Name *string `json:"name,omitempty"` + DefaultAudioLanguage *string `json:"defaultAudioLanguage,omitempty"` + AutoSelectAudio *bool `json:"autoSelectAudio,omitempty"` + DefaultSubtitleLanguage *string `json:"defaultSubtitleLanguage,omitempty"` + SubtitleMode *int `json:"subtitleMode,omitempty"` + Thumb *string `json:"thumb,omitempty"` +} + +func (o *GetBandwidthStatisticsAccount) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetBandwidthStatisticsAccount) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetBandwidthStatisticsAccount) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *GetBandwidthStatisticsAccount) GetDefaultAudioLanguage() *string { + if o == nil { + return nil + } + return o.DefaultAudioLanguage +} + +func (o *GetBandwidthStatisticsAccount) GetAutoSelectAudio() *bool { + if o == nil { + return nil + } + return o.AutoSelectAudio +} + +func (o *GetBandwidthStatisticsAccount) GetDefaultSubtitleLanguage() *string { + if o == nil { + return nil + } + return o.DefaultSubtitleLanguage +} + +func (o *GetBandwidthStatisticsAccount) GetSubtitleMode() *int { + if o == nil { + return nil + } + return o.SubtitleMode +} + +func (o *GetBandwidthStatisticsAccount) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +type StatisticsBandwidth struct { + AccountID *int `json:"accountID,omitempty"` + DeviceID *int `json:"deviceID,omitempty"` + Timespan *int64 `json:"timespan,omitempty"` + At *int `json:"at,omitempty"` + Lan *bool `json:"lan,omitempty"` + Bytes *int64 `json:"bytes,omitempty"` +} + +func (o *StatisticsBandwidth) GetAccountID() *int { + if o == nil { + return nil + } + return o.AccountID +} + +func (o *StatisticsBandwidth) GetDeviceID() *int { + if o == nil { + return nil + } + return o.DeviceID +} + +func (o *StatisticsBandwidth) GetTimespan() *int64 { + if o == nil { + return nil + } + return o.Timespan +} + +func (o *StatisticsBandwidth) GetAt() *int { + if o == nil { + return nil + } + return o.At +} + +func (o *StatisticsBandwidth) GetLan() *bool { + if o == nil { + return nil + } + return o.Lan +} + +func (o *StatisticsBandwidth) GetBytes() *int64 { + if o == nil { + return nil + } + return o.Bytes +} + +type GetBandwidthStatisticsMediaContainer struct { + Size *int `json:"size,omitempty"` + Device []GetBandwidthStatisticsDevice `json:"Device,omitempty"` + Account []GetBandwidthStatisticsAccount `json:"Account,omitempty"` + StatisticsBandwidth []StatisticsBandwidth `json:"StatisticsBandwidth,omitempty"` +} + +func (o *GetBandwidthStatisticsMediaContainer) GetSize() *int { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetBandwidthStatisticsMediaContainer) GetDevice() []GetBandwidthStatisticsDevice { + if o == nil { + return nil + } + return o.Device +} + +func (o *GetBandwidthStatisticsMediaContainer) GetAccount() []GetBandwidthStatisticsAccount { + if o == nil { + return nil + } + return o.Account +} + +func (o *GetBandwidthStatisticsMediaContainer) GetStatisticsBandwidth() []StatisticsBandwidth { + if o == nil { + return nil + } + return o.StatisticsBandwidth +} + +// GetBandwidthStatisticsResponseBody - Bandwidth Statistics +type GetBandwidthStatisticsResponseBody struct { + MediaContainer *GetBandwidthStatisticsMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetBandwidthStatisticsResponseBody) GetMediaContainer() *GetBandwidthStatisticsMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetBandwidthStatisticsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Bandwidth Statistics + Object *GetBandwidthStatisticsResponseBody +} + +func (o *GetBandwidthStatisticsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetBandwidthStatisticsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetBandwidthStatisticsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetBandwidthStatisticsResponse) GetObject() *GetBandwidthStatisticsResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getlibraryitems.go b/models/operations/getlibraryitems.go index a2e0348..5078b59 100644 --- a/models/operations/getlibraryitems.go +++ b/models/operations/getlibraryitems.go @@ -4,6 +4,7 @@ package operations import ( "encoding/json" + "errors" "fmt" "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/types" @@ -93,6 +94,9 @@ type GetLibraryItemsRequest struct { SectionID any `pathParam:"style=simple,explode=false,name=sectionId"` // A key representing a specific tag within the section. Tag Tag `pathParam:"style=simple,explode=false,name=tag"` + // Adds the Guids object to the response + // + IncludeGuids *int64 `queryParam:"style=form,explode=true,name=includeGuids"` } func (o *GetLibraryItemsRequest) GetSectionID() any { @@ -109,6 +113,76 @@ func (o *GetLibraryItemsRequest) GetTag() Tag { return o.Tag } +func (o *GetLibraryItemsRequest) GetIncludeGuids() *int64 { + if o == nil { + return nil + } + return o.IncludeGuids +} + +type LibrarySectionIDType string + +const ( + LibrarySectionIDTypeInteger LibrarySectionIDType = "integer" + LibrarySectionIDTypeStr LibrarySectionIDType = "str" +) + +type LibrarySectionID struct { + Integer *int64 + Str *string + + Type LibrarySectionIDType +} + +func CreateLibrarySectionIDInteger(integer int64) LibrarySectionID { + typ := LibrarySectionIDTypeInteger + + return LibrarySectionID{ + Integer: &integer, + Type: typ, + } +} + +func CreateLibrarySectionIDStr(str string) LibrarySectionID { + typ := LibrarySectionIDTypeStr + + return LibrarySectionID{ + Str: &str, + Type: typ, + } +} + +func (u *LibrarySectionID) UnmarshalJSON(data []byte) error { + + var integer int64 = int64(0) + if err := utils.UnmarshalJSON(data, &integer, "", true, true); err == nil { + u.Integer = &integer + u.Type = LibrarySectionIDTypeInteger + return nil + } + + var str string = "" + if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { + u.Str = &str + u.Type = LibrarySectionIDTypeStr + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for LibrarySectionID", string(data)) +} + +func (u LibrarySectionID) MarshalJSON() ([]byte, error) { + if u.Integer != nil { + return utils.MarshalJSON(u.Integer, "", true) + } + + if u.Str != nil { + return utils.MarshalJSON(u.Str, "", true) + } + + return nil, errors.New("could not marshal union type LibrarySectionID: all fields are null") +} + type GetLibraryItemsPart struct { ID *int `json:"id,omitempty"` Key *string `json:"key,omitempty"` @@ -813,7 +887,7 @@ type GetLibraryItemsMediaContainer struct { AllowSync *bool `json:"allowSync,omitempty"` Art *string `json:"art,omitempty"` Identifier *string `json:"identifier,omitempty"` - LibrarySectionID *int `json:"librarySectionID,omitempty"` + LibrarySectionID *LibrarySectionID `json:"librarySectionID,omitempty"` LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"` MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` @@ -855,7 +929,7 @@ func (o *GetLibraryItemsMediaContainer) GetIdentifier() *string { return o.Identifier } -func (o *GetLibraryItemsMediaContainer) GetLibrarySectionID() *int { +func (o *GetLibraryItemsMediaContainer) GetLibrarySectionID() *LibrarySectionID { if o == nil { return nil } diff --git a/models/operations/getmetadatachildren.go b/models/operations/getmetadatachildren.go index 6b94c18..d0a9824 100644 --- a/models/operations/getmetadatachildren.go +++ b/models/operations/getmetadatachildren.go @@ -9,6 +9,9 @@ import ( type GetMetadataChildrenRequest struct { // the id of the library item to return the children of. RatingKey float64 `pathParam:"style=simple,explode=false,name=ratingKey"` + // Adds additional elements to the response. Supported types are (Stream) + // + IncludeElements *string `queryParam:"style=form,explode=true,name=includeElements"` } func (o *GetMetadataChildrenRequest) GetRatingKey() float64 { @@ -18,6 +21,13 @@ func (o *GetMetadataChildrenRequest) GetRatingKey() float64 { return o.RatingKey } +func (o *GetMetadataChildrenRequest) GetIncludeElements() *string { + if o == nil { + return nil + } + return o.IncludeElements +} + type GetMetadataChildrenDirectory struct { LeafCount *int `json:"leafCount,omitempty"` Thumb *string `json:"thumb,omitempty"` diff --git a/models/operations/getpin.go b/models/operations/getpin.go index 8f09f8b..b9da881 100644 --- a/models/operations/getpin.go +++ b/models/operations/getpin.go @@ -17,12 +17,12 @@ type GetPinGlobals struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` } -func (o *GetPinGlobals) GetXPlexClientIdentifier() string { +func (o *GetPinGlobals) GetXPlexClientIdentifier() *string { if o == nil { - return "" + return nil } return o.XPlexClientIdentifier } @@ -176,7 +176,7 @@ type GetPinResponseBody struct { CreatedAt *time.Time `json:"createdAt,omitempty"` ExpiresAt *time.Time `json:"expiresAt,omitempty"` AuthToken *string `json:"authToken,omitempty"` - NewRegistration *string `json:"newRegistration,omitempty"` + NewRegistration *bool `json:"newRegistration,omitempty"` } func (g GetPinResponseBody) MarshalJSON() ([]byte, error) { @@ -267,7 +267,7 @@ func (o *GetPinResponseBody) GetAuthToken() *string { return o.AuthToken } -func (o *GetPinResponseBody) GetNewRegistration() *string { +func (o *GetPinResponseBody) GetNewRegistration() *bool { if o == nil { return nil } diff --git a/models/operations/getresourcesstatistics.go b/models/operations/getresourcesstatistics.go new file mode 100644 index 0000000..1643ba9 --- /dev/null +++ b/models/operations/getresourcesstatistics.go @@ -0,0 +1,142 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +type GetResourcesStatisticsRequest struct { + // The timespan to retrieve statistics for + // the exact meaning of this parameter is not known + // + Timespan *int64 `queryParam:"style=form,explode=true,name=Timespan"` +} + +func (o *GetResourcesStatisticsRequest) GetTimespan() *int64 { + if o == nil { + return nil + } + return o.Timespan +} + +type StatisticsResources struct { + Timespan *int64 `json:"timespan,omitempty"` + At *int64 `json:"at,omitempty"` + HostCPUUtilization *float32 `json:"hostCpuUtilization,omitempty"` + ProcessCPUUtilization *float32 `json:"processCpuUtilization,omitempty"` + HostMemoryUtilization *float32 `json:"hostMemoryUtilization,omitempty"` + ProcessMemoryUtilization *float32 `json:"processMemoryUtilization,omitempty"` +} + +func (o *StatisticsResources) GetTimespan() *int64 { + if o == nil { + return nil + } + return o.Timespan +} + +func (o *StatisticsResources) GetAt() *int64 { + if o == nil { + return nil + } + return o.At +} + +func (o *StatisticsResources) GetHostCPUUtilization() *float32 { + if o == nil { + return nil + } + return o.HostCPUUtilization +} + +func (o *StatisticsResources) GetProcessCPUUtilization() *float32 { + if o == nil { + return nil + } + return o.ProcessCPUUtilization +} + +func (o *StatisticsResources) GetHostMemoryUtilization() *float32 { + if o == nil { + return nil + } + return o.HostMemoryUtilization +} + +func (o *StatisticsResources) GetProcessMemoryUtilization() *float32 { + if o == nil { + return nil + } + return o.ProcessMemoryUtilization +} + +type GetResourcesStatisticsMediaContainer struct { + Size *int `json:"size,omitempty"` + StatisticsResources []StatisticsResources `json:"StatisticsResources,omitempty"` +} + +func (o *GetResourcesStatisticsMediaContainer) GetSize() *int { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetResourcesStatisticsMediaContainer) GetStatisticsResources() []StatisticsResources { + if o == nil { + return nil + } + return o.StatisticsResources +} + +// GetResourcesStatisticsResponseBody - Resource Statistics +type GetResourcesStatisticsResponseBody struct { + MediaContainer *GetResourcesStatisticsMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetResourcesStatisticsResponseBody) GetMediaContainer() *GetResourcesStatisticsMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetResourcesStatisticsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Resource Statistics + Object *GetResourcesStatisticsResponseBody +} + +func (o *GetResourcesStatisticsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetResourcesStatisticsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetResourcesStatisticsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetResourcesStatisticsResponse) GetObject() *GetResourcesStatisticsResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getsessionhistory.go b/models/operations/getsessionhistory.go index 4e9debc..824cfd2 100644 --- a/models/operations/getsessionhistory.go +++ b/models/operations/getsessionhistory.go @@ -8,6 +8,55 @@ import ( "net/http" ) +// Filter - Filters content by field and direction/equality +// (Unknown if viewedAt is the only supported column) +type Filter struct { +} + +type GetSessionHistoryRequest struct { + // Sorts the results by the specified field followed by the direction (asc, desc) + // + Sort *string `queryParam:"style=form,explode=true,name=sort"` + // Filter results by those that are related to a specific users id + // + AccountID *int64 `queryParam:"style=form,explode=true,name=accountId"` + // Filters content by field and direction/equality + // (Unknown if viewedAt is the only supported column) + // + Filter *Filter `queryParam:"style=form,explode=true,name=filter"` + // Filters the results based on the id of a valid library section + // + LibrarySectionID *int64 `queryParam:"style=form,explode=true,name=librarySectionID"` +} + +func (o *GetSessionHistoryRequest) GetSort() *string { + if o == nil { + return nil + } + return o.Sort +} + +func (o *GetSessionHistoryRequest) GetAccountID() *int64 { + if o == nil { + return nil + } + return o.AccountID +} + +func (o *GetSessionHistoryRequest) GetFilter() *Filter { + if o == nil { + return nil + } + return o.Filter +} + +func (o *GetSessionHistoryRequest) GetLibrarySectionID() *int64 { + if o == nil { + return nil + } + return o.LibrarySectionID +} + type GetSessionHistoryMetadata struct { HistoryKey *string `json:"historyKey,omitempty"` Key *string `json:"key,omitempty"` diff --git a/models/operations/getsessions.go b/models/operations/getsessions.go index ddc184b..9365ab7 100644 --- a/models/operations/getsessions.go +++ b/models/operations/getsessions.go @@ -319,27 +319,27 @@ func (o *GetSessionsMedia) GetPart() []GetSessionsPart { return o.Part } -type User struct { +type GetSessionsUser struct { ID *string `json:"id,omitempty"` Thumb *string `json:"thumb,omitempty"` Title *string `json:"title,omitempty"` } -func (o *User) GetID() *string { +func (o *GetSessionsUser) GetID() *string { if o == nil { return nil } return o.ID } -func (o *User) GetThumb() *string { +func (o *GetSessionsUser) GetThumb() *string { if o == nil { return nil } return o.Thumb } -func (o *User) GetTitle() *string { +func (o *GetSessionsUser) GetTitle() *string { if o == nil { return nil } @@ -531,7 +531,7 @@ type GetSessionsMetadata struct { UpdatedAt *int `json:"updatedAt,omitempty"` ViewOffset *int `json:"viewOffset,omitempty"` Media []GetSessionsMedia `json:"Media,omitempty"` - User *User `json:"User,omitempty"` + User *GetSessionsUser `json:"User,omitempty"` Player *Player `json:"Player,omitempty"` Session *Session `json:"Session,omitempty"` } @@ -774,7 +774,7 @@ func (o *GetSessionsMetadata) GetMedia() []GetSessionsMedia { return o.Media } -func (o *GetSessionsMetadata) GetUser() *User { +func (o *GetSessionsMetadata) GetUser() *GetSessionsUser { if o == nil { return nil } diff --git a/models/operations/gettoken.go b/models/operations/gettoken.go index cd2c698..599a699 100644 --- a/models/operations/gettoken.go +++ b/models/operations/gettoken.go @@ -17,12 +17,12 @@ type GetTokenGlobals struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` } -func (o *GetTokenGlobals) GetXPlexClientIdentifier() string { +func (o *GetTokenGlobals) GetXPlexClientIdentifier() *string { if o == nil { - return "" + return nil } return o.XPlexClientIdentifier } diff --git a/models/operations/gettopwatchedcontent.go b/models/operations/gettopwatchedcontent.go new file mode 100644 index 0000000..7356b42 --- /dev/null +++ b/models/operations/gettopwatchedcontent.go @@ -0,0 +1,530 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "github.com/LukeHagar/plexgo/internal/utils" + "github.com/LukeHagar/plexgo/types" + "net/http" +) + +type GetTopWatchedContentRequest struct { + // the library type (1 - movies, 2 - shows, 3 - music) + Type int64 `queryParam:"style=form,explode=true,name=type"` + // Adds the Guids object to the response + // + IncludeGuids *int64 `queryParam:"style=form,explode=true,name=includeGuids"` +} + +func (o *GetTopWatchedContentRequest) GetType() int64 { + if o == nil { + return 0 + } + return o.Type +} + +func (o *GetTopWatchedContentRequest) GetIncludeGuids() *int64 { + if o == nil { + return nil + } + return o.IncludeGuids +} + +type GetTopWatchedContentGenre struct { + ID *int `json:"id,omitempty"` + Filter *string `json:"filter,omitempty"` + Tag *string `json:"tag,omitempty"` +} + +func (o *GetTopWatchedContentGenre) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetTopWatchedContentGenre) GetFilter() *string { + if o == nil { + return nil + } + return o.Filter +} + +func (o *GetTopWatchedContentGenre) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetTopWatchedContentCountry struct { + ID *int `json:"id,omitempty"` + Filter *string `json:"filter,omitempty"` + Tag *string `json:"tag,omitempty"` +} + +func (o *GetTopWatchedContentCountry) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetTopWatchedContentCountry) GetFilter() *string { + if o == nil { + return nil + } + return o.Filter +} + +func (o *GetTopWatchedContentCountry) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetTopWatchedContentGuids struct { + ID *string `json:"id,omitempty"` +} + +func (o *GetTopWatchedContentGuids) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type GetTopWatchedContentRole struct { + ID *int `json:"id,omitempty"` + Filter *string `json:"filter,omitempty"` + Tag *string `json:"tag,omitempty"` + TagKey *string `json:"tagKey,omitempty"` + Role *string `json:"role,omitempty"` + Thumb *string `json:"thumb,omitempty"` +} + +func (o *GetTopWatchedContentRole) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetTopWatchedContentRole) GetFilter() *string { + if o == nil { + return nil + } + return o.Filter +} + +func (o *GetTopWatchedContentRole) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +func (o *GetTopWatchedContentRole) GetTagKey() *string { + if o == nil { + return nil + } + return o.TagKey +} + +func (o *GetTopWatchedContentRole) GetRole() *string { + if o == nil { + return nil + } + return o.Role +} + +func (o *GetTopWatchedContentRole) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +type User struct { + ID *int `json:"id,omitempty"` +} + +func (o *User) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +type GetTopWatchedContentMetadata struct { + RatingKey *string `json:"ratingKey,omitempty"` + Key *string `json:"key,omitempty"` + GUID *string `json:"guid,omitempty"` + Slug *string `json:"slug,omitempty"` + Studio *string `json:"studio,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` + LibrarySectionID *int `json:"librarySectionID,omitempty"` + LibrarySectionKey *string `json:"librarySectionKey,omitempty"` + ContentRating *string `json:"contentRating,omitempty"` + Summary *string `json:"summary,omitempty"` + Index *int64 `json:"index,omitempty"` + AudienceRating *float64 `json:"audienceRating,omitempty"` + Year *int `json:"year,omitempty"` + Tagline *string `json:"tagline,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Art *string `json:"art,omitempty"` + Duration *int `json:"duration,omitempty"` + OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"` + LeafCount *int64 `json:"leafCount,omitempty"` + ViewedLeafCount *int64 `json:"viewedLeafCount,omitempty"` + ChildCount *int64 `json:"childCount,omitempty"` + AddedAt *int `json:"addedAt,omitempty"` + UpdatedAt *int `json:"updatedAt,omitempty"` + GlobalViewCount *int64 `json:"globalViewCount,omitempty"` + AudienceRatingImage *string `json:"audienceRatingImage,omitempty"` + Genre []GetTopWatchedContentGenre `json:"Genre,omitempty"` + Country []GetTopWatchedContentCountry `json:"Country,omitempty"` + Guids []GetTopWatchedContentGuids `json:"Guid,omitempty"` + Role []GetTopWatchedContentRole `json:"Role,omitempty"` + User []User `json:"User,omitempty"` +} + +func (g GetTopWatchedContentMetadata) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetTopWatchedContentMetadata) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetTopWatchedContentMetadata) GetRatingKey() *string { + if o == nil { + return nil + } + return o.RatingKey +} + +func (o *GetTopWatchedContentMetadata) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetTopWatchedContentMetadata) GetGUID() *string { + if o == nil { + return nil + } + return o.GUID +} + +func (o *GetTopWatchedContentMetadata) GetSlug() *string { + if o == nil { + return nil + } + return o.Slug +} + +func (o *GetTopWatchedContentMetadata) GetStudio() *string { + if o == nil { + return nil + } + return o.Studio +} + +func (o *GetTopWatchedContentMetadata) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetTopWatchedContentMetadata) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *GetTopWatchedContentMetadata) GetLibrarySectionTitle() *string { + if o == nil { + return nil + } + return o.LibrarySectionTitle +} + +func (o *GetTopWatchedContentMetadata) GetLibrarySectionID() *int { + if o == nil { + return nil + } + return o.LibrarySectionID +} + +func (o *GetTopWatchedContentMetadata) GetLibrarySectionKey() *string { + if o == nil { + return nil + } + return o.LibrarySectionKey +} + +func (o *GetTopWatchedContentMetadata) GetContentRating() *string { + if o == nil { + return nil + } + return o.ContentRating +} + +func (o *GetTopWatchedContentMetadata) GetSummary() *string { + if o == nil { + return nil + } + return o.Summary +} + +func (o *GetTopWatchedContentMetadata) GetIndex() *int64 { + if o == nil { + return nil + } + return o.Index +} + +func (o *GetTopWatchedContentMetadata) GetAudienceRating() *float64 { + if o == nil { + return nil + } + return o.AudienceRating +} + +func (o *GetTopWatchedContentMetadata) GetYear() *int { + if o == nil { + return nil + } + return o.Year +} + +func (o *GetTopWatchedContentMetadata) GetTagline() *string { + if o == nil { + return nil + } + return o.Tagline +} + +func (o *GetTopWatchedContentMetadata) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetTopWatchedContentMetadata) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetTopWatchedContentMetadata) GetDuration() *int { + if o == nil { + return nil + } + return o.Duration +} + +func (o *GetTopWatchedContentMetadata) GetOriginallyAvailableAt() *types.Date { + if o == nil { + return nil + } + return o.OriginallyAvailableAt +} + +func (o *GetTopWatchedContentMetadata) GetLeafCount() *int64 { + if o == nil { + return nil + } + return o.LeafCount +} + +func (o *GetTopWatchedContentMetadata) GetViewedLeafCount() *int64 { + if o == nil { + return nil + } + return o.ViewedLeafCount +} + +func (o *GetTopWatchedContentMetadata) GetChildCount() *int64 { + if o == nil { + return nil + } + return o.ChildCount +} + +func (o *GetTopWatchedContentMetadata) GetAddedAt() *int { + if o == nil { + return nil + } + return o.AddedAt +} + +func (o *GetTopWatchedContentMetadata) GetUpdatedAt() *int { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetTopWatchedContentMetadata) GetGlobalViewCount() *int64 { + if o == nil { + return nil + } + return o.GlobalViewCount +} + +func (o *GetTopWatchedContentMetadata) GetAudienceRatingImage() *string { + if o == nil { + return nil + } + return o.AudienceRatingImage +} + +func (o *GetTopWatchedContentMetadata) GetGenre() []GetTopWatchedContentGenre { + if o == nil { + return nil + } + return o.Genre +} + +func (o *GetTopWatchedContentMetadata) GetCountry() []GetTopWatchedContentCountry { + if o == nil { + return nil + } + return o.Country +} + +func (o *GetTopWatchedContentMetadata) GetGuids() []GetTopWatchedContentGuids { + if o == nil { + return nil + } + return o.Guids +} + +func (o *GetTopWatchedContentMetadata) GetRole() []GetTopWatchedContentRole { + if o == nil { + return nil + } + return o.Role +} + +func (o *GetTopWatchedContentMetadata) GetUser() []User { + if o == nil { + return nil + } + return o.User +} + +type GetTopWatchedContentMediaContainer struct { + Size *int `json:"size,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + Identifier *string `json:"identifier,omitempty"` + MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` + MediaTagVersion *int `json:"mediaTagVersion,omitempty"` + Metadata []GetTopWatchedContentMetadata `json:"Metadata,omitempty"` +} + +func (o *GetTopWatchedContentMediaContainer) GetSize() *int { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetTopWatchedContentMediaContainer) GetAllowSync() *bool { + if o == nil { + return nil + } + return o.AllowSync +} + +func (o *GetTopWatchedContentMediaContainer) GetIdentifier() *string { + if o == nil { + return nil + } + return o.Identifier +} + +func (o *GetTopWatchedContentMediaContainer) GetMediaTagPrefix() *string { + if o == nil { + return nil + } + return o.MediaTagPrefix +} + +func (o *GetTopWatchedContentMediaContainer) GetMediaTagVersion() *int { + if o == nil { + return nil + } + return o.MediaTagVersion +} + +func (o *GetTopWatchedContentMediaContainer) GetMetadata() []GetTopWatchedContentMetadata { + if o == nil { + return nil + } + return o.Metadata +} + +// GetTopWatchedContentResponseBody - The metadata of the library item. +type GetTopWatchedContentResponseBody struct { + MediaContainer *GetTopWatchedContentMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetTopWatchedContentResponseBody) GetMediaContainer() *GetTopWatchedContentMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetTopWatchedContentResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // The metadata of the library item. + Object *GetTopWatchedContentResponseBody +} + +func (o *GetTopWatchedContentResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetTopWatchedContentResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetTopWatchedContentResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetTopWatchedContentResponse) GetObject() *GetTopWatchedContentResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getwatchlist.go b/models/operations/getwatchlist.go index df88e3d..8a75cb2 100644 --- a/models/operations/getwatchlist.go +++ b/models/operations/getwatchlist.go @@ -14,19 +14,19 @@ var GetWatchlistServerList = []string{ "https://metadata.provider.plex.tv", } -// Filter -type Filter string +// PathParamFilter - Filter +type PathParamFilter string const ( - FilterAll Filter = "all" - FilterAvailable Filter = "available" - FilterReleased Filter = "released" + PathParamFilterAll PathParamFilter = "all" + PathParamFilterAvailable PathParamFilter = "available" + PathParamFilterReleased PathParamFilter = "released" ) -func (e Filter) ToPointer() *Filter { +func (e PathParamFilter) ToPointer() *PathParamFilter { return &e } -func (e *Filter) UnmarshalJSON(data []byte) error { +func (e *PathParamFilter) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -37,10 +37,10 @@ func (e *Filter) UnmarshalJSON(data []byte) error { case "available": fallthrough case "released": - *e = Filter(v) + *e = PathParamFilter(v) return nil default: - return fmt.Errorf("invalid value for Filter: %v", v) + return fmt.Errorf("invalid value for PathParamFilter: %v", v) } } @@ -127,7 +127,7 @@ func (e *IncludeExternalMedia) UnmarshalJSON(data []byte) error { type GetWatchlistRequest struct { // Filter - Filter Filter `pathParam:"style=simple,explode=false,name=filter"` + Filter PathParamFilter `pathParam:"style=simple,explode=false,name=filter"` // In the format "field:dir". Available fields are "watchlistedAt" (Added At), // "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating). // "dir" can be "asc" or "desc" @@ -158,9 +158,9 @@ type GetWatchlistRequest struct { XPlexContainerSize *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` } -func (o *GetWatchlistRequest) GetFilter() Filter { +func (o *GetWatchlistRequest) GetFilter() PathParamFilter { if o == nil { - return Filter("") + return PathParamFilter("") } return o.Filter } diff --git a/models/sdkerrors/getbandwidthstatistics.go b/models/sdkerrors/getbandwidthstatistics.go new file mode 100644 index 0000000..6872d86 --- /dev/null +++ b/models/sdkerrors/getbandwidthstatistics.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetBandwidthStatisticsErrors struct { + Code *float64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *float64 `json:"status,omitempty"` +} + +func (o *GetBandwidthStatisticsErrors) GetCode() *float64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetBandwidthStatisticsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetBandwidthStatisticsErrors) GetStatus() *float64 { + if o == nil { + return nil + } + return o.Status +} + +// GetBandwidthStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetBandwidthStatisticsResponseBody struct { + Errors []GetBandwidthStatisticsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetBandwidthStatisticsResponseBody{} + +func (e *GetBandwidthStatisticsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getresourcesstatistics.go b/models/sdkerrors/getresourcesstatistics.go new file mode 100644 index 0000000..503c1df --- /dev/null +++ b/models/sdkerrors/getresourcesstatistics.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetResourcesStatisticsErrors struct { + Code *float64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *float64 `json:"status,omitempty"` +} + +func (o *GetResourcesStatisticsErrors) GetCode() *float64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetResourcesStatisticsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetResourcesStatisticsErrors) GetStatus() *float64 { + if o == nil { + return nil + } + return o.Status +} + +// GetResourcesStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetResourcesStatisticsResponseBody struct { + Errors []GetResourcesStatisticsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetResourcesStatisticsResponseBody{} + +func (e *GetResourcesStatisticsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/playlists.go b/playlists.go index e5d0a66..36da59d 100644 --- a/playlists.go +++ b/playlists.go @@ -450,7 +450,7 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 204: case httpRes.StatusCode == 400: fallthrough case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: diff --git a/plexapi.go b/plexapi.go index 4ffd65e..3cbd193 100644 --- a/plexapi.go +++ b/plexapi.go @@ -163,7 +163,6 @@ func WithServerIndex(serverIndex int) SDKOption { } } -// ServerProtocol - The protocol to use when connecting to your plex server. type ServerProtocol string const ( @@ -256,7 +255,7 @@ func WithSecuritySource(security func(context.Context) (components.Security, err // WithXPlexClientIdentifier allows setting the XPlexClientIdentifier parameter for all supported operations func WithXPlexClientIdentifier(xPlexClientIdentifier string) SDKOption { return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.XPlexClientIdentifier = xPlexClientIdentifier + sdk.sdkConfiguration.Globals.XPlexClientIdentifier = &xPlexClientIdentifier } } @@ -272,9 +271,9 @@ func New(opts ...SDKOption) *PlexAPI { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.3", - SDKVersion: "0.9.0", - GenVersion: "2.342.6", - UserAgent: "speakeasy-sdk/go 0.9.0 2.342.6 0.0.3 github.com/LukeHagar/plexgo", + SDKVersion: "0.10.0", + GenVersion: "2.349.6", + UserAgent: "speakeasy-sdk/go 0.10.0 2.349.6 0.0.3 github.com/LukeHagar/plexgo", Globals: globals.Globals{}, ServerDefaults: []map[string]string{ { diff --git a/server.go b/server.go index ee4a090..5e18a03 100644 --- a/server.go +++ b/server.go @@ -26,8 +26,8 @@ func newServer(sdkConfig sdkConfiguration) *Server { } } -// GetServerCapabilities - Server Capabilities -// Server Capabilities +// GetServerCapabilities - Get Server Capabilities +// Get Server Capabilities func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServerCapabilitiesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, diff --git a/sessions.go b/sessions.go index 8f4596b..dabf1c1 100644 --- a/sessions.go +++ b/sessions.go @@ -137,7 +137,7 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp // GetSessionHistory - Get Session History // This will Retrieve a listing of all history views. -func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessionHistoryResponse, error) { +func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountID *int64, filter *operations.Filter, librarySectionID *int64) (*operations.GetSessionHistoryResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getSessionHistory", @@ -145,6 +145,13 @@ func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessio SecuritySource: s.sdkConfiguration.Security, } + request := operations.GetSessionHistoryRequest{ + Sort: sort, + AccountID: accountID, + Filter: filter, + LibrarySectionID: librarySectionID, + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/status/sessions/history/all") if err != nil { @@ -158,6 +165,10 @@ func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessio req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } diff --git a/statistics.go b/statistics.go index a5aa4ea..e430c8e 100644 --- a/statistics.go +++ b/statistics.go @@ -142,3 +142,237 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera return res, nil } + +// GetResourcesStatistics - Get Resources Statistics +// This will return the resources for the server +func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64) (*operations.GetResourcesStatisticsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getResourcesStatistics", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetResourcesStatisticsRequest{ + Timespan: timespan, + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/statistics/resources") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetResourcesStatisticsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetResourcesStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out sdkerrors.GetResourcesStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + default: + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetBandwidthStatistics - Get Bandwidth Statistics +// This will return the bandwidth statistics for the server +func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64) (*operations.GetBandwidthStatisticsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getBandwidthStatistics", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetBandwidthStatisticsRequest{ + Timespan: timespan, + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/statistics/bandwidth") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetBandwidthStatisticsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetBandwidthStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out sdkerrors.GetBandwidthStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + default: + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +}