From 720b953e9b428566cf24b7e89592b0bd6862e716 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 23 May 2024 15:58:07 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.295.1 --- .speakeasy/gen.lock | 14 +- .speakeasy/gen.yaml | 5 +- .speakeasy/workflow.lock | 15 +- .speakeasy/workflow.yaml | 2 + README.md | 2 +- RELEASES.md | 12 +- docs/index.md | 2 +- examples/provider/provider.tf | 2 +- go.mod | 2 +- internal/sdk/activities.go | 2 + internal/sdk/authentication.go | 2 + internal/sdk/butler.go | 5 + internal/sdk/hubs.go | 2 + internal/sdk/internal/utils/headers.go | 3 +- internal/sdk/internal/utils/pathparams.go | 3 +- internal/sdk/internal/utils/queryparams.go | 3 +- internal/sdk/internal/utils/security.go | 4 + internal/sdk/internal/utils/utils.go | 7 + internal/sdk/library.go | 147 ++- internal/sdk/log.go | 3 + internal/sdk/media.go | 3 + .../sdk/models/operations/applyupdates.go | 2 - .../sdk/models/operations/checkforupdates.go | 1 - .../sdk/models/operations/createplaylist.go | 2 - .../sdk/models/operations/getglobalhubs.go | 1 - internal/sdk/models/operations/getlibrary.go | 1 - .../sdk/models/operations/getlibraryhubs.go | 1 - .../sdk/models/operations/getlibraryitems.go | 1039 +++++++++++++++++ .../sdk/models/operations/getplaylists.go | 2 - .../sdk/models/operations/getresizedphoto.go | 2 - internal/sdk/models/operations/gettimeline.go | 1 - .../models/operations/gettransienttoken.go | 2 - internal/sdk/models/operations/logline.go | 1 - .../sdk/models/operations/searchlibrary.go | 55 +- internal/sdk/models/operations/starttask.go | 1 - internal/sdk/models/operations/stoptask.go | 1 - .../sdk/models/operations/uploadplaylist.go | 1 - internal/sdk/playlists.go | 9 + internal/sdk/plex.go | 2 + internal/sdk/plexapi.go | 13 +- internal/sdk/search.go | 3 + internal/sdk/server.go | 8 + internal/sdk/sessions.go | 4 + internal/sdk/statistics.go | 1 + internal/sdk/updater.go | 3 + internal/sdk/video.go | 2 + 46 files changed, 1343 insertions(+), 55 deletions(-) create mode 100644 internal/sdk/models/operations/getlibraryitems.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 90c2f38..40994e7 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: e742591b-391d-4f4e-8484-d01a093b32ec management: - docChecksum: 543cb95355401d2e3c2ba11a50d9dd94 + docChecksum: 911d74baa0d06121d2ce2c71d94e977a docVersion: 0.0.3 - speakeasyVersion: 1.285.0 - generationVersion: 2.326.3 - releaseVersion: 0.14.0 - configChecksum: 2c6e8190ee0aa4e41bd653129a33e169 + speakeasyVersion: 1.295.1 + generationVersion: 2.335.5 + releaseVersion: 0.15.0 + configChecksum: 918c48da4bd2da76e996dcde2db696ba repoURL: https://github.com/LukeHagar/plexterraform.git repoSubDirectory: . published: true @@ -14,13 +14,12 @@ features: terraform: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.4 - core: 3.20.0 + core: 3.21.0 globalSecurity: 2.81.6 globalServerURLs: 2.82.1 globals: 2.82.1 methodServerURLs: 2.82.1 nameOverrides: 2.81.2 - unions: 2.81.12 generatedFiles: - internal/sdk/server.go - internal/sdk/media.go @@ -85,6 +84,7 @@ generatedFiles: - internal/sdk/models/operations/getlibraries.go - internal/sdk/models/operations/getlibrary.go - internal/sdk/models/operations/deletelibrary.go + - internal/sdk/models/operations/getlibraryitems.go - internal/sdk/models/operations/refreshlibrary.go - internal/sdk/models/operations/searchlibrary.go - internal/sdk/models/operations/getmetadata.go diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f51ab48..a790279 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,8 +12,11 @@ generation: auth: oAuth2ClientCredentialsEnabled: false terraform: - version: 0.14.0 + version: 0.15.0 + additionalDataSources: [] additionalDependencies: {} + additionalResources: [] + allowUnknownFieldsInWeakUnions: false author: LukeHagar environmentVariables: [] imports: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2461025..2e513f9 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,18 @@ -speakeasyVersion: 1.285.0 +speakeasyVersion: 1.295.1 sources: - my-source: {} + my-source: + sourceNamespace: my-source + sourceRevisionDigest: sha256:60df3251f413e288ee3d938dc82cccfb7dd7bfdde2dee5e7a014e806f91250bd + sourceBlobDigest: sha256:9864585de73bd6d332127cdb3868c1814936cb60a877f7b3c9b79cdc42233ae6 + tags: + - latest + - main targets: plexterraform: source: my-source + sourceNamespace: my-source + sourceRevisionDigest: sha256:60df3251f413e288ee3d938dc82cccfb7dd7bfdde2dee5e7a014e806f91250bd + sourceBlobDigest: sha256:9864585de73bd6d332127cdb3868c1814936cb60a877f7b3c9b79cdc42233ae6 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 @@ -12,6 +21,8 @@ workflow: my-source: inputs: - location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml + registry: + location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source targets: plexterraform: target: terraform diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 94bc9dd..86aac4f 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -4,6 +4,8 @@ sources: my-source: inputs: - location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml + registry: + location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source targets: plexterraform: target: terraform diff --git a/README.md b/README.md index ee294dd..4daa499 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ terraform { required_providers { PlexAPI = { source = "LukeHagar/PlexAPI" - version = "0.14.0" + version = "0.15.0" } } } diff --git a/RELEASES.md b/RELEASES.md index e91c7ad..40e7219 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -262,4 +262,14 @@ Based on: ### Generated - [terraform v0.14.0] . ### Releases -- [Terraform v0.14.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.14.0 - . \ No newline at end of file +- [Terraform v0.14.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.14.0 - . + +## 2024-05-23 15:56:57 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.295.1 (2.335.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [terraform v0.15.0] . +### Releases +- [Terraform v0.15.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.15.0 - . \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 1ca9c27..46db654 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { PlexAPI = { source = "LukeHagar/PlexAPI" - version = "0.14.0" + version = "0.15.0" } } } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 10636c4..525b26d 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { PlexAPI = { source = "LukeHagar/PlexAPI" - version = "0.14.0" + version = "0.15.0" } } } diff --git a/go.mod b/go.mod index bdf164d..b537ce0 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/LukeHagar/terraform-provider-PlexAPI go 1.21 -toolchain go1.21.9 +toolchain go1.21.10 require ( github.com/cenkalti/backoff/v4 v4.2.0 diff --git a/internal/sdk/activities.go b/internal/sdk/activities.go index befa27e..f1bb3e6 100644 --- a/internal/sdk/activities.go +++ b/internal/sdk/activities.go @@ -132,6 +132,7 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe } return res, nil + } // CancelServerActivities - Cancel Server Activities @@ -224,4 +225,5 @@ func (s *Activities) CancelServerActivities(ctx context.Context, request operati } return res, nil + } diff --git a/internal/sdk/authentication.go b/internal/sdk/authentication.go index 60ac331..fcf7e6f 100644 --- a/internal/sdk/authentication.go +++ b/internal/sdk/authentication.go @@ -120,6 +120,7 @@ func (s *Authentication) GetTransientToken(ctx context.Context, request operatio } return res, nil + } // GetSourceConnectionInformation - Get Source Connection Information @@ -217,4 +218,5 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, req } return res, nil + } diff --git a/internal/sdk/butler.go b/internal/sdk/butler.go index e3bbfb2..5e2b869 100644 --- a/internal/sdk/butler.go +++ b/internal/sdk/butler.go @@ -126,6 +126,7 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks } return res, nil + } // StartAllTasks - Start all Butler tasks @@ -222,6 +223,7 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe } return res, nil + } // StopAllTasks - Stop all Butler tasks @@ -314,6 +316,7 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp } return res, nil + } // StartTask - Start a single Butler task @@ -412,6 +415,7 @@ func (s *Butler) StartTask(ctx context.Context, request operations.StartTaskRequ } return res, nil + } // StopTask - Stop a single Butler task @@ -506,4 +510,5 @@ func (s *Butler) StopTask(ctx context.Context, request operations.StopTaskReques } return res, nil + } diff --git a/internal/sdk/hubs.go b/internal/sdk/hubs.go index 4a0d5e6..2c63642 100644 --- a/internal/sdk/hubs.go +++ b/internal/sdk/hubs.go @@ -130,6 +130,7 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, request operations.GetGlobalHu } return res, nil + } // GetLibraryHubs - Get library specific hubs @@ -236,4 +237,5 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, request operations.GetLibrary } return res, nil + } diff --git a/internal/sdk/internal/utils/headers.go b/internal/sdk/internal/utils/headers.go index 0249876..107d210 100644 --- a/internal/sdk/internal/utils/headers.go +++ b/internal/sdk/internal/utils/headers.go @@ -18,8 +18,7 @@ func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, } func populateHeaders(headers interface{}, globals interface{}, reqHeaders http.Header, skipFields []string) []string { - headerParamsStructType := reflect.TypeOf(headers) - headerParamsValType := reflect.ValueOf(headers) + headerParamsStructType, headerParamsValType := dereferencePointers(reflect.TypeOf(headers), reflect.ValueOf(headers)) globalsAlreadyPopulated := []string{} diff --git a/internal/sdk/internal/utils/pathparams.go b/internal/sdk/internal/utils/pathparams.go index 89bb5cd..80103ae 100644 --- a/internal/sdk/internal/utils/pathparams.go +++ b/internal/sdk/internal/utils/pathparams.go @@ -38,8 +38,7 @@ func GenerateURL(_ context.Context, serverURL, path string, pathParams interface } func populateParsedParameters(pathParams interface{}, globals interface{}, parsedParameters map[string]string, skipFields []string) ([]string, error) { - pathParamsStructType := reflect.TypeOf(pathParams) - pathParamsValType := reflect.ValueOf(pathParams) + pathParamsStructType, pathParamsValType := dereferencePointers(reflect.TypeOf(pathParams), reflect.ValueOf(pathParams)) globalsAlreadyPopulated := []string{} diff --git a/internal/sdk/internal/utils/queryparams.go b/internal/sdk/internal/utils/queryparams.go index 8d1bf47..e2c5b9d 100644 --- a/internal/sdk/internal/utils/queryparams.go +++ b/internal/sdk/internal/utils/queryparams.go @@ -32,8 +32,7 @@ func PopulateQueryParams(_ context.Context, req *http.Request, queryParams inter } func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { - queryParamsStructType := reflect.TypeOf(queryParams) - queryParamsValType := reflect.ValueOf(queryParams) + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) globalsAlreadyPopulated := []string{} diff --git a/internal/sdk/internal/utils/security.go b/internal/sdk/internal/utils/security.go index 8023225..f7abb69 100644 --- a/internal/sdk/internal/utils/security.go +++ b/internal/sdk/internal/utils/security.go @@ -196,6 +196,10 @@ func handleBasicAuthScheme(headers map[string]string, scheme interface{}) { fieldType := schemeStructType.Field(i) valType := schemeValType.Field(i) + if fieldType.Type.Kind() == reflect.Ptr { + valType = valType.Elem() + } + secTag := parseSecurityTag(fieldType) if secTag == nil || secTag.Name == "" { continue diff --git a/internal/sdk/internal/utils/utils.go b/internal/sdk/internal/utils/utils.go index a35dc9b..eab3682 100644 --- a/internal/sdk/internal/utils/utils.go +++ b/internal/sdk/internal/utils/utils.go @@ -3,6 +3,7 @@ package utils import ( + "context" "fmt" "io" "math/big" @@ -87,6 +88,12 @@ func MatchStatusCodes(expectedCodes []string, statusCode int) bool { return false } +func AsSecuritySource(security interface{}) func(context.Context) (interface{}, error) { + return func(context.Context) (interface{}, error) { + return security, nil + } +} + func parseStructTag(tagKey string, field reflect.StructField) map[string]string { tag := field.Tag.Get(tagKey) if tag == "" { diff --git a/internal/sdk/library.go b/internal/sdk/library.go index 9309d0b..0de4ea3 100644 --- a/internal/sdk/library.go +++ b/internal/sdk/library.go @@ -120,6 +120,7 @@ func (s *Library) GetFileHash(ctx context.Context, request operations.GetFileHas } return res, nil + } // GetRecentlyAdded - Get Recently Added @@ -222,6 +223,7 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently } return res, nil + } // GetLibraries - Get All Libraries @@ -329,6 +331,7 @@ func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesRes } return res, nil + } // GetLibrary - Get Library Details @@ -473,6 +476,7 @@ func (s *Library) GetLibrary(ctx context.Context, request operations.GetLibraryR } return res, nil + } // DeleteLibrary - Delete Library Section @@ -565,6 +569,129 @@ func (s *Library) DeleteLibrary(ctx context.Context, request operations.DeleteLi } return res, nil + +} + +// GetLibraryItems - Get Library Items +// Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: +// - `all`: All items in the section. +// - `unwatched`: Items that have not been played. +// - `newest`: Items that are recently released. +// - `recentlyAdded`: Items that are recently added to the library. +// - `recentlyViewed`: Items that were recently viewed. +// - `onDeck`: Items to continue watching. +// - `collection`: Items categorized by collection. +// - `edition`: Items categorized by edition. +// - `genre`: Items categorized by genre. +// - `year`: Items categorized by year of release. +// - `decade`: Items categorized by decade. +// - `director`: Items categorized by director. +// - `actor`: Items categorized by starring actor. +// - `country`: Items categorized by country of origin. +// - `contentRating`: Items categorized by content rating. +// - `rating`: Items categorized by rating. +// - `resolution`: Items categorized by resolution. +// - `firstCharacter`: Items categorized by the first letter. +// - `folder`: Items categorized by folder. +func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLibraryItemsRequest) (*operations.GetLibraryItemsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getLibraryItems", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/{tag}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, 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.GetLibraryItemsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetLibraryItemsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.TwoHundredApplicationJSONObject = &out + default: + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetLibraryItemsLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.FourHundredAndOneApplicationJSONObject = &out + default: + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + } // RefreshLibrary - Refresh Library @@ -657,6 +784,7 @@ func (s *Library) RefreshLibrary(ctx context.Context, request operations.Refresh } return res, nil + } // SearchLibrary - Search Library @@ -758,7 +886,20 @@ func (s *Library) SearchLibrary(ctx context.Context, request operations.SearchLi return nil, err } - res.Object = &out + res.TwoHundredApplicationJSONObject = &out + default: + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.SearchLibraryLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.FourHundredAndOneApplicationJSONObject = &out default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } @@ -767,6 +908,7 @@ func (s *Library) SearchLibrary(ctx context.Context, request operations.SearchLi } return res, nil + } // GetMetadata - Get Items Metadata @@ -869,6 +1011,7 @@ func (s *Library) GetMetadata(ctx context.Context, request operations.GetMetadat } return res, nil + } // GetMetadataChildren - Get Items Children @@ -971,6 +1114,7 @@ func (s *Library) GetMetadataChildren(ctx context.Context, request operations.Ge } return res, nil + } // GetOnDeck - Get On Deck @@ -1073,4 +1217,5 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, } return res, nil + } diff --git a/internal/sdk/log.go b/internal/sdk/log.go index 95cab8f..208ae76 100644 --- a/internal/sdk/log.go +++ b/internal/sdk/log.go @@ -120,6 +120,7 @@ func (s *Log) LogLine(ctx context.Context, request operations.LogLineRequest) (* } return res, nil + } // LogMultiLine - Logging a multi-line message @@ -238,6 +239,7 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log } return res, nil + } // EnablePaperTrail - Enabling Papertrail @@ -332,4 +334,5 @@ func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrai } return res, nil + } diff --git a/internal/sdk/media.go b/internal/sdk/media.go index 1c6de2c..1683893 100644 --- a/internal/sdk/media.go +++ b/internal/sdk/media.go @@ -120,6 +120,7 @@ func (s *Media) MarkPlayed(ctx context.Context, request operations.MarkPlayedReq } return res, nil + } // MarkUnplayed - Mark Media Unplayed @@ -216,6 +217,7 @@ func (s *Media) MarkUnplayed(ctx context.Context, request operations.MarkUnplaye } return res, nil + } // UpdatePlayProgress - Update Media Play Progress @@ -312,4 +314,5 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, request operations.Updat } return res, nil + } diff --git a/internal/sdk/models/operations/applyupdates.go b/internal/sdk/models/operations/applyupdates.go index c406738..3e47414 100644 --- a/internal/sdk/models/operations/applyupdates.go +++ b/internal/sdk/models/operations/applyupdates.go @@ -19,7 +19,6 @@ const ( func (e Tonight) ToPointer() *Tonight { return &e } - func (e *Tonight) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { @@ -47,7 +46,6 @@ const ( func (e Skip) ToPointer() *Skip { return &e } - func (e *Skip) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/checkforupdates.go b/internal/sdk/models/operations/checkforupdates.go index 3609613..e7ebfa6 100644 --- a/internal/sdk/models/operations/checkforupdates.go +++ b/internal/sdk/models/operations/checkforupdates.go @@ -19,7 +19,6 @@ const ( func (e Download) ToPointer() *Download { return &e } - func (e *Download) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/createplaylist.go b/internal/sdk/models/operations/createplaylist.go index b4db27d..442b543 100644 --- a/internal/sdk/models/operations/createplaylist.go +++ b/internal/sdk/models/operations/createplaylist.go @@ -20,7 +20,6 @@ const ( func (e QueryParamType) ToPointer() *QueryParamType { return &e } - func (e *QueryParamType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -50,7 +49,6 @@ const ( func (e Smart) ToPointer() *Smart { return &e } - func (e *Smart) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/getglobalhubs.go b/internal/sdk/models/operations/getglobalhubs.go index 26f5422..b9863c8 100644 --- a/internal/sdk/models/operations/getglobalhubs.go +++ b/internal/sdk/models/operations/getglobalhubs.go @@ -19,7 +19,6 @@ const ( func (e OnlyTransient) ToPointer() *OnlyTransient { return &e } - func (e *OnlyTransient) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/getlibrary.go b/internal/sdk/models/operations/getlibrary.go index bbe2025..595ecb2 100644 --- a/internal/sdk/models/operations/getlibrary.go +++ b/internal/sdk/models/operations/getlibrary.go @@ -21,7 +21,6 @@ const ( func (e IncludeDetails) ToPointer() *IncludeDetails { return &e } - func (e *IncludeDetails) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/getlibraryhubs.go b/internal/sdk/models/operations/getlibraryhubs.go index 75f26ec..0a74729 100644 --- a/internal/sdk/models/operations/getlibraryhubs.go +++ b/internal/sdk/models/operations/getlibraryhubs.go @@ -21,7 +21,6 @@ const ( func (e QueryParamOnlyTransient) ToPointer() *QueryParamOnlyTransient { return &e } - func (e *QueryParamOnlyTransient) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/getlibraryitems.go b/internal/sdk/models/operations/getlibraryitems.go new file mode 100644 index 0000000..bcf61ce --- /dev/null +++ b/internal/sdk/models/operations/getlibraryitems.go @@ -0,0 +1,1039 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils" + "github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/types" + "net/http" +) + +// Tag - A key representing a specific tag within the section. +type Tag string + +const ( + TagAll Tag = "all" + TagUnwatched Tag = "unwatched" + TagNewest Tag = "newest" + TagRecentlyAdded Tag = "recentlyAdded" + TagRecentlyViewed Tag = "recentlyViewed" + TagOnDeck Tag = "onDeck" + TagCollection Tag = "collection" + TagEdition Tag = "edition" + TagGenre Tag = "genre" + TagYear Tag = "year" + TagDecade Tag = "decade" + TagDirector Tag = "director" + TagActor Tag = "actor" + TagCountry Tag = "country" + TagContentRating Tag = "contentRating" + TagRating Tag = "rating" + TagResolution Tag = "resolution" + TagFirstCharacter Tag = "firstCharacter" + TagFolder Tag = "folder" +) + +func (e Tag) ToPointer() *Tag { + return &e +} +func (e *Tag) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "all": + fallthrough + case "unwatched": + fallthrough + case "newest": + fallthrough + case "recentlyAdded": + fallthrough + case "recentlyViewed": + fallthrough + case "onDeck": + fallthrough + case "collection": + fallthrough + case "edition": + fallthrough + case "genre": + fallthrough + case "year": + fallthrough + case "decade": + fallthrough + case "director": + fallthrough + case "actor": + fallthrough + case "country": + fallthrough + case "contentRating": + fallthrough + case "rating": + fallthrough + case "resolution": + fallthrough + case "firstCharacter": + fallthrough + case "folder": + *e = Tag(v) + return nil + default: + return fmt.Errorf("invalid value for Tag: %v", v) + } +} + +type GetLibraryItemsRequest struct { + // the Id of the library to query + SectionID int64 `pathParam:"style=simple,explode=false,name=sectionId"` + // A key representing a specific tag within the section. + Tag Tag `pathParam:"style=simple,explode=false,name=tag"` +} + +func (o *GetLibraryItemsRequest) GetSectionID() int64 { + if o == nil { + return 0 + } + return o.SectionID +} + +func (o *GetLibraryItemsRequest) GetTag() Tag { + if o == nil { + return Tag("") + } + return o.Tag +} + +type GetLibraryItemsErrors struct { + Code *float64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *float64 `json:"status,omitempty"` +} + +func (o *GetLibraryItemsErrors) GetCode() *float64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetLibraryItemsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetLibraryItemsErrors) GetStatus() *float64 { + if o == nil { + return nil + } + return o.Status +} + +// GetLibraryItemsLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetLibraryItemsLibraryResponseBody struct { + Errors []GetLibraryItemsErrors `json:"errors,omitempty"` +} + +func (o *GetLibraryItemsLibraryResponseBody) GetErrors() []GetLibraryItemsErrors { + if o == nil { + return nil + } + return o.Errors +} + +type GetLibraryItemsPart struct { + ID *int `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Duration *int `json:"duration,omitempty"` + File *string `json:"file,omitempty"` + Size *int64 `json:"size,omitempty"` + Container *string `json:"container,omitempty"` + VideoProfile *string `json:"videoProfile,omitempty"` +} + +func (o *GetLibraryItemsPart) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetLibraryItemsPart) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetLibraryItemsPart) GetDuration() *int { + if o == nil { + return nil + } + return o.Duration +} + +func (o *GetLibraryItemsPart) GetFile() *string { + if o == nil { + return nil + } + return o.File +} + +func (o *GetLibraryItemsPart) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetLibraryItemsPart) GetContainer() *string { + if o == nil { + return nil + } + return o.Container +} + +func (o *GetLibraryItemsPart) GetVideoProfile() *string { + if o == nil { + return nil + } + return o.VideoProfile +} + +type GetLibraryItemsMedia struct { + ID *int `json:"id,omitempty"` + Duration *int `json:"duration,omitempty"` + Bitrate *int `json:"bitrate,omitempty"` + Width *int `json:"width,omitempty"` + Height *int `json:"height,omitempty"` + AspectRatio *float64 `json:"aspectRatio,omitempty"` + AudioChannels *int `json:"audioChannels,omitempty"` + AudioCodec *string `json:"audioCodec,omitempty"` + VideoCodec *string `json:"videoCodec,omitempty"` + VideoResolution *string `json:"videoResolution,omitempty"` + Container *string `json:"container,omitempty"` + VideoFrameRate *string `json:"videoFrameRate,omitempty"` + VideoProfile *string `json:"videoProfile,omitempty"` + Part []GetLibraryItemsPart `json:"Part,omitempty"` +} + +func (o *GetLibraryItemsMedia) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetLibraryItemsMedia) GetDuration() *int { + if o == nil { + return nil + } + return o.Duration +} + +func (o *GetLibraryItemsMedia) GetBitrate() *int { + if o == nil { + return nil + } + return o.Bitrate +} + +func (o *GetLibraryItemsMedia) GetWidth() *int { + if o == nil { + return nil + } + return o.Width +} + +func (o *GetLibraryItemsMedia) GetHeight() *int { + if o == nil { + return nil + } + return o.Height +} + +func (o *GetLibraryItemsMedia) GetAspectRatio() *float64 { + if o == nil { + return nil + } + return o.AspectRatio +} + +func (o *GetLibraryItemsMedia) GetAudioChannels() *int { + if o == nil { + return nil + } + return o.AudioChannels +} + +func (o *GetLibraryItemsMedia) GetAudioCodec() *string { + if o == nil { + return nil + } + return o.AudioCodec +} + +func (o *GetLibraryItemsMedia) GetVideoCodec() *string { + if o == nil { + return nil + } + return o.VideoCodec +} + +func (o *GetLibraryItemsMedia) GetVideoResolution() *string { + if o == nil { + return nil + } + return o.VideoResolution +} + +func (o *GetLibraryItemsMedia) GetContainer() *string { + if o == nil { + return nil + } + return o.Container +} + +func (o *GetLibraryItemsMedia) GetVideoFrameRate() *string { + if o == nil { + return nil + } + return o.VideoFrameRate +} + +func (o *GetLibraryItemsMedia) GetVideoProfile() *string { + if o == nil { + return nil + } + return o.VideoProfile +} + +func (o *GetLibraryItemsMedia) GetPart() []GetLibraryItemsPart { + if o == nil { + return nil + } + return o.Part +} + +type GetLibraryItemsGenre struct { + Tag *string `json:"tag,omitempty"` +} + +func (o *GetLibraryItemsGenre) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetLibraryItemsCountry struct { + Tag *string `json:"tag,omitempty"` +} + +func (o *GetLibraryItemsCountry) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetLibraryItemsDirector struct { + Tag *string `json:"tag,omitempty"` +} + +func (o *GetLibraryItemsDirector) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetLibraryItemsWriter struct { + Tag *string `json:"tag,omitempty"` +} + +func (o *GetLibraryItemsWriter) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetLibraryItemsRole struct { + Tag *string `json:"tag,omitempty"` +} + +func (o *GetLibraryItemsRole) GetTag() *string { + if o == nil { + return nil + } + return o.Tag +} + +type GetLibraryItemsMetadata struct { + RatingKey *string `json:"ratingKey,omitempty"` + Key *string `json:"key,omitempty"` + GUID *string `json:"guid,omitempty"` + Studio *string `json:"studio,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + ContentRating *string `json:"contentRating,omitempty"` + Summary *string `json:"summary,omitempty"` + Rating *float64 `json:"rating,omitempty"` + AudienceRating *float64 `json:"audienceRating,omitempty"` + Year *int `json:"year,omitempty"` + Tagline *string `json:"tagline,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Art *string `json:"art,omitempty"` + Duration *int `json:"duration,omitempty"` + OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"` + AddedAt *int `json:"addedAt,omitempty"` + UpdatedAt *int `json:"updatedAt,omitempty"` + AudienceRatingImage *string `json:"audienceRatingImage,omitempty"` + ChapterSource *string `json:"chapterSource,omitempty"` + PrimaryExtraKey *string `json:"primaryExtraKey,omitempty"` + RatingImage *string `json:"ratingImage,omitempty"` + GrandparentRatingKey *string `json:"grandparentRatingKey,omitempty"` + GrandparentGUID *string `json:"grandparentGuid,omitempty"` + GrandparentKey *string `json:"grandparentKey,omitempty"` + GrandparentTitle *string `json:"grandparentTitle,omitempty"` + GrandparentThumb *string `json:"grandparentThumb,omitempty"` + GrandparentArt *string `json:"grandparentArt,omitempty"` + GrandparentTheme *string `json:"grandparentTheme,omitempty"` + Media []GetLibraryItemsMedia `json:"Media,omitempty"` + Genre []GetLibraryItemsGenre `json:"Genre,omitempty"` + Country []GetLibraryItemsCountry `json:"Country,omitempty"` + Director []GetLibraryItemsDirector `json:"Director,omitempty"` + Writer []GetLibraryItemsWriter `json:"Writer,omitempty"` + Role []GetLibraryItemsRole `json:"Role,omitempty"` + TitleSort *string `json:"titleSort,omitempty"` + ViewCount *int `json:"viewCount,omitempty"` + LastViewedAt *int `json:"lastViewedAt,omitempty"` + OriginalTitle *string `json:"originalTitle,omitempty"` + ViewOffset *int `json:"viewOffset,omitempty"` + SkipCount *int `json:"skipCount,omitempty"` + Index *int `json:"index,omitempty"` + Theme *string `json:"theme,omitempty"` + LeafCount *int `json:"leafCount,omitempty"` + ViewedLeafCount *int `json:"viewedLeafCount,omitempty"` + ChildCount *int `json:"childCount,omitempty"` + HasPremiumExtras *string `json:"hasPremiumExtras,omitempty"` + HasPremiumPrimaryExtra *string `json:"hasPremiumPrimaryExtra,omitempty"` + ParentRatingKey *string `json:"parentRatingKey,omitempty"` + ParentGUID *string `json:"parentGuid,omitempty"` + ParentStudio *string `json:"parentStudio,omitempty"` + ParentKey *string `json:"parentKey,omitempty"` + ParentTitle *string `json:"parentTitle,omitempty"` + ParentIndex *int `json:"parentIndex,omitempty"` + ParentYear *int `json:"parentYear,omitempty"` + ParentThumb *string `json:"parentThumb,omitempty"` + ParentTheme *string `json:"parentTheme,omitempty"` +} + +func (g GetLibraryItemsMetadata) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetLibraryItemsMetadata) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetLibraryItemsMetadata) GetRatingKey() *string { + if o == nil { + return nil + } + return o.RatingKey +} + +func (o *GetLibraryItemsMetadata) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetLibraryItemsMetadata) GetGUID() *string { + if o == nil { + return nil + } + return o.GUID +} + +func (o *GetLibraryItemsMetadata) GetStudio() *string { + if o == nil { + return nil + } + return o.Studio +} + +func (o *GetLibraryItemsMetadata) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetLibraryItemsMetadata) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *GetLibraryItemsMetadata) GetContentRating() *string { + if o == nil { + return nil + } + return o.ContentRating +} + +func (o *GetLibraryItemsMetadata) GetSummary() *string { + if o == nil { + return nil + } + return o.Summary +} + +func (o *GetLibraryItemsMetadata) GetRating() *float64 { + if o == nil { + return nil + } + return o.Rating +} + +func (o *GetLibraryItemsMetadata) GetAudienceRating() *float64 { + if o == nil { + return nil + } + return o.AudienceRating +} + +func (o *GetLibraryItemsMetadata) GetYear() *int { + if o == nil { + return nil + } + return o.Year +} + +func (o *GetLibraryItemsMetadata) GetTagline() *string { + if o == nil { + return nil + } + return o.Tagline +} + +func (o *GetLibraryItemsMetadata) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetLibraryItemsMetadata) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetLibraryItemsMetadata) GetDuration() *int { + if o == nil { + return nil + } + return o.Duration +} + +func (o *GetLibraryItemsMetadata) GetOriginallyAvailableAt() *types.Date { + if o == nil { + return nil + } + return o.OriginallyAvailableAt +} + +func (o *GetLibraryItemsMetadata) GetAddedAt() *int { + if o == nil { + return nil + } + return o.AddedAt +} + +func (o *GetLibraryItemsMetadata) GetUpdatedAt() *int { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetLibraryItemsMetadata) GetAudienceRatingImage() *string { + if o == nil { + return nil + } + return o.AudienceRatingImage +} + +func (o *GetLibraryItemsMetadata) GetChapterSource() *string { + if o == nil { + return nil + } + return o.ChapterSource +} + +func (o *GetLibraryItemsMetadata) GetPrimaryExtraKey() *string { + if o == nil { + return nil + } + return o.PrimaryExtraKey +} + +func (o *GetLibraryItemsMetadata) GetRatingImage() *string { + if o == nil { + return nil + } + return o.RatingImage +} + +func (o *GetLibraryItemsMetadata) GetGrandparentRatingKey() *string { + if o == nil { + return nil + } + return o.GrandparentRatingKey +} + +func (o *GetLibraryItemsMetadata) GetGrandparentGUID() *string { + if o == nil { + return nil + } + return o.GrandparentGUID +} + +func (o *GetLibraryItemsMetadata) GetGrandparentKey() *string { + if o == nil { + return nil + } + return o.GrandparentKey +} + +func (o *GetLibraryItemsMetadata) GetGrandparentTitle() *string { + if o == nil { + return nil + } + return o.GrandparentTitle +} + +func (o *GetLibraryItemsMetadata) GetGrandparentThumb() *string { + if o == nil { + return nil + } + return o.GrandparentThumb +} + +func (o *GetLibraryItemsMetadata) GetGrandparentArt() *string { + if o == nil { + return nil + } + return o.GrandparentArt +} + +func (o *GetLibraryItemsMetadata) GetGrandparentTheme() *string { + if o == nil { + return nil + } + return o.GrandparentTheme +} + +func (o *GetLibraryItemsMetadata) GetMedia() []GetLibraryItemsMedia { + if o == nil { + return nil + } + return o.Media +} + +func (o *GetLibraryItemsMetadata) GetGenre() []GetLibraryItemsGenre { + if o == nil { + return nil + } + return o.Genre +} + +func (o *GetLibraryItemsMetadata) GetCountry() []GetLibraryItemsCountry { + if o == nil { + return nil + } + return o.Country +} + +func (o *GetLibraryItemsMetadata) GetDirector() []GetLibraryItemsDirector { + if o == nil { + return nil + } + return o.Director +} + +func (o *GetLibraryItemsMetadata) GetWriter() []GetLibraryItemsWriter { + if o == nil { + return nil + } + return o.Writer +} + +func (o *GetLibraryItemsMetadata) GetRole() []GetLibraryItemsRole { + if o == nil { + return nil + } + return o.Role +} + +func (o *GetLibraryItemsMetadata) GetTitleSort() *string { + if o == nil { + return nil + } + return o.TitleSort +} + +func (o *GetLibraryItemsMetadata) GetViewCount() *int { + if o == nil { + return nil + } + return o.ViewCount +} + +func (o *GetLibraryItemsMetadata) GetLastViewedAt() *int { + if o == nil { + return nil + } + return o.LastViewedAt +} + +func (o *GetLibraryItemsMetadata) GetOriginalTitle() *string { + if o == nil { + return nil + } + return o.OriginalTitle +} + +func (o *GetLibraryItemsMetadata) GetViewOffset() *int { + if o == nil { + return nil + } + return o.ViewOffset +} + +func (o *GetLibraryItemsMetadata) GetSkipCount() *int { + if o == nil { + return nil + } + return o.SkipCount +} + +func (o *GetLibraryItemsMetadata) GetIndex() *int { + if o == nil { + return nil + } + return o.Index +} + +func (o *GetLibraryItemsMetadata) GetTheme() *string { + if o == nil { + return nil + } + return o.Theme +} + +func (o *GetLibraryItemsMetadata) GetLeafCount() *int { + if o == nil { + return nil + } + return o.LeafCount +} + +func (o *GetLibraryItemsMetadata) GetViewedLeafCount() *int { + if o == nil { + return nil + } + return o.ViewedLeafCount +} + +func (o *GetLibraryItemsMetadata) GetChildCount() *int { + if o == nil { + return nil + } + return o.ChildCount +} + +func (o *GetLibraryItemsMetadata) GetHasPremiumExtras() *string { + if o == nil { + return nil + } + return o.HasPremiumExtras +} + +func (o *GetLibraryItemsMetadata) GetHasPremiumPrimaryExtra() *string { + if o == nil { + return nil + } + return o.HasPremiumPrimaryExtra +} + +func (o *GetLibraryItemsMetadata) GetParentRatingKey() *string { + if o == nil { + return nil + } + return o.ParentRatingKey +} + +func (o *GetLibraryItemsMetadata) GetParentGUID() *string { + if o == nil { + return nil + } + return o.ParentGUID +} + +func (o *GetLibraryItemsMetadata) GetParentStudio() *string { + if o == nil { + return nil + } + return o.ParentStudio +} + +func (o *GetLibraryItemsMetadata) GetParentKey() *string { + if o == nil { + return nil + } + return o.ParentKey +} + +func (o *GetLibraryItemsMetadata) GetParentTitle() *string { + if o == nil { + return nil + } + return o.ParentTitle +} + +func (o *GetLibraryItemsMetadata) GetParentIndex() *int { + if o == nil { + return nil + } + return o.ParentIndex +} + +func (o *GetLibraryItemsMetadata) GetParentYear() *int { + if o == nil { + return nil + } + return o.ParentYear +} + +func (o *GetLibraryItemsMetadata) GetParentThumb() *string { + if o == nil { + return nil + } + return o.ParentThumb +} + +func (o *GetLibraryItemsMetadata) GetParentTheme() *string { + if o == nil { + return nil + } + return o.ParentTheme +} + +type GetLibraryItemsMediaContainer struct { + Size *int `json:"size,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + Art *string `json:"art,omitempty"` + Identifier *string `json:"identifier,omitempty"` + LibrarySectionID *int `json:"librarySectionID,omitempty"` + LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` + LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"` + MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` + MediaTagVersion *int `json:"mediaTagVersion,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Title1 *string `json:"title1,omitempty"` + Title2 *string `json:"title2,omitempty"` + ViewGroup *string `json:"viewGroup,omitempty"` + ViewMode *int `json:"viewMode,omitempty"` + MixedParents *bool `json:"mixedParents,omitempty"` + Metadata []GetLibraryItemsMetadata `json:"Metadata,omitempty"` +} + +func (o *GetLibraryItemsMediaContainer) GetSize() *int { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetLibraryItemsMediaContainer) GetAllowSync() *bool { + if o == nil { + return nil + } + return o.AllowSync +} + +func (o *GetLibraryItemsMediaContainer) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetLibraryItemsMediaContainer) GetIdentifier() *string { + if o == nil { + return nil + } + return o.Identifier +} + +func (o *GetLibraryItemsMediaContainer) GetLibrarySectionID() *int { + if o == nil { + return nil + } + return o.LibrarySectionID +} + +func (o *GetLibraryItemsMediaContainer) GetLibrarySectionTitle() *string { + if o == nil { + return nil + } + return o.LibrarySectionTitle +} + +func (o *GetLibraryItemsMediaContainer) GetLibrarySectionUUID() *string { + if o == nil { + return nil + } + return o.LibrarySectionUUID +} + +func (o *GetLibraryItemsMediaContainer) GetMediaTagPrefix() *string { + if o == nil { + return nil + } + return o.MediaTagPrefix +} + +func (o *GetLibraryItemsMediaContainer) GetMediaTagVersion() *int { + if o == nil { + return nil + } + return o.MediaTagVersion +} + +func (o *GetLibraryItemsMediaContainer) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetLibraryItemsMediaContainer) GetTitle1() *string { + if o == nil { + return nil + } + return o.Title1 +} + +func (o *GetLibraryItemsMediaContainer) GetTitle2() *string { + if o == nil { + return nil + } + return o.Title2 +} + +func (o *GetLibraryItemsMediaContainer) GetViewGroup() *string { + if o == nil { + return nil + } + return o.ViewGroup +} + +func (o *GetLibraryItemsMediaContainer) GetViewMode() *int { + if o == nil { + return nil + } + return o.ViewMode +} + +func (o *GetLibraryItemsMediaContainer) GetMixedParents() *bool { + if o == nil { + return nil + } + return o.MixedParents +} + +func (o *GetLibraryItemsMediaContainer) GetMetadata() []GetLibraryItemsMetadata { + if o == nil { + return nil + } + return o.Metadata +} + +// GetLibraryItemsResponseBody - The contents of the library by section and tag +type GetLibraryItemsResponseBody struct { + MediaContainer *GetLibraryItemsMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetLibraryItemsResponseBody) GetMediaContainer() *GetLibraryItemsMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetLibraryItemsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // The contents of the library by section and tag + TwoHundredApplicationJSONObject *GetLibraryItemsResponseBody + // Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + FourHundredAndOneApplicationJSONObject *GetLibraryItemsLibraryResponseBody +} + +func (o *GetLibraryItemsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetLibraryItemsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetLibraryItemsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetLibraryItemsResponse) GetTwoHundredApplicationJSONObject() *GetLibraryItemsResponseBody { + if o == nil { + return nil + } + return o.TwoHundredApplicationJSONObject +} + +func (o *GetLibraryItemsResponse) GetFourHundredAndOneApplicationJSONObject() *GetLibraryItemsLibraryResponseBody { + if o == nil { + return nil + } + return o.FourHundredAndOneApplicationJSONObject +} diff --git a/internal/sdk/models/operations/getplaylists.go b/internal/sdk/models/operations/getplaylists.go index 643197c..c2ce6d2 100644 --- a/internal/sdk/models/operations/getplaylists.go +++ b/internal/sdk/models/operations/getplaylists.go @@ -20,7 +20,6 @@ const ( func (e PlaylistType) ToPointer() *PlaylistType { return &e } - func (e *PlaylistType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -50,7 +49,6 @@ const ( func (e QueryParamSmart) ToPointer() *QueryParamSmart { return &e } - func (e *QueryParamSmart) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/getresizedphoto.go b/internal/sdk/models/operations/getresizedphoto.go index e745f21..2bb734b 100644 --- a/internal/sdk/models/operations/getresizedphoto.go +++ b/internal/sdk/models/operations/getresizedphoto.go @@ -20,7 +20,6 @@ const ( func (e MinSize) ToPointer() *MinSize { return &e } - func (e *MinSize) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { @@ -48,7 +47,6 @@ const ( func (e Upscale) ToPointer() *Upscale { return &e } - func (e *Upscale) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/gettimeline.go b/internal/sdk/models/operations/gettimeline.go index 5d55e5f..bca3a61 100644 --- a/internal/sdk/models/operations/gettimeline.go +++ b/internal/sdk/models/operations/gettimeline.go @@ -20,7 +20,6 @@ const ( func (e State) ToPointer() *State { return &e } - func (e *State) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/gettransienttoken.go b/internal/sdk/models/operations/gettransienttoken.go index c2892d4..15e6a31 100644 --- a/internal/sdk/models/operations/gettransienttoken.go +++ b/internal/sdk/models/operations/gettransienttoken.go @@ -18,7 +18,6 @@ const ( func (e GetTransientTokenQueryParamType) ToPointer() *GetTransientTokenQueryParamType { return &e } - func (e *GetTransientTokenQueryParamType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -43,7 +42,6 @@ const ( func (e Scope) ToPointer() *Scope { return &e } - func (e *Scope) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/logline.go b/internal/sdk/models/operations/logline.go index a0b1ef5..6f985e6 100644 --- a/internal/sdk/models/operations/logline.go +++ b/internal/sdk/models/operations/logline.go @@ -27,7 +27,6 @@ const ( func (e Level) ToPointer() *Level { return &e } - func (e *Level) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/searchlibrary.go b/internal/sdk/models/operations/searchlibrary.go index 79b7cac..294a35c 100644 --- a/internal/sdk/models/operations/searchlibrary.go +++ b/internal/sdk/models/operations/searchlibrary.go @@ -21,7 +21,6 @@ const ( func (e Type) ToPointer() *Type { return &e } - func (e *Type) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { @@ -63,6 +62,45 @@ func (o *SearchLibraryRequest) GetType() Type { return o.Type } +type SearchLibraryErrors struct { + Code *float64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *float64 `json:"status,omitempty"` +} + +func (o *SearchLibraryErrors) GetCode() *float64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *SearchLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *SearchLibraryErrors) GetStatus() *float64 { + if o == nil { + return nil + } + return o.Status +} + +// SearchLibraryLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type SearchLibraryLibraryResponseBody struct { + Errors []SearchLibraryErrors `json:"errors,omitempty"` +} + +func (o *SearchLibraryLibraryResponseBody) GetErrors() []SearchLibraryErrors { + if o == nil { + return nil + } + return o.Errors +} + type SearchLibraryMetadata struct { RatingKey *string `json:"ratingKey,omitempty"` Key *string `json:"key,omitempty"` @@ -353,7 +391,9 @@ type SearchLibraryResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The contents of the library by section and type - Object *SearchLibraryResponseBody + TwoHundredApplicationJSONObject *SearchLibraryResponseBody + // Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + FourHundredAndOneApplicationJSONObject *SearchLibraryLibraryResponseBody } func (o *SearchLibraryResponse) GetContentType() string { @@ -377,9 +417,16 @@ func (o *SearchLibraryResponse) GetRawResponse() *http.Response { return o.RawResponse } -func (o *SearchLibraryResponse) GetObject() *SearchLibraryResponseBody { +func (o *SearchLibraryResponse) GetTwoHundredApplicationJSONObject() *SearchLibraryResponseBody { if o == nil { return nil } - return o.Object + return o.TwoHundredApplicationJSONObject +} + +func (o *SearchLibraryResponse) GetFourHundredAndOneApplicationJSONObject() *SearchLibraryLibraryResponseBody { + if o == nil { + return nil + } + return o.FourHundredAndOneApplicationJSONObject } diff --git a/internal/sdk/models/operations/starttask.go b/internal/sdk/models/operations/starttask.go index 53c0fe6..4bfd064 100644 --- a/internal/sdk/models/operations/starttask.go +++ b/internal/sdk/models/operations/starttask.go @@ -31,7 +31,6 @@ const ( func (e TaskName) ToPointer() *TaskName { return &e } - func (e *TaskName) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/stoptask.go b/internal/sdk/models/operations/stoptask.go index a2faa4d..71d379e 100644 --- a/internal/sdk/models/operations/stoptask.go +++ b/internal/sdk/models/operations/stoptask.go @@ -31,7 +31,6 @@ const ( func (e PathParamTaskName) ToPointer() *PathParamTaskName { return &e } - func (e *PathParamTaskName) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/models/operations/uploadplaylist.go b/internal/sdk/models/operations/uploadplaylist.go index adc740f..99a2a58 100644 --- a/internal/sdk/models/operations/uploadplaylist.go +++ b/internal/sdk/models/operations/uploadplaylist.go @@ -22,7 +22,6 @@ const ( func (e Force) ToPointer() *Force { return &e } - func (e *Force) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/playlists.go b/internal/sdk/playlists.go index 80f1b20..82d5841 100644 --- a/internal/sdk/playlists.go +++ b/internal/sdk/playlists.go @@ -135,6 +135,7 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat } return res, nil + } // GetPlaylists - Get All Playlists @@ -241,6 +242,7 @@ func (s *Playlists) GetPlaylists(ctx context.Context, request operations.GetPlay } return res, nil + } // GetPlaylist - Retrieve Playlist @@ -344,6 +346,7 @@ func (s *Playlists) GetPlaylist(ctx context.Context, request operations.GetPlayl } return res, nil + } // DeletePlaylist - Deletes a Playlist @@ -436,6 +439,7 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, request operations.Delet } return res, nil + } // UpdatePlaylist - Update a Playlist @@ -532,6 +536,7 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, request operations.Updat } return res, nil + } // GetPlaylistContents - Retrieve Playlist Contents @@ -641,6 +646,7 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, request operations. } return res, nil + } // ClearPlaylistContents - Delete Playlist Contents @@ -733,6 +739,7 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, request operation } return res, nil + } // AddPlaylistContents - Adding to a Playlist @@ -840,6 +847,7 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, request operations. } return res, nil + } // UploadPlaylist - Upload Playlist @@ -936,4 +944,5 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, request operations.Uploa } return res, nil + } diff --git a/internal/sdk/plex.go b/internal/sdk/plex.go index 671a85c..b28d188 100644 --- a/internal/sdk/plex.go +++ b/internal/sdk/plex.go @@ -144,6 +144,7 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt } return res, nil + } // GetToken - Get Access Token @@ -254,4 +255,5 @@ func (s *Plex) GetToken(ctx context.Context, request operations.GetTokenRequest, } return res, nil + } diff --git a/internal/sdk/plexapi.go b/internal/sdk/plexapi.go index bc78d1b..33e33cc 100644 --- a/internal/sdk/plexapi.go +++ b/internal/sdk/plexapi.go @@ -171,7 +171,6 @@ const ( func (e ServerProtocol) ToPointer() *ServerProtocol { return &e } - func (e *ServerProtocol) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -234,16 +233,10 @@ func WithClient(client HTTPClient) SDKOption { } } -func withSecurity(security interface{}) func(context.Context) (interface{}, error) { - return func(context.Context) (interface{}, error) { - return security, nil - } -} - // WithSecurity configures the SDK to use the provided security details func WithSecurity(security shared.Security) SDKOption { return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Security = withSecurity(security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) } } @@ -276,8 +269,8 @@ func New(opts ...SDKOption) *PlexAPI { Language: "go", OpenAPIDocVersion: "0.0.3", SDKVersion: "0.0.1", - GenVersion: "2.326.3", - UserAgent: "speakeasy-sdk/go 0.0.1 2.326.3 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk", + GenVersion: "2.335.5", + UserAgent: "speakeasy-sdk/go 0.0.1 2.335.5 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk", Globals: globals.Globals{}, ServerDefaults: []map[string]string{ { diff --git a/internal/sdk/search.go b/internal/sdk/search.go index 2f0b24e..1c7d644 100644 --- a/internal/sdk/search.go +++ b/internal/sdk/search.go @@ -132,6 +132,7 @@ func (s *Search) PerformSearch(ctx context.Context, request operations.PerformSe } return res, nil + } // PerformVoiceSearch - Perform a voice search @@ -231,6 +232,7 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, request operations.Perf } return res, nil + } // GetSearchResults - Get Search Results @@ -337,4 +339,5 @@ func (s *Search) GetSearchResults(ctx context.Context, request operations.GetSea } return res, nil + } diff --git a/internal/sdk/server.go b/internal/sdk/server.go index 43312fc..6bbb0e0 100644 --- a/internal/sdk/server.go +++ b/internal/sdk/server.go @@ -126,6 +126,7 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ } return res, nil + } // GetServerPreferences - Get Server Preferences @@ -228,6 +229,7 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe } return res, nil + } // GetAvailableClients - Get Available Clients @@ -330,6 +332,7 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila } return res, nil + } // GetDevices - Get Devices @@ -432,6 +435,7 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse } return res, nil + } // GetServerIdentity - Get Server Identity @@ -534,6 +538,7 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId } return res, nil + } // GetMyPlexAccount - Get MyPlex Account @@ -636,6 +641,7 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc } return res, nil + } // GetResizedPhoto - Get a Resized Photo @@ -732,6 +738,7 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi } return res, nil + } // GetServerList - Get Server List @@ -834,4 +841,5 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe } return res, nil + } diff --git a/internal/sdk/sessions.go b/internal/sdk/sessions.go index adb3d7e..9aaa7a6 100644 --- a/internal/sdk/sessions.go +++ b/internal/sdk/sessions.go @@ -126,6 +126,7 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp } return res, nil + } // GetSessionHistory - Get Session History @@ -228,6 +229,7 @@ func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessio } return res, nil + } // GetTranscodeSessions - Get Transcode Sessions @@ -330,6 +332,7 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra } return res, nil + } // StopTranscodeSession - Stop a Transcode Session @@ -422,4 +425,5 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, request operations. } return res, nil + } diff --git a/internal/sdk/statistics.go b/internal/sdk/statistics.go index 4773763..d1113b9 100644 --- a/internal/sdk/statistics.go +++ b/internal/sdk/statistics.go @@ -130,4 +130,5 @@ func (s *Statistics) GetStatistics(ctx context.Context, request operations.GetSt } return res, nil + } diff --git a/internal/sdk/updater.go b/internal/sdk/updater.go index 0f71bb9..3b6d2ea 100644 --- a/internal/sdk/updater.go +++ b/internal/sdk/updater.go @@ -127,6 +127,7 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta } return res, nil + } // CheckForUpdates - Checking for updates @@ -223,6 +224,7 @@ func (s *Updater) CheckForUpdates(ctx context.Context, request operations.CheckF } return res, nil + } // ApplyUpdates - Apply Updates @@ -321,4 +323,5 @@ func (s *Updater) ApplyUpdates(ctx context.Context, request operations.ApplyUpda } return res, nil + } diff --git a/internal/sdk/video.go b/internal/sdk/video.go index f9607f1..037513c 100644 --- a/internal/sdk/video.go +++ b/internal/sdk/video.go @@ -120,6 +120,7 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR } return res, nil + } // StartUniversalTranscode - Start Universal Transcode @@ -216,4 +217,5 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. } return res, nil + }