Compare commits

...

3 Commits

Author SHA1 Message Date
speakeasybot
d2a1c188d5 ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.487.0 2025-02-07 00:10:35 +00:00
speakeasybot
6db5d8fb30 ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.484.1 2025-02-06 00:10:27 +00:00
speakeasybot
89fbd6238e ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.476.2 2025-01-28 00:10:16 +00:00
78 changed files with 3235 additions and 134 deletions

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
go:
version: 0.17.2
version: 0.18.0
additionalDependencies: {}
allowUnknownFieldsInWeakUnions: false
clientServerStatusCodesAsErrors: true

View File

@@ -1,4 +1,4 @@
speakeasyVersion: 1.476.0
speakeasyVersion: 1.487.0
sources:
my-source:
sourceNamespace: my-source
@@ -9,19 +9,19 @@ sources:
- main
plexapi:
sourceNamespace: plexapi
sourceRevisionDigest: sha256:b146684d2d813daa8ba29e432a12334838753d0b20183beca8178a74ec4d895a
sourceBlobDigest: sha256:58f51c4319fcda931d63950fd926e8650e20a2e1375e356bf3a930111e246a58
sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae
sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9
tags:
- latest
- speakeasy-sdk-regen-1737763744
- speakeasy-sdk-regen-1738886963
targets:
plexgo:
source: plexapi
sourceNamespace: plexapi
sourceRevisionDigest: sha256:b146684d2d813daa8ba29e432a12334838753d0b20183beca8178a74ec4d895a
sourceBlobDigest: sha256:58f51c4319fcda931d63950fd926e8650e20a2e1375e356bf3a930111e246a58
sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae
sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9
codeSamplesNamespace: code-samples-go-plexgo
codeSamplesRevisionDigest: sha256:a9b4a5597cc8dc7e97e7ce3e68de850538878f6a879c0b400ae0d4757f7f8743
codeSamplesRevisionDigest: sha256:e556c9b714f159036257d9405e7e72e55f72c2ad96b306a7ccaa287d4d33829c
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest

View File

