From 6db5d8fb30ea93521aaed72368e04a67e176416a Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 6 Feb 2025 00:10:27 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.484.1 --- .speakeasy/gen.lock | 58 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 14 +- README.md | 2 + RELEASES.md | 12 +- codeSamples.yaml | 34 +- .../getcountrieslibrarydirectory.md | 10 + .../getcountrieslibrarymediacontainer.md | 22 + .../operations/getcountrieslibraryrequest.md | 8 + .../operations/getcountrieslibraryresponse.md | 11 + .../getcountrieslibraryresponsebody.md | 10 + .../operations/getgenreslibrarydirectory.md | 11 + .../getgenreslibrarymediacontainer.md | 22 + .../operations/getgenreslibraryrequest.md | 8 + .../operations/getgenreslibraryresponse.md | 11 + .../getgenreslibraryresponsebody.md | 10 + .../getrecentlyaddedmediacontainer.md | 2 +- .../getcountrieslibrarybadrequest.md | 11 + .../sdkerrors/getcountrieslibraryerrors.md | 10 + .../getcountrieslibrarylibraryerrors.md | 10 + .../getcountrieslibraryunauthorized.md | 11 + .../sdkerrors/getgenreslibrarybadrequest.md | 11 + .../sdkerrors/getgenreslibraryerrors.md | 10 + .../getgenreslibrarylibraryerrors.md | 10 + .../sdkerrors/getgenreslibraryunauthorized.md | 11 + docs/sdks/authentication/README.md | 1 - docs/sdks/hubs/README.md | 3 - docs/sdks/library/README.md | 120 ++++- docs/sdks/plex/README.md | 4 +- docs/sdks/search/README.md | 4 +- docs/sdks/watchlist/README.md | 2 - library.go | 500 ++++++++++++++++++ models/operations/getcountrieslibrary.go | 222 ++++++++ models/operations/getgenreslibrary.go | 230 ++++++++ models/sdkerrors/getcountrieslibrary.go | 90 ++++ models/sdkerrors/getgenreslibrary.go | 90 ++++ plexapi.go | 6 +- updater.go | 8 +- 38 files changed, 1555 insertions(+), 56 deletions(-) create mode 100644 docs/models/operations/getcountrieslibrarydirectory.md create mode 100644 docs/models/operations/getcountrieslibrarymediacontainer.md create mode 100644 docs/models/operations/getcountrieslibraryrequest.md create mode 100644 docs/models/operations/getcountrieslibraryresponse.md create mode 100644 docs/models/operations/getcountrieslibraryresponsebody.md create mode 100644 docs/models/operations/getgenreslibrarydirectory.md create mode 100644 docs/models/operations/getgenreslibrarymediacontainer.md create mode 100644 docs/models/operations/getgenreslibraryrequest.md create mode 100644 docs/models/operations/getgenreslibraryresponse.md create mode 100644 docs/models/operations/getgenreslibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getcountrieslibrarybadrequest.md create mode 100644 docs/models/sdkerrors/getcountrieslibraryerrors.md create mode 100644 docs/models/sdkerrors/getcountrieslibrarylibraryerrors.md create mode 100644 docs/models/sdkerrors/getcountrieslibraryunauthorized.md create mode 100644 docs/models/sdkerrors/getgenreslibrarybadrequest.md create mode 100644 docs/models/sdkerrors/getgenreslibraryerrors.md create mode 100644 docs/models/sdkerrors/getgenreslibrarylibraryerrors.md create mode 100644 docs/models/sdkerrors/getgenreslibraryunauthorized.md create mode 100644 models/operations/getcountrieslibrary.go create mode 100644 models/operations/getgenreslibrary.go create mode 100644 models/sdkerrors/getcountrieslibrary.go create mode 100644 models/sdkerrors/getgenreslibrary.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9c06bf1..22b4865 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 management: - docChecksum: a643a64d282d705e3e24f61ed6f068c6 + docChecksum: 14b35829d4be91a88269761c3ed01426 docVersion: 0.0.3 - speakeasyVersion: 1.476.2 - generationVersion: 2.495.1 - releaseVersion: 0.17.3 - configChecksum: b217b6f314764baeb1666f2a287fd80a + speakeasyVersion: 1.484.1 + generationVersion: 2.503.2 + releaseVersion: 0.17.4 + configChecksum: 03b930c277a60bb2913235285cab5b77 repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -15,7 +15,7 @@ features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.6 - core: 3.6.9 + core: 3.6.12 defaultEnabledRetries: 0.2.0 deprecations: 2.81.2 downloadStreams: 0.1.2 @@ -52,8 +52,10 @@ generatedFiles: - /models/operations/getbannerimage.go - /models/operations/getbutlertasks.go - /models/operations/getcompanionsdata.go + - /models/operations/getcountrieslibrary.go - /models/operations/getdevices.go - /models/operations/getfilehash.go + - /models/operations/getgenreslibrary.go - /models/operations/getgeodata.go - /models/operations/getglobalhubs.go - /models/operations/gethomedata.go @@ -128,8 +130,10 @@ generatedFiles: - /models/sdkerrors/getbannerimage.go - /models/sdkerrors/getbutlertasks.go - /models/sdkerrors/getcompanionsdata.go + - /models/sdkerrors/getcountrieslibrary.go - /models/sdkerrors/getdevices.go - /models/sdkerrors/getfilehash.go + - /models/sdkerrors/getgenreslibrary.go - /models/sdkerrors/getgeodata.go - /models/sdkerrors/getglobalhubs.go - /models/sdkerrors/gethomedata.go @@ -266,11 +270,21 @@ generatedFiles: - docs/models/operations/getbutlertasksresponse.md - docs/models/operations/getbutlertasksresponsebody.md - docs/models/operations/getcompanionsdataresponse.md + - docs/models/operations/getcountrieslibrarydirectory.md + - docs/models/operations/getcountrieslibrarymediacontainer.md + - docs/models/operations/getcountrieslibraryrequest.md + - docs/models/operations/getcountrieslibraryresponse.md + - docs/models/operations/getcountrieslibraryresponsebody.md - docs/models/operations/getdevicesmediacontainer.md - docs/models/operations/getdevicesresponse.md - docs/models/operations/getdevicesresponsebody.md - docs/models/operations/getfilehashrequest.md - docs/models/operations/getfilehashresponse.md + - docs/models/operations/getgenreslibrarydirectory.md + - docs/models/operations/getgenreslibrarymediacontainer.md + - docs/models/operations/getgenreslibraryrequest.md + - docs/models/operations/getgenreslibraryresponse.md + - docs/models/operations/getgenreslibraryresponsebody.md - docs/models/operations/getgeodatageodata.md - docs/models/operations/getgeodataresponse.md - docs/models/operations/getglobalhubsmediacontainer.md @@ -758,6 +772,10 @@ generatedFiles: - docs/models/sdkerrors/getcompanionsdataerrors.md - docs/models/sdkerrors/getcompanionsdataplexerrors.md - docs/models/sdkerrors/getcompanionsdataunauthorized.md + - docs/models/sdkerrors/getcountrieslibrarybadrequest.md + - docs/models/sdkerrors/getcountrieslibraryerrors.md + - docs/models/sdkerrors/getcountrieslibrarylibraryerrors.md + - docs/models/sdkerrors/getcountrieslibraryunauthorized.md - docs/models/sdkerrors/getdevicesbadrequest.md - docs/models/sdkerrors/getdeviceserrors.md - docs/models/sdkerrors/getdevicesservererrors.md @@ -766,6 +784,10 @@ generatedFiles: - docs/models/sdkerrors/getfilehasherrors.md - docs/models/sdkerrors/getfilehashlibraryerrors.md - docs/models/sdkerrors/getfilehashunauthorized.md + - docs/models/sdkerrors/getgenreslibrarybadrequest.md + - docs/models/sdkerrors/getgenreslibraryerrors.md + - docs/models/sdkerrors/getgenreslibrarylibraryerrors.md + - docs/models/sdkerrors/getgenreslibraryunauthorized.md - docs/models/sdkerrors/getgeodatabadrequest.md - docs/models/sdkerrors/getgeodataerrors.md - docs/models/sdkerrors/getgeodataplexerrors.md @@ -2031,5 +2053,29 @@ examples: application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} "401": application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}]} + get-genres-library: + speakeasy-default-get-genres-library: + parameters: + path: + sectionKey: 9518 + responses: + "200": + application/json: {"MediaContainer": {"size": 50, "identifier": "com.plexapp.plugins.library", "allowSync": false, "art": "/:/resources/show-fanart.jpg", "content": "secondary", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1734362201, "nocache": true, "thumb": "/:/resources/show.png", "title1": "TV Shows (Reality)", "title2": "By Genre", "viewGroup": "secondary", "Directory": [{"fastKey": "/library/sections/10/all?genre=89", "key": "89", "title": "Action", "type": "genre"}]}} + "400": + application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} + "401": + application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]} + get-countries-library: + speakeasy-default-get-countries-library: + parameters: + path: + sectionKey: 9518 + responses: + "200": + application/json: {"MediaContainer": {"size": 50, "identifier": "com.plexapp.plugins.library", "allowSync": false, "art": "/:/resources/show-fanart.jpg", "content": "secondary", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1734362201, "nocache": true, "thumb": "/:/resources/show.png", "title1": "TV Series", "title2": "By Country", "viewGroup": "secondary", "Directory": [{"fastKey": "/library/sections/2/all?country=15491", "key": "15491", "title": "Japan"}]}} + "400": + application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} + "401": + application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]} examplesVersion: 1.0.0 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 33c4eda..b6261c2 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false go: - version: 0.17.3 + version: 0.17.4 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 930f409..cda5ed4 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.476.2 +speakeasyVersion: 1.484.1 sources: my-source: sourceNamespace: my-source @@ -9,19 +9,19 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:e73707dfae50d22dab2166b1661938446b9831bcee252ecd696a1172dfd6ae2c - sourceBlobDigest: sha256:e06caa091ad527fd21714fc0d43e7ea385e181fbad8c4f60296457a89a23c696 + sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 + sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 tags: - latest - - speakeasy-sdk-regen-1738022950 + - speakeasy-sdk-regen-1738800558 targets: plexgo: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:e73707dfae50d22dab2166b1661938446b9831bcee252ecd696a1172dfd6ae2c - sourceBlobDigest: sha256:e06caa091ad527fd21714fc0d43e7ea385e181fbad8c4f60296457a89a23c696 + sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 + sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 codeSamplesNamespace: code-samples-go-plexgo - codeSamplesRevisionDigest: sha256:d074910cd257c690cd88b954cb7adc3401529828c1a9b0b79a96d1fe780cab97 + codeSamplesRevisionDigest: sha256:56fbdcee207bdfb0340ee02eaeacfb389357affe2899881837f41fa2b7b5b043 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index eb6a15a..191916d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/RELEASES.md b/RELEASES.md index e7b16fb..b6c9619 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1012,4 +1012,14 @@ Based on: ### Generated - [go v0.17.3] . ### Releases -- [Go v0.17.3] https://github.com/LukeHagar/plexgo/releases/tag/v0.17.3 - . \ No newline at end of file +- [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 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 5a24284..ba62cb0 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"\",\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(\"\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"\",\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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(\"\"),\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: @@ -452,7 +464,7 @@ actions: 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: diff --git a/docs/models/operations/getcountrieslibrarydirectory.md b/docs/models/operations/getcountrieslibrarydirectory.md new file mode 100644 index 0000000..eb1ad5b --- /dev/null +++ b/docs/models/operations/getcountrieslibrarydirectory.md @@ -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 | \ No newline at end of file diff --git a/docs/models/operations/getcountrieslibrarymediacontainer.md b/docs/models/operations/getcountrieslibrarymediacontainer.md new file mode 100644 index 0000000..80aa306 --- /dev/null +++ b/docs/models/operations/getcountrieslibrarymediacontainer.md @@ -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 | | \ No newline at end of file diff --git a/docs/models/operations/getcountrieslibraryrequest.md b/docs/models/operations/getcountrieslibraryrequest.md new file mode 100644 index 0000000..02d887f --- /dev/null +++ b/docs/models/operations/getcountrieslibraryrequest.md @@ -0,0 +1,8 @@ +# GetCountriesLibraryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | \ No newline at end of file diff --git a/docs/models/operations/getcountrieslibraryresponse.md b/docs/models/operations/getcountrieslibraryresponse.md new file mode 100644 index 0000000..7a08396 --- /dev/null +++ b/docs/models/operations/getcountrieslibraryresponse.md @@ -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. | \ No newline at end of file diff --git a/docs/models/operations/getcountrieslibraryresponsebody.md b/docs/models/operations/getcountrieslibraryresponsebody.md new file mode 100644 index 0000000..d567961 --- /dev/null +++ b/docs/models/operations/getcountrieslibraryresponsebody.md @@ -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 | \ No newline at end of file diff --git a/docs/models/operations/getgenreslibrarydirectory.md b/docs/models/operations/getgenreslibrarydirectory.md new file mode 100644 index 0000000..dccf938 --- /dev/null +++ b/docs/models/operations/getgenreslibrarydirectory.md @@ -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 | \ No newline at end of file diff --git a/docs/models/operations/getgenreslibrarymediacontainer.md b/docs/models/operations/getgenreslibrarymediacontainer.md new file mode 100644 index 0000000..83c7599 --- /dev/null +++ b/docs/models/operations/getgenreslibrarymediacontainer.md @@ -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 | | \ No newline at end of file diff --git a/docs/models/operations/getgenreslibraryrequest.md b/docs/models/operations/getgenreslibraryrequest.md new file mode 100644 index 0000000..0339a04 --- /dev/null +++ b/docs/models/operations/getgenreslibraryrequest.md @@ -0,0 +1,8 @@ +# GetGenresLibraryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | \ No newline at end of file diff --git a/docs/models/operations/getgenreslibraryresponse.md b/docs/models/operations/getgenreslibraryresponse.md new file mode 100644 index 0000000..5cee803 --- /dev/null +++ b/docs/models/operations/getgenreslibraryresponse.md @@ -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. | \ No newline at end of file diff --git a/docs/models/operations/getgenreslibraryresponsebody.md b/docs/models/operations/getgenreslibraryresponsebody.md new file mode 100644 index 0000000..746ec4d --- /dev/null +++ b/docs/models/operations/getgenreslibraryresponsebody.md @@ -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 | \ No newline at end of file diff --git a/docs/models/operations/getrecentlyaddedmediacontainer.md b/docs/models/operations/getrecentlyaddedmediacontainer.md index 86c9268..94e59dd 100644 --- a/docs/models/operations/getrecentlyaddedmediacontainer.md +++ b/docs/models/operations/getrecentlyaddedmediacontainer.md @@ -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`.
| | | `Metadata` | [][operations.GetRecentlyAddedMetadata](../../models/operations/getrecentlyaddedmetadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcountrieslibrarybadrequest.md b/docs/models/sdkerrors/getcountrieslibrarybadrequest.md new file mode 100644 index 0000000..bfe733d --- /dev/null +++ b/docs/models/sdkerrors/getcountrieslibrarybadrequest.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcountrieslibraryerrors.md b/docs/models/sdkerrors/getcountrieslibraryerrors.md new file mode 100644 index 0000000..961f35c --- /dev/null +++ b/docs/models/sdkerrors/getcountrieslibraryerrors.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcountrieslibrarylibraryerrors.md b/docs/models/sdkerrors/getcountrieslibrarylibraryerrors.md new file mode 100644 index 0000000..e47a155 --- /dev/null +++ b/docs/models/sdkerrors/getcountrieslibrarylibraryerrors.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcountrieslibraryunauthorized.md b/docs/models/sdkerrors/getcountrieslibraryunauthorized.md new file mode 100644 index 0000000..d905053 --- /dev/null +++ b/docs/models/sdkerrors/getcountrieslibraryunauthorized.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getgenreslibrarybadrequest.md b/docs/models/sdkerrors/getgenreslibrarybadrequest.md new file mode 100644 index 0000000..f26c93e --- /dev/null +++ b/docs/models/sdkerrors/getgenreslibrarybadrequest.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getgenreslibraryerrors.md b/docs/models/sdkerrors/getgenreslibraryerrors.md new file mode 100644 index 0000000..6439248 --- /dev/null +++ b/docs/models/sdkerrors/getgenreslibraryerrors.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getgenreslibrarylibraryerrors.md b/docs/models/sdkerrors/getgenreslibrarylibraryerrors.md new file mode 100644 index 0000000..6e8ccb0 --- /dev/null +++ b/docs/models/sdkerrors/getgenreslibrarylibraryerrors.md @@ -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 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getgenreslibraryunauthorized.md b/docs/models/sdkerrors/getgenreslibraryunauthorized.md new file mode 100644 index 0000000..3c8e1d2 --- /dev/null +++ b/docs/models/sdkerrors/getgenreslibraryunauthorized.md @@ -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 | \ No newline at end of file diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index 89aadef..2ebe8c8 100644 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -203,7 +203,6 @@ func main() { RequestBody: &operations.PostUsersSignInDataRequestBody{ Login: "username@email.com", Password: "password123", - RememberMe: plexgo.Bool(false), VerificationCode: plexgo.String("123456"), }, }) diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index 4506eba..30fbd66 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -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) diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 8d1f56f..2e55356 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -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(""), ) - 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(""), + ) + + 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.
Note: This is unique in the context of the Plex server.
| 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(""), + ) + + 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.
Note: This is unique in the context of the Plex server.
| 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) diff --git a/docs/sdks/plex/README.md b/docs/sdks/plex/README.md index 55c94de..9dc0936 100644 --- a/docs/sdks/plex/README.md +++ b/docs/sdks/plex/README.md @@ -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(""), ) - 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"), diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 1aea0d6..288b831 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -46,7 +46,7 @@ func main() { plexgo.WithSecurity(""), ) - 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(""), ) - 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) } diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index 8bf63e1..578b30b 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -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 { diff --git a/library.go b/library.go index 397d80f..8ecb4d5 100644 --- a/library.go +++ b/library.go @@ -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) { diff --git a/models/operations/getcountrieslibrary.go b/models/operations/getcountrieslibrary.go new file mode 100644 index 0000000..7b0d8a6 --- /dev/null +++ b/models/operations/getcountrieslibrary.go @@ -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 +} diff --git a/models/operations/getgenreslibrary.go b/models/operations/getgenreslibrary.go new file mode 100644 index 0000000..b4a99a2 --- /dev/null +++ b/models/operations/getgenreslibrary.go @@ -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 +} diff --git a/models/sdkerrors/getcountrieslibrary.go b/models/sdkerrors/getcountrieslibrary.go new file mode 100644 index 0000000..fd4dc11 --- /dev/null +++ b/models/sdkerrors/getcountrieslibrary.go @@ -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) +} diff --git a/models/sdkerrors/getgenreslibrary.go b/models/sdkerrors/getgenreslibrary.go new file mode 100644 index 0000000..eecdf9a --- /dev/null +++ b/models/sdkerrors/getgenreslibrary.go @@ -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) +} diff --git a/plexapi.go b/plexapi.go index afcd989..ee467f7 100644 --- a/plexapi.go +++ b/plexapi.go @@ -298,9 +298,9 @@ func New(opts ...SDKOption) *PlexAPI { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.3", - SDKVersion: "0.17.3", - GenVersion: "2.495.1", - UserAgent: "speakeasy-sdk/go 0.17.3 2.495.1 0.0.3 github.com/LukeHagar/plexgo", + SDKVersion: "0.17.4", + GenVersion: "2.503.2", + UserAgent: "speakeasy-sdk/go 0.17.4 2.503.2 0.0.3 github.com/LukeHagar/plexgo", ServerDefaults: []map[string]string{ { "protocol": "https", diff --git a/updater.go b/updater.go index 9b85226..2aedc5e 100644 --- a/updater.go +++ b/updater.go @@ -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