@@ -144,6 +144,8 @@ func main() {
* [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
* [GetRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [GetSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library
* [GetGenresLibrary](docs/sdks/library/README.md#getgenreslibrary) - Get Genres of library media
* [GetCountriesLibrary](docs/sdks/library/README.md#getcountrieslibrary) - Get Countries of library media
* [GetSearchAllLibraries](docs/sdks/library/README.md#getsearchalllibraries) - Search All Libraries
* [GetMetaDataByRatingKey](docs/sdks/library/README.md#getmetadatabyratingkey) - Get Metadata by RatingKey
* [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
@@ -224,6 +226,10 @@ func main() {
* [CheckForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
* [ApplyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates
### [Users](docs/sdks/users/README.md)
* [GetUsers](docs/sdks/users/README.md#getusers) - Get list of all connected users
### [Video](docs/sdks/video/README.md)
* [GetTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item

View File

@@ -1003,3 +1003,33 @@ Based on:
- [go v0.17.2] .
### Releases
- [Go v0.17.2] https://github.com/LukeHagar/plexgo/releases/tag/v0.17.2 - .
## 2025-01-28 00:08:53
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.476.2 (2.495.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.17.3] .
### Releases
- [Go v0.17.3] https://github.com/LukeHagar/plexgo/releases/tag/v0.17.3 - .
## 2025-02-06 00:09:00
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.484.1 (2.503.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.17.4] .
### Releases
- [Go v0.17.4] https://github.com/LukeHagar/plexgo/releases/tag/v0.17.4 - .
## 2025-02-07 00:09:08
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.487.0 (2.506.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.18.0] .
### Releases
- [Go v0.18.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.18.0 - .

View File

@@ -128,19 +128,19 @@ actions:
x-codeSamples:
- lang: go
label: added
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{\n ContentDirectoryID: 470161,\n SectionID: plexgo.Int64(2),\n Type: operations.TypeTvShow,\n IncludeMeta: operations.IncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{\n ContentDirectoryID: 470161,\n SectionID: plexgo.Int64(2),\n Type: operations.TypeTvShow,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/hubs/search"]["get"]
update:
x-codeSamples:
- lang: go
label: performSearch
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Search.PerformSearch(ctx, \"dylan\", nil, plexgo.Float64(5))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Search.PerformSearch(ctx, \"dylan\", nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/hubs/search/voice"]["get"]
update:
x-codeSamples:
- lang: go
label: performVoiceSearch
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Search.PerformVoiceSearch(ctx, \"dead+poop\", nil, plexgo.Float64(5))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Search.PerformVoiceSearch(ctx, \"dead+poop\", nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}"
- target: $["paths"]["/hubs/sections/{sectionId}"]["get"]
update:
x-codeSamples:
@@ -200,13 +200,13 @@ actions:
x-codeSamples:
- lang: go
label: library
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{\n ContentDirectoryID: plexgo.Int64(2),\n PinnedContentDirectoryID: []int64{\n 3,\n 5,\n 7,\n 13,\n 12,\n 1,\n 6,\n 14,\n 2,\n 10,\n 16,\n 17,\n },\n SectionID: plexgo.Int64(2),\n Type: operations.QueryParamTypeTvShow,\n IncludeMeta: operations.QueryParamIncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{\n ContentDirectoryID: plexgo.Int64(2),\n PinnedContentDirectoryID: []int64{\n 3,\n 5,\n 7,\n 13,\n 12,\n 1,\n 6,\n 14,\n 2,\n 10,\n 16,\n 17,\n },\n SectionID: plexgo.Int64(2),\n Type: operations.QueryParamTypeTvShow,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/search"]["get"]
update:
x-codeSamples:
- lang: go
label: libraries
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"<value>\",\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n SearchTypes: []operations.SearchTypes{\n operations.SearchTypesPeople,\n },\n IncludeCollections: operations.QueryParamIncludeCollectionsEnable.ToPointer(),\n IncludeExternalMedia: operations.QueryParamIncludeExternalMediaEnable.ToPointer(),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"<value>\",\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n SearchTypes: []operations.SearchTypes{\n operations.SearchTypesPeople,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/sections"]["get"]
update:
x-codeSamples:
@@ -218,7 +218,7 @@ actions:
x-codeSamples:
- lang: go
label: list
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{\n Filter: operations.FilterAvailable,\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{\n Filter: operations.FilterAvailable,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/sections/{sectionKey}"]["delete"]
update:
x-codeSamples:
@@ -230,7 +230,19 @@ actions:
x-codeSamples:
- lang: go
label: details
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetLibraryDetails(ctx, 9518, operations.IncludeDetailsZero.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetLibraryDetails(ctx, 9518, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/sections/{sectionKey}/country"]["get"]
update:
x-codeSamples:
- lang: go
label: library
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetCountriesLibrary(ctx, 9518)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/sections/{sectionKey}/genre"]["get"]
update:
x-codeSamples:
- lang: go
label: library
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetGenresLibrary(ctx, 9518)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/library/sections/{sectionKey}/refresh"]["get"]
update:
x-codeSamples:
@@ -248,7 +260,7 @@ actions:
x-codeSamples:
- lang: go
label: items
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{\n Tag: operations.TagEdition,\n IncludeGuids: operations.IncludeGuidsEnable.ToPointer(),\n Type: operations.GetLibraryItemsQueryParamTypeTvShow.ToPointer(),\n SectionKey: 9518,\n IncludeMeta: operations.GetLibraryItemsQueryParamIncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{\n Tag: operations.TagEdition,\n Type: operations.GetLibraryItemsQueryParamTypeTvShow.ToPointer(),\n SectionKey: 9518,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/log"]["get"]
update:
x-codeSamples:
@@ -290,7 +302,7 @@ actions:
x-codeSamples:
- lang: go
label: getPin
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{\n Strong: plexgo.Bool(false),\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}"
- target: $["paths"]["/pins/{pinID}"]["get"]
update:
x-codeSamples:
@@ -356,7 +368,7 @@ actions:
x-codeSamples:
- lang: go
label: resources
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Plex.GetServerResources(ctx, \"3381b62b-9ab7-4e37-827b-203e9809eb58\", operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res.PlexDevices != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Plex.GetServerResources(ctx, \"3381b62b-9ab7-4e37-827b-203e9809eb58\", nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.PlexDevices != nil {\n // handle response\n }\n}"
- target: $["paths"]["/search"]["get"]
update:
x-codeSamples:
@@ -447,12 +459,18 @@ actions:
- lang: go
label: getTokenDetails
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n )\n\n res, err := s.Authentication.GetTokenDetails(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}"
- target: $["paths"]["/users"]["get"]
update:
x-codeSamples:
- lang: go
label: users
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Users.GetUsers(ctx, operations.GetUsersRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n DeviceName: plexgo.String(\"Chrome\"),\n DeviceScreenResolution: plexgo.String(\"1487x1165,2560x1440\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n ClientFeatures: plexgo.String(\"external-media,indirect-media,hub-style-list\"),\n Model: plexgo.String(\"4200X\"),\n XPlexSessionID: plexgo.String(\"97e136ef-4ddd-4ff3-89a7-a5820c96c2ca\"),\n XPlexLanguage: plexgo.String(\"en\"),\n PlatformVersion: plexgo.String(\"4.3 build 1057\"),\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Body != nil {\n // handle response\n }\n}"
- target: $["paths"]["/users/signin"]["post"]
update:
x-codeSamples:
- lang: go
label: data
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n RequestBody: &operations.PostUsersSignInDataRequestBody{\n Login: \"username@email.com\",\n Password: \"password123\",\n RememberMe: plexgo.Bool(false),\n VerificationCode: plexgo.String(\"123456\"),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n RequestBody: &operations.PostUsersSignInDataRequestBody{\n Login: \"username@email.com\",\n Password: \"password123\",\n VerificationCode: plexgo.String(\"123456\"),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}"
- target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"]
update:
x-codeSamples:

View File

@@ -0,0 +1,11 @@
# AllLibraries
Indicates if the user has access to all libraries.
## Values
| Name | Value |
| --------------------- | --------------------- |
| `AllLibrariesDisable` | 0 |
| `AllLibrariesEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowCameraUpload
Indicates if the user is allowed to upload from a camera.
## Values
| Name | Value |
| -------------------------- | -------------------------- |
| `AllowCameraUploadDisable` | 0 |
| `AllowCameraUploadEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowChannels
Indicates if the user has access to channels.
## Values
| Name | Value |
| ---------------------- | ---------------------- |
| `AllowChannelsDisable` | 0 |
| `AllowChannelsEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowSubtitleAdmin
Indicates if the user can manage subtitles.
## Values
| Name | Value |
| --------------------------- | --------------------------- |
| `AllowSubtitleAdminDisable` | 0 |
| `AllowSubtitleAdminEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowSync
Indicates if the user is allowed to sync media.
## Values
| Name | Value |
| ------------------ | ------------------ |
| `AllowSyncDisable` | 0 |
| `AllowSyncEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowTuners
Indicates if the user is allowed to use tuners.
## Values
| Name | Value |
| -------------------- | -------------------- |
| `AllowTunersDisable` | 0 |
| `AllowTunersEnable` | 1 |

View File

@@ -0,0 +1,10 @@
# GetCountriesLibraryDirectory
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
| `FastKey` | *string* | :heavy_check_mark: | N/A | /library/sections/2/all?country=15491 |
| `Key` | *string* | :heavy_check_mark: | N/A | 15491 |
| `Title` | *string* | :heavy_check_mark: | N/A | Japan |

View File

@@ -0,0 +1,22 @@
# GetCountriesLibraryMediaContainer
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `Size` | *float64* | :heavy_check_mark: | N/A | 50 |
| `Offset` | **int* | :heavy_minus_sign: | N/A | |
| `TotalSize` | **int* | :heavy_minus_sign: | N/A | |
| `Identifier` | *string* | :heavy_check_mark: | N/A | com.plexapp.plugins.library |
| `AllowSync` | *bool* | :heavy_check_mark: | N/A | false |
| `Art` | *string* | :heavy_check_mark: | N/A | /:/resources/show-fanart.jpg |
| `Content` | *string* | :heavy_check_mark: | N/A | secondary |
| `MediaTagPrefix` | *string* | :heavy_check_mark: | N/A | /system/bundle/media/flags/ |
| `MediaTagVersion` | *int64* | :heavy_check_mark: | N/A | 1734362201 |
| `Nocache` | *bool* | :heavy_check_mark: | N/A | true |
| `Thumb` | *string* | :heavy_check_mark: | N/A | /:/resources/show.png |
| `Title1` | *string* | :heavy_check_mark: | N/A | TV Series |
| `Title2` | *string* | :heavy_check_mark: | N/A | By Country |
| `ViewGroup` | *string* | :heavy_check_mark: | N/A | secondary |
| `Directory` | [][operations.GetCountriesLibraryDirectory](../../models/operations/getcountrieslibrarydirectory.md) | :heavy_minus_sign: | N/A | |

View File

@@ -0,0 +1,8 @@
# GetCountriesLibraryRequest
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |

View File

@@ -0,0 +1,11 @@
# GetCountriesLibraryResponse
## 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.GetCountriesLibraryResponseBody](../../models/operations/getcountrieslibraryresponsebody.md) | :heavy_minus_sign: | Successful response containing media container data. |

View File

@@ -0,0 +1,10 @@
# GetCountriesLibraryResponseBody
Successful response containing media container data.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `MediaContainer` | [*operations.GetCountriesLibraryMediaContainer](../../models/operations/getcountrieslibrarymediacontainer.md) | :heavy_minus_sign: | N/A |

View File

@@ -0,0 +1,11 @@
# GetGenresLibraryDirectory
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `FastKey` | *string* | :heavy_check_mark: | N/A | /library/sections/10/all?genre=89 |
| `Key` | *string* | :heavy_check_mark: | N/A | 89 |
| `Title` | *string* | :heavy_check_mark: | N/A | Action |
| `Type` | *string* | :heavy_check_mark: | N/A | genre |

View File

@@ -0,0 +1,22 @@
# GetGenresLibraryMediaContainer
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `Size` | *float64* | :heavy_check_mark: | N/A | 50 |
| `Offset` | **int* | :heavy_minus_sign: | N/A | |
| `TotalSize` | **int* | :heavy_minus_sign: | N/A | |
| `Identifier` | *string* | :heavy_check_mark: | N/A | com.plexapp.plugins.library |
| `AllowSync` | *bool* | :heavy_check_mark: | N/A | false |
| `Art` | *string* | :heavy_check_mark: | N/A | /:/resources/show-fanart.jpg |
| `Content` | *string* | :heavy_check_mark: | N/A | secondary |
| `MediaTagPrefix` | *string* | :heavy_check_mark: | N/A | /system/bundle/media/flags/ |
| `MediaTagVersion` | *int64* | :heavy_check_mark: | N/A | 1734362201 |
| `Nocache` | *bool* | :heavy_check_mark: | N/A | true |
| `Thumb` | *string* | :heavy_check_mark: | N/A | /:/resources/show.png |
| `Title1` | *string* | :heavy_check_mark: | N/A | TV Shows (Reality) |
| `Title2` | *string* | :heavy_check_mark: | N/A | By Genre |
| `ViewGroup` | *string* | :heavy_check_mark: | N/A | secondary |
| `Directory` | [][operations.GetGenresLibraryDirectory](../../models/operations/getgenreslibrarydirectory.md) | :heavy_minus_sign: | N/A | |

View File

@@ -0,0 +1,8 @@
# GetGenresLibraryRequest
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |

View File

@@ -0,0 +1,11 @@
# GetGenresLibraryResponse
## 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.GetGenresLibraryResponseBody](../../models/operations/getgenreslibraryresponsebody.md) | :heavy_minus_sign: | Successful response containing media container data. |

View File

@@ -0,0 +1,10 @@
# GetGenresLibraryResponseBody
Successful response containing media container data.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `MediaContainer` | [*operations.GetGenresLibraryMediaContainer](../../models/operations/getgenreslibrarymediacontainer.md) | :heavy_minus_sign: | N/A |

View File

@@ -26,7 +26,7 @@
| `FlattenSeasons` | [*operations.GetLibraryItemsFlattenSeasons](../../models/operations/getlibraryitemsflattenseasons.md) | :heavy_minus_sign: | Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show). | 1 |
| `EpisodeSort` | [*operations.GetLibraryItemsEpisodeSort](../../models/operations/getlibraryitemsepisodesort.md) | :heavy_minus_sign: | Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first). | 0 |
| `EnableCreditsMarkerGeneration` | [*operations.GetLibraryItemsEnableCreditsMarkerGeneration](../../models/operations/getlibraryitemsenablecreditsmarkergeneration.md) | :heavy_minus_sign: | Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled). | -1 |
| `ShowOrdering` | [*operations.GetLibraryItemsShowOrdering](../../models/operations/getlibraryitemsshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `ShowOrdering` | [*operations.GetLibraryItemsShowOrdering](../../models/operations/getlibraryitemsshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show.<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>aired = TheTVDB (Aired),<br/>dvd = TheTVDB (DVD),<br/>absolute = TheTVDB (Absolute)).<br/> | absolute |
| `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -1,11 +1,11 @@
# GetLibraryItemsShowOrdering
Setting that indicates the episode ordering for the show
Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
@@ -15,6 +15,6 @@ tvdbAbsolute = TheTVDB (Absolute)).
| ----------------------------------------- | ----------------------------------------- |
| `GetLibraryItemsShowOrderingNone` | None |
| `GetLibraryItemsShowOrderingTmdbAiring` | tmdbAiring |
| `GetLibraryItemsShowOrderingTvdbAiring` | tvdbAiring |
| `GetLibraryItemsShowOrderingTvdbDvd` | tvdbDvd |
| `GetLibraryItemsShowOrderingTvdbAbsolute` | tvdbAbsolute |
| `GetLibraryItemsShowOrderingTvdbAired` | aired |
| `GetLibraryItemsShowOrderingTvdbDvd` | dvd |
| `GetLibraryItemsShowOrderingTvdbAbsolute` | absolute |

View File

@@ -9,6 +9,6 @@
| `Offset` | **int* | :heavy_minus_sign: | N/A | |
| `TotalSize` | **int* | :heavy_minus_sign: | N/A | |
| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library |
| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | |
| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false |
| `Meta` | [*operations.Meta](../../models/operations/meta.md) | :heavy_minus_sign: | The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.<br/> | |
| `Metadata` | [][operations.GetRecentlyAddedMetadata](../../models/operations/getrecentlyaddedmetadata.md) | :heavy_minus_sign: | N/A | |

View File

@@ -26,7 +26,7 @@
| `FlattenSeasons` | [*operations.FlattenSeasons](../../models/operations/flattenseasons.md) | :heavy_minus_sign: | Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show). | 1 |
| `EpisodeSort` | [*operations.EpisodeSort](../../models/operations/episodesort.md) | :heavy_minus_sign: | Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first). | 0 |
| `EnableCreditsMarkerGeneration` | [*operations.EnableCreditsMarkerGeneration](../../models/operations/enablecreditsmarkergeneration.md) | :heavy_minus_sign: | Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled). | -1 |
| `ShowOrdering` | [*operations.ShowOrdering](../../models/operations/showordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `ShowOrdering` | [*operations.ShowOrdering](../../models/operations/showordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show.<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>aired = TheTVDB (Aired),<br/>dvd = TheTVDB (DVD),<br/>absolute = TheTVDB (Absolute)).<br/> | absolute |
| `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -26,7 +26,7 @@
| `FlattenSeasons` | [*operations.GetSearchAllLibrariesFlattenSeasons](../../models/operations/getsearchalllibrariesflattenseasons.md) | :heavy_minus_sign: | Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show). | 1 |
| `EpisodeSort` | [*operations.GetSearchAllLibrariesEpisodeSort](../../models/operations/getsearchalllibrariesepisodesort.md) | :heavy_minus_sign: | Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first). | 0 |
| `EnableCreditsMarkerGeneration` | [*operations.GetSearchAllLibrariesEnableCreditsMarkerGeneration](../../models/operations/getsearchalllibrariesenablecreditsmarkergeneration.md) | :heavy_minus_sign: | Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled). | -1 |
| `ShowOrdering` | [*operations.GetSearchAllLibrariesShowOrdering](../../models/operations/getsearchalllibrariesshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `ShowOrdering` | [*operations.GetSearchAllLibrariesShowOrdering](../../models/operations/getsearchalllibrariesshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show.<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>aired = TheTVDB (Aired),<br/>dvd = TheTVDB (DVD),<br/>absolute = TheTVDB (Absolute)).<br/> | absolute |
| `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -1,11 +1,11 @@
# GetSearchAllLibrariesShowOrdering
Setting that indicates the episode ordering for the show
Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
@@ -15,6 +15,6 @@ tvdbAbsolute = TheTVDB (Absolute)).
| ----------------------------------------------- | ----------------------------------------------- |
| `GetSearchAllLibrariesShowOrderingNone` | None |
| `GetSearchAllLibrariesShowOrderingTmdbAiring` | tmdbAiring |
| `GetSearchAllLibrariesShowOrderingTvdbAiring` | tvdbAiring |
| `GetSearchAllLibrariesShowOrderingTvdbDvd` | tvdbDvd |
| `GetSearchAllLibrariesShowOrderingTvdbAbsolute` | tvdbAbsolute |
| `GetSearchAllLibrariesShowOrderingTvdbAired` | aired |
| `GetSearchAllLibrariesShowOrderingTvdbDvd` | dvd |
| `GetSearchAllLibrariesShowOrderingTvdbAbsolute` | absolute |

View File

@@ -36,4 +36,4 @@
| `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 | |
| `User` | [][operations.GetTopWatchedContentUser](../../models/operations/gettopwatchedcontentuser.md) | :heavy_minus_sign: | N/A | |

View File

@@ -0,0 +1,8 @@
# GetTopWatchedContentUser
## Fields
| Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| `ID` | **int* | :heavy_minus_sign: | N/A | 220 |

View File

@@ -0,0 +1,15 @@
# GetUsersMediaContainer
Container holding user and server details.
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
| `FriendlyName` | *string* | :heavy_check_mark: | The friendly name of the Plex instance. | myPlex |
| `Identifier` | *string* | :heavy_check_mark: | N/A | com.plexapp.plugins.myplex |
| `MachineIdentifier` | *string* | :heavy_check_mark: | Unique Machine identifier of the Plex server. | 3dff4c4da3b1229a649aa574a9e2b419a684a20e |
| `TotalSize` | *int64* | :heavy_check_mark: | Total number of users. | 30 |
| `Size` | *int64* | :heavy_check_mark: | Number of users in the current response. | 30 |
| `User` | [][operations.User](../../models/operations/user.md) | :heavy_check_mark: | List of users with access to the Plex server. | |

View File

@@ -0,0 +1,20 @@
# GetUsersRequest
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku |
| `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 |
| `DeviceName` | **string* | :heavy_minus_sign: | The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) | Chrome |
| `DeviceScreenResolution` | **string* | :heavy_minus_sign: | The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) | 1487x1165,2560x1440 |
| `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 |
| `Platform` | **string* | :heavy_minus_sign: | The platform of the client application. | Roku |
| `ClientFeatures` | **string* | :heavy_minus_sign: | The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) | external-media,indirect-media,hub-style-list |
| `Model` | **string* | :heavy_minus_sign: | A potentially less friendly identifier for the device model | 4200X |
| `XPlexSessionID` | **string* | :heavy_minus_sign: | The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) | 97e136ef-4ddd-4ff3-89a7-a5820c96c2ca |
| `XPlexLanguage` | **string* | :heavy_minus_sign: | The language of the client application. | en |
| `PlatformVersion` | **string* | :heavy_minus_sign: | The version of the platform | 4.3 build 1057 |
| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf |

View File

@@ -0,0 +1,11 @@
# GetUsersResponse
## 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 |
| `Body` | *[]byte* | :heavy_minus_sign: | N/A |

View File

@@ -0,0 +1,10 @@
# GetUsersResponseBody
Successful response with media container data in XML
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `MediaContainer` | [*operations.GetUsersMediaContainer](../../models/operations/getusersmediacontainer.md) | :heavy_minus_sign: | Container holding user and server details. |

View File

@@ -0,0 +1,16 @@
# GetUsersServer
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `ID` | *int64* | :heavy_check_mark: | Unique ID of the server of the connected user | 907759180 |
| `ServerID` | *int64* | :heavy_check_mark: | ID of the actual Plex server. | 9999999 |
| `MachineIdentifier` | *string* | :heavy_check_mark: | Machine identifier of the Plex server. | fbb8aa6be6e0c997c6268bc2b4431c8807f70a3 |
| `Name` | *string* | :heavy_check_mark: | Name of the Plex server of the connected user. | ConnectedUserFlix |
| `LastSeenAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 |
| `NumLibraries` | *int64* | :heavy_check_mark: | Number of libraries in the server this user has access to. | 16 |
| `AllLibraries` | [*operations.AllLibraries](../../models/operations/alllibraries.md) | :heavy_minus_sign: | N/A | 1 |
| `Owned` | [*operations.Owned](../../models/operations/owned.md) | :heavy_minus_sign: | N/A | 1 |
| `Pending` | [*operations.Pending](../../models/operations/pending.md) | :heavy_minus_sign: | N/A | 1 |

View File

@@ -0,0 +1,11 @@
# Home
Indicates if the user is part of a home group.
## Values
| Name | Value |
| ------------- | ------------- |
| `HomeDisable` | 0 |
| `HomeEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# Owned
Indicates if the user owns the server.
## Values
| Name | Value |
| -------------- | -------------- |
| `OwnedDisable` | 0 |
| `OwnedEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# Pending
Indicates if the server is pending approval.
## Values
| Name | Value |
| ---------------- | ---------------- |
| `PendingDisable` | 0 |
| `PendingEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# Protected
Indicates whether the account is protected.
## Values
| Name | Value |
| ------------------ | ------------------ |
| `ProtectedDisable` | 0 |
| `ProtectedEnable` | 1 |

View File

@@ -0,0 +1,11 @@
# Restricted
Indicates if the user has restricted access.
## Values
| Name | Value |
| ------------------- | ------------------- |
| `RestrictedDisable` | 0 |
| `RestrictedEnable` | 1 |

View File

@@ -1,11 +1,11 @@
# ShowOrdering
Setting that indicates the episode ordering for the show
Setting that indicates the episode ordering for the show.
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
@@ -15,6 +15,6 @@ tvdbAbsolute = TheTVDB (Absolute)).
| -------------------------- | -------------------------- |
| `ShowOrderingNone` | None |
| `ShowOrderingTmdbAiring` | tmdbAiring |
| `ShowOrderingTvdbAiring` | tvdbAiring |
| `ShowOrderingTvdbDvd` | tvdbDvd |
| `ShowOrderingTvdbAbsolute` | tvdbAbsolute |
| `ShowOrderingTvdbAired` | aired |
| `ShowOrderingTvdbDvd` | dvd |
| `ShowOrderingTvdbAbsolute` | absolute |

View File

@@ -4,5 +4,24 @@
## Fields
| Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| `ID` | **int* | :heavy_minus_sign: | N/A | 220 |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `ID` | *int64* | :heavy_check_mark: | User's unique ID. | 22526914 |
| `Title` | *string* | :heavy_check_mark: | User's display name. | Plex User |
| `Username` | *string* | :heavy_check_mark: | User's username. | zgfuc7krcqfimrmb9lsl5j |
| `Email` | *string* | :heavy_check_mark: | User's email address. | zgfuc7krcqfimrmb9lsl5j@protonmail.com |
| `RecommendationsPlaylistID` | **string* | :heavy_minus_sign: | ID of the user's recommendation playlist. | |
| `Thumb` | *string* | :heavy_check_mark: | URL to the user's avatar image. | https://plex.tv/users/3346028014e93acd/avatar?c=1731605021 |
| `Protected` | [*operations.Protected](../../models/operations/protected.md) | :heavy_minus_sign: | N/A | 1 |
| `Home` | [*operations.Home](../../models/operations/home.md) | :heavy_minus_sign: | N/A | 1 |
| `AllowTuners` | [*operations.AllowTuners](../../models/operations/allowtuners.md) | :heavy_minus_sign: | N/A | 1 |
| `AllowSync` | [*operations.AllowSync](../../models/operations/allowsync.md) | :heavy_minus_sign: | N/A | 1 |
| `AllowCameraUpload` | [*operations.AllowCameraUpload](../../models/operations/allowcameraupload.md) | :heavy_minus_sign: | N/A | 1 |
| `AllowChannels` | [*operations.AllowChannels](../../models/operations/allowchannels.md) | :heavy_minus_sign: | N/A | 1 |
| `AllowSubtitleAdmin` | [*operations.AllowSubtitleAdmin](../../models/operations/allowsubtitleadmin.md) | :heavy_minus_sign: | N/A | 1 |
| `FilterAll` | **string* | :heavy_minus_sign: | Filters applied for all content. | |
| `FilterMovies` | **string* | :heavy_minus_sign: | Filters applied for movies. | |
| `FilterMusic` | **string* | :heavy_minus_sign: | Filters applied for music. | |
| `FilterPhotos` | **string* | :heavy_minus_sign: | Filters applied for photos. | |
| `FilterTelevision` | **string* | :heavy_minus_sign: | Filters applied for television. | |
| `Restricted` | [*operations.Restricted](../../models/operations/restricted.md) | :heavy_minus_sign: | N/A | 1 |
| `Server` | [][operations.GetUsersServer](../../models/operations/getusersserver.md) | :heavy_check_mark: | List of servers owned by the user. | |

View File

@@ -0,0 +1,11 @@
# GetCountriesLibraryBadRequest
Bad Request - A parameter was not specified, or was specified incorrectly.
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetCountriesLibraryErrors](../../models/sdkerrors/getcountrieslibraryerrors.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 |

View File

@@ -0,0 +1,10 @@
# GetCountriesLibraryErrors
## Fields
| Field | Type | Required | Description | Example |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1000 |
| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
| `Status` | **int* | :heavy_minus_sign: | N/A | 400 |

View File

@@ -0,0 +1,10 @@
# GetCountriesLibraryLibraryErrors
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1001 |
| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated |
| `Status` | **int* | :heavy_minus_sign: | N/A | 401 |

View File

@@ -0,0 +1,11 @@
# GetCountriesLibraryUnauthorized
Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetCountriesLibraryLibraryErrors](../../models/sdkerrors/getcountrieslibrarylibraryerrors.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 |

View File

@@ -0,0 +1,11 @@
# GetGenresLibraryBadRequest
Bad Request - A parameter was not specified, or was specified incorrectly.
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetGenresLibraryErrors](../../models/sdkerrors/getgenreslibraryerrors.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 |

View File

@@ -0,0 +1,10 @@
# GetGenresLibraryErrors
## Fields
| Field | Type | Required | Description | Example |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1000 |
| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
| `Status` | **int* | :heavy_minus_sign: | N/A | 400 |

View File

@@ -0,0 +1,10 @@
# GetGenresLibraryLibraryErrors
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1001 |
| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated |
| `Status` | **int* | :heavy_minus_sign: | N/A | 401 |

View File

@@ -0,0 +1,11 @@
# GetGenresLibraryUnauthorized
Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetGenresLibraryLibraryErrors](../../models/sdkerrors/getgenreslibrarylibraryerrors.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 |

View File

@@ -0,0 +1,11 @@
# GetUsersBadRequest
Bad Request - A parameter was not specified, or was specified incorrectly.
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetUsersErrors](../../models/sdkerrors/getuserserrors.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 |

View File

@@ -0,0 +1,10 @@
# GetUsersErrors
## Fields
| Field | Type | Required | Description | Example |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1000 |
| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
| `Status` | **int* | :heavy_minus_sign: | N/A | 400 |

View File

@@ -0,0 +1,11 @@
# GetUsersUnauthorized
Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `Errors` | [][sdkerrors.GetUsersUsersErrors](../../models/sdkerrors/getusersuserserrors.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 |

View File

@@ -0,0 +1,10 @@
# GetUsersUsersErrors
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `Code` | **int* | :heavy_minus_sign: | N/A | 1001 |
| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated |
| `Status` | **int* | :heavy_minus_sign: | N/A | 401 |

View File

@@ -203,7 +203,6 @@ func main() {
RequestBody: &operations.PostUsersSignInDataRequestBody{
Login: "username@email.com",
Password: "password123",
RememberMe: plexgo.Bool(false),
VerificationCode: plexgo.String("123456"),
},
})

View File

@@ -93,9 +93,6 @@ func main() {
ContentDirectoryID: 470161,
SectionID: plexgo.Int64(2),
Type: operations.TypeTvShow,
IncludeMeta: operations.IncludeMetaEnable.ToPointer(),
XPlexContainerStart: plexgo.Int(0),
XPlexContainerSize: plexgo.Int(50),
})
if err != nil {
log.Fatal(err)

View File

@@ -16,6 +16,8 @@ API Calls interacting with Plex Media Server Libraries
* [GetLibraryItems](#getlibraryitems) - Get Library Items
* [GetRefreshLibraryMetadata](#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [GetSearchLibrary](#getsearchlibrary) - Search Library
* [GetGenresLibrary](#getgenreslibrary) - Get Genres of library media
* [GetCountriesLibrary](#getcountrieslibrary) - Get Countries of library media
* [GetSearchAllLibraries](#getsearchalllibraries) - Search All Libraries
* [GetMetaDataByRatingKey](#getmetadatabyratingkey) - Get Metadata by RatingKey
* [GetMetadataChildren](#getmetadatachildren) - Get Items Children
@@ -117,9 +119,6 @@ func main() {
},
SectionID: plexgo.Int64(2),
Type: operations.QueryParamTypeTvShow,
IncludeMeta: operations.QueryParamIncludeMetaEnable.ToPointer(),
XPlexContainerStart: plexgo.Int(0),
XPlexContainerSize: plexgo.Int(50),
})
if err != nil {
log.Fatal(err)
@@ -258,7 +257,6 @@ package main
import(
"context"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
@@ -269,7 +267,7 @@ func main() {
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Library.GetLibraryDetails(ctx, 9518, operations.IncludeDetailsZero.ToPointer())
res, err := s.Library.GetLibraryDetails(ctx, 9518, nil)
if err != nil {
log.Fatal(err)
}
@@ -398,12 +396,8 @@ func main() {
res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{
Tag: operations.TagEdition,
IncludeGuids: operations.IncludeGuidsEnable.ToPointer(),
Type: operations.GetLibraryItemsQueryParamTypeTvShow.ToPointer(),
SectionKey: 9518,
IncludeMeta: operations.GetLibraryItemsQueryParamIncludeMetaEnable.ToPointer(),
XPlexContainerStart: plexgo.Int(0),
XPlexContainerSize: plexgo.Int(50),
})
if err != nil {
log.Fatal(err)
@@ -561,6 +555,112 @@ func main() {
| sdkerrors.GetSearchLibraryUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
## GetGenresLibrary
Retrieves a list of all the genres that are found for the media in this library.
### Example Usage
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Library.GetGenresLibrary(ctx, 9518)
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. | |
| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | |
### Response
**[*operations.GetGenresLibraryResponse](../../models/operations/getgenreslibraryresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| sdkerrors.GetGenresLibraryBadRequest | 400 | application/json |
| sdkerrors.GetGenresLibraryUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
## GetCountriesLibrary
Retrieves a list of all the countries that are found for the media in this library.
### Example Usage
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Library.GetCountriesLibrary(ctx, 9518)
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. | |
| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | |
### Response
**[*operations.GetCountriesLibraryResponse](../../models/operations/getcountrieslibraryresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| sdkerrors.GetCountriesLibraryBadRequest | 400 | application/json |
| sdkerrors.GetCountriesLibraryUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
## GetSearchAllLibraries
Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
@@ -591,8 +691,6 @@ func main() {
SearchTypes: []operations.SearchTypes{
operations.SearchTypesPeople,
},
IncludeCollections: operations.QueryParamIncludeCollectionsEnable.ToPointer(),
IncludeExternalMedia: operations.QueryParamIncludeExternalMediaEnable.ToPointer(),
})
if err != nil {
log.Fatal(err)

View File

@@ -230,7 +230,6 @@ package main
import(
"context"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
@@ -241,7 +240,7 @@ func main() {
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Plex.GetServerResources(ctx, "3381b62b-9ab7-4e37-827b-203e9809eb58", operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer())
res, err := s.Plex.GetServerResources(ctx, "3381b62b-9ab7-4e37-827b-203e9809eb58", nil, nil, nil)
if err != nil {
log.Fatal(err)
}
@@ -296,7 +295,6 @@ func main() {
s := plexgo.New()
res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{
Strong: plexgo.Bool(false),
ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
ClientName: plexgo.String("Plex for Roku"),
DeviceNickname: plexgo.String("Roku 3"),

View File

@@ -46,7 +46,7 @@ func main() {
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Search.PerformSearch(ctx, "dylan", nil, plexgo.Float64(5))
res, err := s.Search.PerformSearch(ctx, "dylan", nil, nil)
if err != nil {
log.Fatal(err)
}
@@ -104,7 +104,7 @@ func main() {
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Search.PerformVoiceSearch(ctx, "dead+poop", nil, plexgo.Float64(5))
res, err := s.Search.PerformVoiceSearch(ctx, "dead+poop", nil, nil)
if err != nil {
log.Fatal(err)
}

73
docs/sdks/users/README.md Normal file
View File

@@ -0,0 +1,73 @@
# Users
(*Users*)
## Overview
### Available Operations
* [GetUsers](#getusers) - Get list of all connected users
## GetUsers
Get list of all users that are friends and have library access with the provided Plex authentication token
### Example Usage
```go
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New()
res, err := s.Users.GetUsers(ctx, operations.GetUsersRequest{
ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
ClientName: plexgo.String("Plex for Roku"),
DeviceNickname: plexgo.String("Roku 3"),
DeviceName: plexgo.String("Chrome"),
DeviceScreenResolution: plexgo.String("1487x1165,2560x1440"),
ClientVersion: plexgo.String("2.4.1"),
Platform: plexgo.String("Roku"),
ClientFeatures: plexgo.String("external-media,indirect-media,hub-style-list"),
Model: plexgo.String("4200X"),
XPlexSessionID: plexgo.String("97e136ef-4ddd-4ff3-89a7-a5820c96c2ca"),
XPlexLanguage: plexgo.String("en"),
PlatformVersion: plexgo.String("4.3 build 1057"),
XPlexToken: "CV5xoxjTpFKUzBTShsaf",
})
if err != nil {
log.Fatal(err)
}
if res.Body != nil {
// handle response
}
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
| `request` | [operations.GetUsersRequest](../../models/operations/getusersrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. |
### Response
**[*operations.GetUsersResponse](../../models/operations/getusersresponse.md), error**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| sdkerrors.GetUsersBadRequest | 400 | application/json |
| sdkerrors.GetUsersUnauthorized | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |

View File

@@ -35,8 +35,6 @@ func main() {
res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{
Filter: operations.FilterAvailable,
XPlexContainerStart: plexgo.Int(0),
XPlexContainerSize: plexgo.Int(50),
XPlexToken: "CV5xoxjTpFKUzBTShsaf",
})
if err != nil {

View File

@@ -65,6 +65,12 @@ func populateQueryParams(queryParams interface{}, globals interface{}, values ur
continue
}
constValue := parseConstTag(fieldType)
if constValue != nil {
values.Add(qpTag.ParamName, *constValue)
continue
}
if globals != nil {
var globalFound bool
fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, queryParamTagKey, globals)

View File

@@ -96,6 +96,16 @@ func AsSecuritySource(security interface{}) func(context.Context) (interface{},
}
}
func parseConstTag(field reflect.StructField) *string {
value := field.Tag.Get("const")
if value == "" {
return nil
}
return &value
}
func parseStructTag(tagKey string, field reflect.StructField) map[string]string {
tag := field.Tag.Get(tagKey)
if tag == "" {

View File

@@ -2046,6 +2046,506 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op
}
// GetGenresLibrary - Get Genres of library media
// Retrieves a list of all the genres that are found for the media in this library.
func (s *Library) GetGenresLibrary(ctx context.Context, sectionKey int, opts ...operations.Option) (*operations.GetGenresLibraryResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "get-genres-library",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
request := operations.GetGenresLibraryRequest{
SectionKey: sectionKey,
}
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
operations.SupportedOptionTimeout,
}
for _, opt := range opts {
if err := opt(&o, supportedOptions...); err != nil {
return nil, fmt.Errorf("error applying option: %w", err)
}
}
var baseURL string
if o.ServerURL == nil {
baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
} else {
baseURL = *o.ServerURL
}
opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/genre", request, nil)
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
timeout := o.Timeout
if timeout == nil {
timeout = s.sdkConfiguration.Timeout
}
if timeout != nil {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, *timeout)
defer cancel()
}
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.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
return nil, err
}
for k, v := range o.SetHeaders {
req.Header.Set(k, v)
}
globalRetryConfig := s.sdkConfiguration.RetryConfig
retryConfig := o.Retries
if retryConfig == nil {
if globalRetryConfig != nil {
retryConfig = globalRetryConfig
}
}
var httpRes *http.Response
if retryConfig != nil {
httpRes, err = utils.Retry(ctx, utils.Retries{
Config: retryConfig,
StatusCodes: []string{
"429",
"500",
"502",
"503",
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
}
return nil, retry.Permanent(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 httpRes, err
})
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
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", "404", "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.GetGenresLibraryResponse{
StatusCode: httpRes.StatusCode,
ContentType: httpRes.Header.Get("Content-Type"),
RawResponse: httpRes,
}
switch {
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out operations.GetGenresLibraryResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.Object = &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
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:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetGenresLibraryBadRequest
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetGenresLibraryUnauthorized
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 404:
fallthrough
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}
// GetCountriesLibrary - Get Countries of library media
// Retrieves a list of all the countries that are found for the media in this library.
func (s *Library) GetCountriesLibrary(ctx context.Context, sectionKey int, opts ...operations.Option) (*operations.GetCountriesLibraryResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "get-countries-library",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
request := operations.GetCountriesLibraryRequest{
SectionKey: sectionKey,
}
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
operations.SupportedOptionTimeout,
}
for _, opt := range opts {
if err := opt(&o, supportedOptions...); err != nil {
return nil, fmt.Errorf("error applying option: %w", err)
}
}
var baseURL string
if o.ServerURL == nil {
baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
} else {
baseURL = *o.ServerURL
}
opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/country", request, nil)
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
timeout := o.Timeout
if timeout == nil {
timeout = s.sdkConfiguration.Timeout
}
if timeout != nil {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, *timeout)
defer cancel()
}
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.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
return nil, err
}
for k, v := range o.SetHeaders {
req.Header.Set(k, v)
}
globalRetryConfig := s.sdkConfiguration.RetryConfig
retryConfig := o.Retries
if retryConfig == nil {
if globalRetryConfig != nil {
retryConfig = globalRetryConfig
}
}
var httpRes *http.Response
if retryConfig != nil {
httpRes, err = utils.Retry(ctx, utils.Retries{
Config: retryConfig,
StatusCodes: []string{
"429",
"500",
"502",
"503",
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
}
return nil, retry.Permanent(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 httpRes, err
})
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
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", "404", "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.GetCountriesLibraryResponse{
StatusCode: httpRes.StatusCode,
ContentType: httpRes.Header.Get("Content-Type"),
RawResponse: httpRes,
}
switch {
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out operations.GetCountriesLibraryResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.Object = &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
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:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetCountriesLibraryBadRequest
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetCountriesLibraryUnauthorized
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 404:
fallthrough
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}
// GetSearchAllLibraries - Search All Libraries
// Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations.GetSearchAllLibrariesRequest, opts ...operations.Option) (*operations.GetSearchAllLibrariesResponse, error) {

View File

@@ -0,0 +1,222 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package operations
import (
"net/http"
)
type GetCountriesLibraryRequest struct {
// The unique key of the Plex library.
// Note: This is unique in the context of the Plex server.
//
SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"`
}
func (o *GetCountriesLibraryRequest) GetSectionKey() int {
if o == nil {
return 0
}
return o.SectionKey
}
type GetCountriesLibraryDirectory struct {
FastKey string `json:"fastKey"`
Key string `json:"key"`
Title string `json:"title"`
}
func (o *GetCountriesLibraryDirectory) GetFastKey() string {
if o == nil {
return ""
}
return o.FastKey
}
func (o *GetCountriesLibraryDirectory) GetKey() string {
if o == nil {
return ""
}
return o.Key
}
func (o *GetCountriesLibraryDirectory) GetTitle() string {
if o == nil {
return ""
}
return o.Title
}
type GetCountriesLibraryMediaContainer struct {
Size float64 `json:"size"`
Offset *int `json:"offset,omitempty"`
TotalSize *int `json:"totalSize,omitempty"`
Identifier string `json:"identifier"`
AllowSync bool `json:"allowSync"`
Art string `json:"art"`
Content string `json:"content"`
MediaTagPrefix string `json:"mediaTagPrefix"`
MediaTagVersion int64 `json:"mediaTagVersion"`
Nocache bool `json:"nocache"`
Thumb string `json:"thumb"`
Title1 string `json:"title1"`
Title2 string `json:"title2"`
ViewGroup string `json:"viewGroup"`
Directory []GetCountriesLibraryDirectory `json:"Directory,omitempty"`
}
func (o *GetCountriesLibraryMediaContainer) GetSize() float64 {
if o == nil {
return 0.0
}
return o.Size
}
func (o *GetCountriesLibraryMediaContainer) GetOffset() *int {
if o == nil {
return nil
}
return o.Offset
}
func (o *GetCountriesLibraryMediaContainer) GetTotalSize() *int {
if o == nil {
return nil
}
return o.TotalSize
}
func (o *GetCountriesLibraryMediaContainer) GetIdentifier() string {
if o == nil {
return ""
}
return o.Identifier
}
func (o *GetCountriesLibraryMediaContainer) GetAllowSync() bool {
if o == nil {
return false
}
return o.AllowSync
}
func (o *GetCountriesLibraryMediaContainer) GetArt() string {
if o == nil {
return ""
}
return o.Art
}
func (o *GetCountriesLibraryMediaContainer) GetContent() string {
if o == nil {
return ""
}
return o.Content
}
func (o *GetCountriesLibraryMediaContainer) GetMediaTagPrefix() string {
if o == nil {
return ""
}
return o.MediaTagPrefix
}
func (o *GetCountriesLibraryMediaContainer) GetMediaTagVersion() int64 {
if o == nil {
return 0
}
return o.MediaTagVersion
}
func (o *GetCountriesLibraryMediaContainer) GetNocache() bool {
if o == nil {
return false
}
return o.Nocache
}
func (o *GetCountriesLibraryMediaContainer) GetThumb() string {
if o == nil {
return ""
}
return o.Thumb
}
func (o *GetCountriesLibraryMediaContainer) GetTitle1() string {
if o == nil {
return ""
}
return o.Title1
}
func (o *GetCountriesLibraryMediaContainer) GetTitle2() string {
if o == nil {
return ""
}
return o.Title2
}
func (o *GetCountriesLibraryMediaContainer) GetViewGroup() string {
if o == nil {
return ""
}
return o.ViewGroup
}
func (o *GetCountriesLibraryMediaContainer) GetDirectory() []GetCountriesLibraryDirectory {
if o == nil {
return nil
}
return o.Directory
}
// GetCountriesLibraryResponseBody - Successful response containing media container data.
type GetCountriesLibraryResponseBody struct {
MediaContainer *GetCountriesLibraryMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *GetCountriesLibraryResponseBody) GetMediaContainer() *GetCountriesLibraryMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetCountriesLibraryResponse 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
// Successful response containing media container data.
Object *GetCountriesLibraryResponseBody
}
func (o *GetCountriesLibraryResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetCountriesLibraryResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetCountriesLibraryResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetCountriesLibraryResponse) GetObject() *GetCountriesLibraryResponseBody {
if o == nil {
return nil
}
return o.Object
}

View File

@@ -0,0 +1,230 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package operations
import (
"net/http"
)
type GetGenresLibraryRequest struct {
// The unique key of the Plex library.
// Note: This is unique in the context of the Plex server.
//
SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"`
}
func (o *GetGenresLibraryRequest) GetSectionKey() int {
if o == nil {
return 0
}
return o.SectionKey
}
type GetGenresLibraryDirectory struct {
FastKey string `json:"fastKey"`
Key string `json:"key"`
Title string `json:"title"`
Type string `json:"type"`
}
func (o *GetGenresLibraryDirectory) GetFastKey() string {
if o == nil {
return ""
}
return o.FastKey
}
func (o *GetGenresLibraryDirectory) GetKey() string {
if o == nil {
return ""
}
return o.Key
}
func (o *GetGenresLibraryDirectory) GetTitle() string {
if o == nil {
return ""
}
return o.Title
}
func (o *GetGenresLibraryDirectory) GetType() string {
if o == nil {
return ""
}
return o.Type
}
type GetGenresLibraryMediaContainer struct {
Size float64 `json:"size"`
Offset *int `json:"offset,omitempty"`
TotalSize *int `json:"totalSize,omitempty"`
Identifier string `json:"identifier"`
AllowSync bool `json:"allowSync"`
Art string `json:"art"`
Content string `json:"content"`
MediaTagPrefix string `json:"mediaTagPrefix"`
MediaTagVersion int64 `json:"mediaTagVersion"`
Nocache bool `json:"nocache"`
Thumb string `json:"thumb"`
Title1 string `json:"title1"`
Title2 string `json:"title2"`
ViewGroup string `json:"viewGroup"`
Directory []GetGenresLibraryDirectory `json:"Directory,omitempty"`
}
func (o *GetGenresLibraryMediaContainer) GetSize() float64 {
if o == nil {
return 0.0
}
return o.Size
}
func (o *GetGenresLibraryMediaContainer) GetOffset() *int {
if o == nil {
return nil
}
return o.Offset
}
func (o *GetGenresLibraryMediaContainer) GetTotalSize() *int {
if o == nil {
return nil
}
return o.TotalSize
}
func (o *GetGenresLibraryMediaContainer) GetIdentifier() string {
if o == nil {
return ""
}
return o.Identifier
}
func (o *GetGenresLibraryMediaContainer) GetAllowSync() bool {
if o == nil {
return false
}
return o.AllowSync
}
func (o *GetGenresLibraryMediaContainer) GetArt() string {
if o == nil {
return ""
}
return o.Art
}
func (o *GetGenresLibraryMediaContainer) GetContent() string {
if o == nil {
return ""
}
return o.Content
}
func (o *GetGenresLibraryMediaContainer) GetMediaTagPrefix() string {
if o == nil {
return ""
}
return o.MediaTagPrefix
}
func (o *GetGenresLibraryMediaContainer) GetMediaTagVersion() int64 {
if o == nil {
return 0
}
return o.MediaTagVersion
}
func (o *GetGenresLibraryMediaContainer) GetNocache() bool {
if o == nil {
return false
}
return o.Nocache
}
func (o *GetGenresLibraryMediaContainer) GetThumb() string {
if o == nil {
return ""
}
return o.Thumb
}
func (o *GetGenresLibraryMediaContainer) GetTitle1() string {
if o == nil {
return ""
}
return o.Title1
}
func (o *GetGenresLibraryMediaContainer) GetTitle2() string {
if o == nil {
return ""
}
return o.Title2
}
func (o *GetGenresLibraryMediaContainer) GetViewGroup() string {
if o == nil {
return ""
}
return o.ViewGroup
}
func (o *GetGenresLibraryMediaContainer) GetDirectory() []GetGenresLibraryDirectory {
if o == nil {
return nil
}
return o.Directory
}
// GetGenresLibraryResponseBody - Successful response containing media container data.
type GetGenresLibraryResponseBody struct {
MediaContainer *GetGenresLibraryMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *GetGenresLibraryResponseBody) GetMediaContainer() *GetGenresLibraryMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetGenresLibraryResponse 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
// Successful response containing media container data.
Object *GetGenresLibraryResponseBody
}
func (o *GetGenresLibraryResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetGenresLibraryResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetGenresLibraryResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetGenresLibraryResponse) GetObject() *GetGenresLibraryResponseBody {
if o == nil {
return nil
}
return o.Object
}

View File

@@ -716,20 +716,20 @@ func (e *GetLibraryItemsEnableCreditsMarkerGeneration) UnmarshalJSON(data []byte
}
}
// GetLibraryItemsShowOrdering - Setting that indicates the episode ordering for the show
// GetLibraryItemsShowOrdering - Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
type GetLibraryItemsShowOrdering string
const (
GetLibraryItemsShowOrderingNone GetLibraryItemsShowOrdering = "None"
GetLibraryItemsShowOrderingTmdbAiring GetLibraryItemsShowOrdering = "tmdbAiring"
GetLibraryItemsShowOrderingTvdbAiring GetLibraryItemsShowOrdering = "tvdbAiring"
GetLibraryItemsShowOrderingTvdbDvd GetLibraryItemsShowOrdering = "tvdbDvd"
GetLibraryItemsShowOrderingTvdbAbsolute GetLibraryItemsShowOrdering = "tvdbAbsolute"
GetLibraryItemsShowOrderingTvdbAired GetLibraryItemsShowOrdering = "aired"
GetLibraryItemsShowOrderingTvdbDvd GetLibraryItemsShowOrdering = "dvd"
GetLibraryItemsShowOrderingTvdbAbsolute GetLibraryItemsShowOrdering = "absolute"
)
func (e GetLibraryItemsShowOrdering) ToPointer() *GetLibraryItemsShowOrdering {
@@ -745,11 +745,11 @@ func (e *GetLibraryItemsShowOrdering) UnmarshalJSON(data []byte) error {
fallthrough
case "tmdbAiring":
fallthrough
case "tvdbAiring":
case "aired":
fallthrough
case "tvdbDvd":
case "dvd":
fallthrough
case "tvdbAbsolute":
case "absolute":
*e = GetLibraryItemsShowOrdering(v)
return nil
default:
@@ -1719,12 +1719,12 @@ type GetLibraryItemsMetadata struct {
EpisodeSort *GetLibraryItemsEpisodeSort `json:"episodeSort,omitempty"`
// Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
EnableCreditsMarkerGeneration *GetLibraryItemsEnableCreditsMarkerGeneration `json:"enableCreditsMarkerGeneration,omitempty"`
// Setting that indicates the episode ordering for the show
// Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
//
ShowOrdering *GetLibraryItemsShowOrdering `json:"showOrdering,omitempty"`
Thumb *string `json:"thumb,omitempty"`

View File

@@ -625,20 +625,20 @@ func (e *EnableCreditsMarkerGeneration) UnmarshalJSON(data []byte) error {
}
}
// ShowOrdering - Setting that indicates the episode ordering for the show
// ShowOrdering - Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
type ShowOrdering string
const (
ShowOrderingNone ShowOrdering = "None"
ShowOrderingTmdbAiring ShowOrdering = "tmdbAiring"
ShowOrderingTvdbAiring ShowOrdering = "tvdbAiring"
ShowOrderingTvdbDvd ShowOrdering = "tvdbDvd"
ShowOrderingTvdbAbsolute ShowOrdering = "tvdbAbsolute"
ShowOrderingTvdbAired ShowOrdering = "aired"
ShowOrderingTvdbDvd ShowOrdering = "dvd"
ShowOrderingTvdbAbsolute ShowOrdering = "absolute"
)
func (e ShowOrdering) ToPointer() *ShowOrdering {
@@ -654,11 +654,11 @@ func (e *ShowOrdering) UnmarshalJSON(data []byte) error {
fallthrough
case "tmdbAiring":
fallthrough
case "tvdbAiring":
case "aired":
fallthrough
case "tvdbDvd":
case "dvd":
fallthrough
case "tvdbAbsolute":
case "absolute":
*e = ShowOrdering(v)
return nil
default:
@@ -1628,12 +1628,12 @@ type GetRecentlyAddedMetadata struct {
EpisodeSort *EpisodeSort `json:"episodeSort,omitempty"`
// Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
EnableCreditsMarkerGeneration *EnableCreditsMarkerGeneration `json:"enableCreditsMarkerGeneration,omitempty"`
// Setting that indicates the episode ordering for the show
// Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
//
ShowOrdering *ShowOrdering `json:"showOrdering,omitempty"`
Thumb *string `json:"thumb,omitempty"`

View File

@@ -288,20 +288,20 @@ func (e *GetSearchAllLibrariesEnableCreditsMarkerGeneration) UnmarshalJSON(data
}
}
// GetSearchAllLibrariesShowOrdering - Setting that indicates the episode ordering for the show
// GetSearchAllLibrariesShowOrdering - Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
type GetSearchAllLibrariesShowOrdering string
const (
GetSearchAllLibrariesShowOrderingNone GetSearchAllLibrariesShowOrdering = "None"
GetSearchAllLibrariesShowOrderingTmdbAiring GetSearchAllLibrariesShowOrdering = "tmdbAiring"
GetSearchAllLibrariesShowOrderingTvdbAiring GetSearchAllLibrariesShowOrdering = "tvdbAiring"
GetSearchAllLibrariesShowOrderingTvdbDvd GetSearchAllLibrariesShowOrdering = "tvdbDvd"
GetSearchAllLibrariesShowOrderingTvdbAbsolute GetSearchAllLibrariesShowOrdering = "tvdbAbsolute"
GetSearchAllLibrariesShowOrderingTvdbAired GetSearchAllLibrariesShowOrdering = "aired"
GetSearchAllLibrariesShowOrderingTvdbDvd GetSearchAllLibrariesShowOrdering = "dvd"
GetSearchAllLibrariesShowOrderingTvdbAbsolute GetSearchAllLibrariesShowOrdering = "absolute"
)
func (e GetSearchAllLibrariesShowOrdering) ToPointer() *GetSearchAllLibrariesShowOrdering {
@@ -317,11 +317,11 @@ func (e *GetSearchAllLibrariesShowOrdering) UnmarshalJSON(data []byte) error {
fallthrough
case "tmdbAiring":
fallthrough
case "tvdbAiring":
case "aired":
fallthrough
case "tvdbDvd":
case "dvd":
fallthrough
case "tvdbAbsolute":
case "absolute":
*e = GetSearchAllLibrariesShowOrdering(v)
return nil
default:
@@ -1291,12 +1291,12 @@ type GetSearchAllLibrariesMetadata struct {
EpisodeSort *GetSearchAllLibrariesEpisodeSort `json:"episodeSort,omitempty"`
// Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
EnableCreditsMarkerGeneration *GetSearchAllLibrariesEnableCreditsMarkerGeneration `json:"enableCreditsMarkerGeneration,omitempty"`
// Setting that indicates the episode ordering for the show
// Setting that indicates the episode ordering for the show.
// None = Library default,
// tmdbAiring = The Movie Database (Aired),
// tvdbAiring = TheTVDB (Aired),
// tvdbDvd = TheTVDB (DVD),
// tvdbAbsolute = TheTVDB (Absolute)).
// aired = TheTVDB (Aired),
// dvd = TheTVDB (DVD),
// absolute = TheTVDB (Absolute)).
//
ShowOrdering *GetSearchAllLibrariesShowOrdering `json:"showOrdering,omitempty"`
Thumb *string `json:"thumb,omitempty"`

View File

@@ -201,11 +201,11 @@ func (o *GetTopWatchedContentRole) GetThumb() *string {
return o.Thumb
}
type User struct {
type GetTopWatchedContentUser struct {
ID *int `json:"id,omitempty"`
}
func (o *User) GetID() *int {
func (o *GetTopWatchedContentUser) GetID() *int {
if o == nil {
return nil
}
@@ -244,7 +244,7 @@ type GetTopWatchedContentMetadata struct {
Country []GetTopWatchedContentCountry `json:"Country,omitempty"`
Guids []GetTopWatchedContentGuids `json:"Guid,omitempty"`
Role []GetTopWatchedContentRole `json:"Role,omitempty"`
User []User `json:"User,omitempty"`
User []GetTopWatchedContentUser `json:"User,omitempty"`
}
func (g GetTopWatchedContentMetadata) MarshalJSON() ([]byte, error) {
@@ -475,7 +475,7 @@ func (o *GetTopWatchedContentMetadata) GetRole() []GetTopWatchedContentRole {
return o.Role
}
func (o *GetTopWatchedContentMetadata) GetUser() []User {
func (o *GetTopWatchedContentMetadata) GetUser() []GetTopWatchedContentUser {
if o == nil {
return nil
}

View File

@@ -0,0 +1,816 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package operations
import (
"encoding/json"
"fmt"
"github.com/LukeHagar/plexgo/internal/utils"
"net/http"
)
var GetUsersServerList = []string{
"https://plex.tv/api",
}
type GetUsersRequest struct {
// An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
// The name of the client application. (Plex Web, Plex Media Server, etc.)
ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"`
// A relatively friendly name for the client device
DeviceNickname *string `header:"style=simple,explode=false,name=X-Plex-Device"`
// The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.)
DeviceName *string `header:"style=simple,explode=false,name=X-Plex-Device-Name"`
// The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440)
DeviceScreenResolution *string `header:"style=simple,explode=false,name=X-Plex-Device-Screen-Resolution"`
// The version of the client application.
ClientVersion *string `header:"style=simple,explode=false,name=X-Plex-Version"`
// The platform of the client application.
Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"`
// The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list)
ClientFeatures *string `header:"style=simple,explode=false,name=X-Plex-Features"`
// A potentially less friendly identifier for the device model
Model *string `header:"style=simple,explode=false,name=X-Plex-Model"`
// The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca)
XPlexSessionID *string `header:"style=simple,explode=false,name=X-Plex-Session-Id"`
// The language of the client application.
XPlexLanguage *string `header:"style=simple,explode=false,name=X-Plex-Language"`
// The version of the platform
PlatformVersion *string `header:"style=simple,explode=false,name=X-Plex-Platform-Version"`
// An authentication token, obtained from plex.tv
XPlexToken string `header:"style=simple,explode=false,name=X-Plex-Token"`
}
func (o *GetUsersRequest) GetClientID() string {
if o == nil {
return ""
}
return o.ClientID
}
func (o *GetUsersRequest) GetClientName() *string {
if o == nil {
return nil
}
return o.ClientName
}
func (o *GetUsersRequest) GetDeviceNickname() *string {
if o == nil {
return nil
}
return o.DeviceNickname
}
func (o *GetUsersRequest) GetDeviceName() *string {
if o == nil {
return nil
}
return o.DeviceName
}
func (o *GetUsersRequest) GetDeviceScreenResolution() *string {
if o == nil {
return nil
}
return o.DeviceScreenResolution
}
func (o *GetUsersRequest) GetClientVersion() *string {
if o == nil {
return nil
}
return o.ClientVersion
}
func (o *GetUsersRequest) GetPlatform() *string {
if o == nil {
return nil
}
return o.Platform
}
func (o *GetUsersRequest) GetClientFeatures() *string {
if o == nil {
return nil
}
return o.ClientFeatures
}
func (o *GetUsersRequest) GetModel() *string {
if o == nil {
return nil
}
return o.Model
}
func (o *GetUsersRequest) GetXPlexSessionID() *string {
if o == nil {
return nil
}
return o.XPlexSessionID
}
func (o *GetUsersRequest) GetXPlexLanguage() *string {
if o == nil {
return nil
}
return o.XPlexLanguage
}
func (o *GetUsersRequest) GetPlatformVersion() *string {
if o == nil {
return nil
}
return o.PlatformVersion
}
func (o *GetUsersRequest) GetXPlexToken() string {
if o == nil {
return ""
}
return o.XPlexToken
}
// Protected - Indicates whether the account is protected.
type Protected int
const (
ProtectedDisable Protected = 0
ProtectedEnable Protected = 1
)
func (e Protected) ToPointer() *Protected {
return &e
}
func (e *Protected) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = Protected(v)
return nil
default:
return fmt.Errorf("invalid value for Protected: %v", v)
}
}
// Home - Indicates if the user is part of a home group.
type Home int
const (
HomeDisable Home = 0
HomeEnable Home = 1
)
func (e Home) ToPointer() *Home {
return &e
}
func (e *Home) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = Home(v)
return nil
default:
return fmt.Errorf("invalid value for Home: %v", v)
}
}
// AllowTuners - Indicates if the user is allowed to use tuners.
type AllowTuners int
const (
AllowTunersDisable AllowTuners = 0
AllowTunersEnable AllowTuners = 1
)
func (e AllowTuners) ToPointer() *AllowTuners {
return &e
}
func (e *AllowTuners) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllowTuners(v)
return nil
default:
return fmt.Errorf("invalid value for AllowTuners: %v", v)
}
}
// AllowSync - Indicates if the user is allowed to sync media.
type AllowSync int
const (
AllowSyncDisable AllowSync = 0
AllowSyncEnable AllowSync = 1
)
func (e AllowSync) ToPointer() *AllowSync {
return &e
}
func (e *AllowSync) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllowSync(v)
return nil
default:
return fmt.Errorf("invalid value for AllowSync: %v", v)
}
}
// AllowCameraUpload - Indicates if the user is allowed to upload from a camera.
type AllowCameraUpload int
const (
AllowCameraUploadDisable AllowCameraUpload = 0
AllowCameraUploadEnable AllowCameraUpload = 1
)
func (e AllowCameraUpload) ToPointer() *AllowCameraUpload {
return &e
}
func (e *AllowCameraUpload) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllowCameraUpload(v)
return nil
default:
return fmt.Errorf("invalid value for AllowCameraUpload: %v", v)
}
}
// AllowChannels - Indicates if the user has access to channels.
type AllowChannels int
const (
AllowChannelsDisable AllowChannels = 0
AllowChannelsEnable AllowChannels = 1
)
func (e AllowChannels) ToPointer() *AllowChannels {
return &e
}
func (e *AllowChannels) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllowChannels(v)
return nil
default:
return fmt.Errorf("invalid value for AllowChannels: %v", v)
}
}
// AllowSubtitleAdmin - Indicates if the user can manage subtitles.
type AllowSubtitleAdmin int
const (
AllowSubtitleAdminDisable AllowSubtitleAdmin = 0
AllowSubtitleAdminEnable AllowSubtitleAdmin = 1
)
func (e AllowSubtitleAdmin) ToPointer() *AllowSubtitleAdmin {
return &e
}
func (e *AllowSubtitleAdmin) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllowSubtitleAdmin(v)
return nil
default:
return fmt.Errorf("invalid value for AllowSubtitleAdmin: %v", v)
}
}
// Restricted - Indicates if the user has restricted access.
type Restricted int
const (
RestrictedDisable Restricted = 0
RestrictedEnable Restricted = 1
)
func (e Restricted) ToPointer() *Restricted {
return &e
}
func (e *Restricted) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = Restricted(v)
return nil
default:
return fmt.Errorf("invalid value for Restricted: %v", v)
}
}
// AllLibraries - Indicates if the user has access to all libraries.
type AllLibraries int
const (
AllLibrariesDisable AllLibraries = 0
AllLibrariesEnable AllLibraries = 1
)
func (e AllLibraries) ToPointer() *AllLibraries {
return &e
}
func (e *AllLibraries) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = AllLibraries(v)
return nil
default:
return fmt.Errorf("invalid value for AllLibraries: %v", v)
}
}
// Owned - Indicates if the user owns the server.
type Owned int
const (
OwnedDisable Owned = 0
OwnedEnable Owned = 1
)
func (e Owned) ToPointer() *Owned {
return &e
}
func (e *Owned) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = Owned(v)
return nil
default:
return fmt.Errorf("invalid value for Owned: %v", v)
}
}
// Pending - Indicates if the server is pending approval.
type Pending int
const (
PendingDisable Pending = 0
PendingEnable Pending = 1
)
func (e Pending) ToPointer() *Pending {
return &e
}
func (e *Pending) UnmarshalJSON(data []byte) error {
var v int
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = Pending(v)
return nil
default:
return fmt.Errorf("invalid value for Pending: %v", v)
}
}
type GetUsersServer struct {
// Unique ID of the server of the connected user
ID int64
// ID of the actual Plex server.
ServerID int64
// Machine identifier of the Plex server.
MachineIdentifier string
// Name of the Plex server of the connected user.
Name string
LastSeenAt int64
// Number of libraries in the server this user has access to.
NumLibraries int64
AllLibraries *AllLibraries `default:"0"`
Owned *Owned `default:"0"`
Pending *Pending `default:"0"`
}
func (g GetUsersServer) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(g, "", false)
}
func (g *GetUsersServer) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil {
return err
}
return nil
}
func (o *GetUsersServer) GetID() int64 {
if o == nil {
return 0
}
return o.ID
}
func (o *GetUsersServer) GetServerID() int64 {
if o == nil {
return 0
}
return o.ServerID
}
func (o *GetUsersServer) GetMachineIdentifier() string {
if o == nil {
return ""
}
return o.MachineIdentifier
}
func (o *GetUsersServer) GetName() string {
if o == nil {
return ""
}
return o.Name
}
func (o *GetUsersServer) GetLastSeenAt() int64 {
if o == nil {
return 0
}
return o.LastSeenAt
}
func (o *GetUsersServer) GetNumLibraries() int64 {
if o == nil {
return 0
}
return o.NumLibraries
}
func (o *GetUsersServer) GetAllLibraries() *AllLibraries {
if o == nil {
return nil
}
return o.AllLibraries
}
func (o *GetUsersServer) GetOwned() *Owned {
if o == nil {
return nil
}
return o.Owned
}
func (o *GetUsersServer) GetPending() *Pending {
if o == nil {
return nil
}
return o.Pending
}
type User struct {
// User's unique ID.
ID int64
// User's display name.
Title string
// User's username.
Username string
// User's email address.
Email string
// ID of the user's recommendation playlist.
RecommendationsPlaylistID *string
// URL to the user's avatar image.
Thumb string
Protected *Protected `default:"0"`
Home *Home `default:"0"`
AllowTuners *AllowTuners `default:"0"`
AllowSync *AllowSync `default:"0"`
AllowCameraUpload *AllowCameraUpload `default:"0"`
AllowChannels *AllowChannels `default:"0"`
AllowSubtitleAdmin *AllowSubtitleAdmin `default:"0"`
// Filters applied for all content.
FilterAll *string
// Filters applied for movies.
FilterMovies *string
// Filters applied for music.
FilterMusic *string
// Filters applied for photos.
FilterPhotos *string
// Filters applied for television.
FilterTelevision *string
Restricted *Restricted `default:"0"`
// List of servers owned by the user.
Server []GetUsersServer
}
func (u User) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(u, "", false)
}
func (u *User) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil {
return err
}
return nil
}
func (o *User) GetID() int64 {
if o == nil {
return 0
}
return o.ID
}
func (o *User) GetTitle() string {
if o == nil {
return ""
}
return o.Title
}
func (o *User) GetUsername() string {
if o == nil {
return ""
}
return o.Username
}
func (o *User) GetEmail() string {
if o == nil {
return ""
}
return o.Email
}
func (o *User) GetRecommendationsPlaylistID() *string {
if o == nil {
return nil
}
return o.RecommendationsPlaylistID
}
func (o *User) GetThumb() string {
if o == nil {
return ""
}
return o.Thumb
}
func (o *User) GetProtected() *Protected {
if o == nil {
return nil
}
return o.Protected
}
func (o *User) GetHome() *Home {
if o == nil {
return nil
}
return o.Home
}
func (o *User) GetAllowTuners() *AllowTuners {
if o == nil {
return nil
}
return o.AllowTuners
}
func (o *User) GetAllowSync() *AllowSync {
if o == nil {
return nil
}
return o.AllowSync
}
func (o *User) GetAllowCameraUpload() *AllowCameraUpload {
if o == nil {
return nil
}
return o.AllowCameraUpload
}
func (o *User) GetAllowChannels() *AllowChannels {
if o == nil {
return nil
}
return o.AllowChannels
}
func (o *User) GetAllowSubtitleAdmin() *AllowSubtitleAdmin {
if o == nil {
return nil
}
return o.AllowSubtitleAdmin
}
func (o *User) GetFilterAll() *string {
if o == nil {
return nil
}
return o.FilterAll
}
func (o *User) GetFilterMovies() *string {
if o == nil {
return nil
}
return o.FilterMovies
}
func (o *User) GetFilterMusic() *string {
if o == nil {
return nil
}
return o.FilterMusic
}
func (o *User) GetFilterPhotos() *string {
if o == nil {
return nil
}
return o.FilterPhotos
}
func (o *User) GetFilterTelevision() *string {
if o == nil {
return nil
}
return o.FilterTelevision
}
func (o *User) GetRestricted() *Restricted {
if o == nil {
return nil
}
return o.Restricted
}
func (o *User) GetServer() []GetUsersServer {
if o == nil {
return []GetUsersServer{}
}
return o.Server
}
// GetUsersMediaContainer - Container holding user and server details.
type GetUsersMediaContainer struct {
// The friendly name of the Plex instance.
FriendlyName string
Identifier string
// Unique Machine identifier of the Plex server.
MachineIdentifier string
// Total number of users.
TotalSize int64
// Number of users in the current response.
Size int64
// List of users with access to the Plex server.
User []User
}
func (o *GetUsersMediaContainer) GetFriendlyName() string {
if o == nil {
return ""
}
return o.FriendlyName
}
func (o *GetUsersMediaContainer) GetIdentifier() string {
if o == nil {
return ""
}
return o.Identifier
}
func (o *GetUsersMediaContainer) GetMachineIdentifier() string {
if o == nil {
return ""
}
return o.MachineIdentifier
}
func (o *GetUsersMediaContainer) GetTotalSize() int64 {
if o == nil {
return 0
}
return o.TotalSize
}
func (o *GetUsersMediaContainer) GetSize() int64 {
if o == nil {
return 0
}
return o.Size
}
func (o *GetUsersMediaContainer) GetUser() []User {
if o == nil {
return []User{}
}
return o.User
}
// GetUsersResponseBody - Successful response with media container data in XML
type GetUsersResponseBody struct {
// Container holding user and server details.
MediaContainer *GetUsersMediaContainer
}
func (o *GetUsersResponseBody) GetMediaContainer() *GetUsersMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetUsersResponse 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
Body []byte
}
func (o *GetUsersResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetUsersResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetUsersResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetUsersResponse) GetBody() []byte {
if o == nil {
return nil
}
return o.Body
}

View File

@@ -23,6 +23,7 @@ type AcceptHeaderEnum string
const (
AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json"
AcceptHeaderEnumImageJpeg AcceptHeaderEnum = "image/jpeg"
AcceptHeaderEnumApplicationXml AcceptHeaderEnum = "application/xml"
)
func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum {

View File

@@ -0,0 +1,90 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package sdkerrors
import (
"encoding/json"
"net/http"
)
type GetCountriesLibraryLibraryErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetCountriesLibraryLibraryErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetCountriesLibraryLibraryErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetCountriesLibraryLibraryErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetCountriesLibraryUnauthorized - Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
type GetCountriesLibraryUnauthorized struct {
Errors []GetCountriesLibraryLibraryErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetCountriesLibraryUnauthorized{}
func (e *GetCountriesLibraryUnauthorized) Error() string {
data, _ := json.Marshal(e)
return string(data)
}
type GetCountriesLibraryErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetCountriesLibraryErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetCountriesLibraryErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetCountriesLibraryErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetCountriesLibraryBadRequest - Bad Request - A parameter was not specified, or was specified incorrectly.
type GetCountriesLibraryBadRequest struct {
Errors []GetCountriesLibraryErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetCountriesLibraryBadRequest{}
func (e *GetCountriesLibraryBadRequest) Error() string {
data, _ := json.Marshal(e)
return string(data)
}

View File

@@ -0,0 +1,90 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package sdkerrors
import (
"encoding/json"
"net/http"
)
type GetGenresLibraryLibraryErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetGenresLibraryLibraryErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetGenresLibraryLibraryErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetGenresLibraryLibraryErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetGenresLibraryUnauthorized - Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
type GetGenresLibraryUnauthorized struct {
Errors []GetGenresLibraryLibraryErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetGenresLibraryUnauthorized{}
func (e *GetGenresLibraryUnauthorized) Error() string {
data, _ := json.Marshal(e)
return string(data)
}
type GetGenresLibraryErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetGenresLibraryErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetGenresLibraryErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetGenresLibraryErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetGenresLibraryBadRequest - Bad Request - A parameter was not specified, or was specified incorrectly.
type GetGenresLibraryBadRequest struct {
Errors []GetGenresLibraryErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetGenresLibraryBadRequest{}
func (e *GetGenresLibraryBadRequest) Error() string {
data, _ := json.Marshal(e)
return string(data)
}

View File

@@ -0,0 +1,90 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package sdkerrors
import (
"encoding/json"
"net/http"
)
type GetUsersUsersErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetUsersUsersErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetUsersUsersErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetUsersUsersErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetUsersUnauthorized - Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
type GetUsersUnauthorized struct {
Errors []GetUsersUsersErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetUsersUnauthorized{}
func (e *GetUsersUnauthorized) Error() string {
data, _ := json.Marshal(e)
return string(data)
}
type GetUsersErrors struct {
Code *int `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *int `json:"status,omitempty"`
}
func (o *GetUsersErrors) GetCode() *int {
if o == nil {
return nil
}
return o.Code
}
func (o *GetUsersErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetUsersErrors) GetStatus() *int {
if o == nil {
return nil
}
return o.Status
}
// GetUsersBadRequest - Bad Request - A parameter was not specified, or was specified incorrectly.
type GetUsersBadRequest struct {
Errors []GetUsersErrors `json:"errors,omitempty"`
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response `json:"-"`
}
var _ error = &GetUsersBadRequest{}
func (e *GetUsersBadRequest) Error() string {
data, _ := json.Marshal(e)
return string(data)
}

View File

@@ -154,6 +154,7 @@ type PlexAPI struct {
// Updates to the status can be observed via the Event API.
//
Updater *Updater
Users *Users
sdkConfiguration sdkConfiguration
}
@@ -298,9 +299,9 @@ func New(opts ...SDKOption) *PlexAPI {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.17.2",
GenVersion: "2.496.0",
UserAgent: "speakeasy-sdk/go 0.17.2 2.496.0 0.0.3 github.com/LukeHagar/plexgo",
SDKVersion: "0.18.0",
GenVersion: "2.506.0",
UserAgent: "speakeasy-sdk/go 0.18.0 2.506.0 0.0.3 github.com/LukeHagar/plexgo",
ServerDefaults: []map[string]string{
{
"protocol": "https",
@@ -359,5 +360,7 @@ func New(opts ...SDKOption) *PlexAPI {
sdk.Updater = newUpdater(sdk.sdkConfiguration)
sdk.Users = newUsers(sdk.sdkConfiguration)
return sdk
}

View File

@@ -712,15 +712,15 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight,
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
case httpRes.StatusCode == 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err

262
users.go Normal file
View File

@@ -0,0 +1,262 @@
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package plexgo
import (
"bytes"
"context"
"fmt"
"github.com/LukeHagar/plexgo/internal/hooks"
"github.com/LukeHagar/plexgo/internal/utils"
"github.com/LukeHagar/plexgo/models/operations"
"github.com/LukeHagar/plexgo/models/sdkerrors"
"github.com/LukeHagar/plexgo/retry"
"net/http"
"net/url"
)
type Users struct {
sdkConfiguration sdkConfiguration
}
func newUsers(sdkConfig sdkConfiguration) *Users {
return &Users{
sdkConfiguration: sdkConfig,
}
}
// GetUsers - Get list of all connected users
// Get list of all users that are friends and have library access with the provided Plex authentication token
func (s *Users) GetUsers(ctx context.Context, request operations.GetUsersRequest, opts ...operations.Option) (*operations.GetUsersResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "get-users",
OAuth2Scopes: []string{},
SecuritySource: nil,
}
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
operations.SupportedOptionTimeout,
}
for _, opt := range opts {
if err := opt(&o, supportedOptions...); err != nil {
return nil, fmt.Errorf("error applying option: %w", err)
}
}
baseURL := utils.ReplaceParameters(operations.GetUsersServerList[0], map[string]string{})
if o.ServerURL != nil {
baseURL = *o.ServerURL
}
opURL, err := url.JoinPath(baseURL, "/users")
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
timeout := o.Timeout
if timeout == nil {
timeout = s.sdkConfiguration.Timeout
}
if timeout != nil {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, *timeout)
defer cancel()
}
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/xml")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
utils.PopulateHeaders(ctx, req, request, nil)
for k, v := range o.SetHeaders {
req.Header.Set(k, v)
}
globalRetryConfig := s.sdkConfiguration.RetryConfig
retryConfig := o.Retries
if retryConfig == nil {
if globalRetryConfig != nil {
retryConfig = globalRetryConfig
}
}
var httpRes *http.Response
if retryConfig != nil {
httpRes, err = utils.Retry(ctx, utils.Retries{
Config: retryConfig,
StatusCodes: []string{
"429",
"500",
"502",
"503",
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
}
return nil, retry.Permanent(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 httpRes, err
})
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
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.GetUsersResponse{
StatusCode: httpRes.StatusCode,
ContentType: httpRes.Header.Get("Content-Type"),
RawResponse: httpRes,
}
switch {
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/xml`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
res.Body = rawBody
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
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:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetUsersBadRequest
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
var out sdkerrors.GetUsersUnauthorized
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
out.RawResponse = httpRes
return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
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:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}