diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1b7c3a5..8d24cad 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: 46ec1ce493542eb1a574ee88fc8b0895 + docChecksum: e95c0e17d3e268dcd18d26ac8d0bfc98 docVersion: 1.1.1 - speakeasyVersion: 1.636.3 - generationVersion: 2.723.11 - releaseVersion: 0.26.1 - configChecksum: 8f12745b80c253e0d17cd4e174948f51 + speakeasyVersion: 1.656.1 + generationVersion: 2.753.1 + releaseVersion: 0.27.0 + configChecksum: 992bac138343fa32eddfed9ebe4d6270 repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -17,7 +17,7 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.12 - core: 3.11.1 + core: 3.13.2 deepObjectParams: 0.1.1 defaultEnabledRetries: 0.2.0 downloadStreams: 0.1.2 @@ -26,14 +26,14 @@ features: globalSecurity: 2.82.12 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 - globalServerURLs: 2.82.3 + globalServerURLs: 2.83.0 globals: 2.82.2 intellisenseMarkdownSupport: 0.1.0 nameOverrides: 2.81.2 responseFormat: 0.1.2 retries: 2.84.2 sdkHooks: 0.2.0 - unions: 2.86.0 + unions: 2.87.1 uploadStreams: 0.1.0 generatedFiles: - .gitattributes @@ -53,6 +53,7 @@ generatedFiles: - /models/components/image.go - /models/components/items.go - /models/components/librarysection.go + - /models/components/librarysections.go - /models/components/lineup.go - /models/components/location.go - /models/components/media.go @@ -76,7 +77,6 @@ generatedFiles: - /models/components/player.go - /models/components/postresponses200.go - /models/components/protocol.go - - /models/components/requesthandlerslashgetresponses200.go - /models/components/security.go - /models/components/session.go - /models/components/setting.go @@ -365,6 +365,9 @@ generatedFiles: - docs/models/components/items.md - docs/models/components/librarysection.md - docs/models/components/librarysectionlocation.md + - docs/models/components/librarysections.md + - docs/models/components/librarysectionsdirectory.md + - docs/models/components/librarysectionsmediacontainer.md - docs/models/components/lineup.md - docs/models/components/lineuptype.md - docs/models/components/location.md @@ -416,9 +419,6 @@ generatedFiles: - docs/models/components/postresponses200type.md - docs/models/components/protocol.md - docs/models/components/recommendationsvisibility.md - - docs/models/components/requesthandlerslashgetresponses200.md - - docs/models/components/requesthandlerslashgetresponses200directory.md - - docs/models/components/requesthandlerslashgetresponses200mediacontainer.md - docs/models/components/security.md - docs/models/components/session.md - docs/models/components/sessionlocation.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 7c42bb6..60bc4a5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -17,12 +17,15 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false hoistGlobalSecurity: true + schemas: + allOfMergeStrategy: shallowMerge + requestBodyFieldName: "" tests: generateTests: true generateNewTests: false skipResponseBodyAssertions: false go: - version: 0.26.1 + version: 0.27.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: PlexAPIError @@ -37,6 +40,7 @@ go: operations: models/operations shared: models/components webhooks: models/webhooks + includeEmptyObjects: false inputModelSuffix: input maxMethodParams: 4 methodArguments: require-security-and-request @@ -47,3 +51,4 @@ go: respectRequiredFields: false responseFormat: envelope sdkPackageName: "" + unionDeserializationStrategy: left-to-right diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 9a086be..5e3befe 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.636.3 +speakeasyVersion: 1.656.1 sources: my-source: sourceNamespace: my-source @@ -9,20 +9,20 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:0e9f7ca03e6a970d7b77654ab41d0a1605f0105871db2630a7afc85d4362b624 - sourceBlobDigest: sha256:c0a6079f21e9d8cf8b3a205d2da333b78b2cb7e0db9dd895a41c68c2580e2d64 + sourceRevisionDigest: sha256:56fc783b16af019db4eb0fe52df504315e8e7c7ae41e319a61bba8823f19df4b + sourceBlobDigest: sha256:b62613477fd824bb42cf0bf5d0f9980448259c9c7456e03ca6a10eef39a3994f tags: - latest - - speakeasy-sdk-regen-1760314262 + - speakeasy-sdk-regen-1762992653 - 1.1.1 targets: plexgo: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:0e9f7ca03e6a970d7b77654ab41d0a1605f0105871db2630a7afc85d4362b624 - sourceBlobDigest: sha256:c0a6079f21e9d8cf8b3a205d2da333b78b2cb7e0db9dd895a41c68c2580e2d64 + sourceRevisionDigest: sha256:56fc783b16af019db4eb0fe52df504315e8e7c7ae41e319a61bba8823f19df4b + sourceBlobDigest: sha256:b62613477fd824bb42cf0bf5d0f9980448259c9c7456e03ca6a10eef39a3994f codeSamplesNamespace: code-samples-go-plexgo - codeSamplesRevisionDigest: sha256:8db88ac0989f866606672aee950cbd308054218a71e5ca5bb6afd2dc37e09f11 + codeSamplesRevisionDigest: sha256:6774f9c76b07cc1baeec3bfaab50b0770e51dc3b36da8ff5b92889168d5a538e workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 81a7198..5f965b9 100644 --- a/README.md +++ b/README.md @@ -629,18 +629,18 @@ You can override the default server globally using the `WithServerIndex(serverIn | --- | ---------------------------------------------------------- | -------------------------------------------- | ----------- | | 0 | `https://{IP-description}.{identifier}.plex.direct:{port}` | `identifier`
`IP-description`
`port` | | | 1 | `{protocol}://{host}:{port}` | `protocol`
`host`
`port` | | -| 2 | `https://{full_server_url}` | `server_url` | | +| 2 | `https://{full_server_url}` | `full_server_url` | | If the selected server has variables, you may override its default values using the associated option(s): -| Variable | Option | Default | Description | -| ---------------- | ----------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `identifier` | `WithIdentifier(identifier string)` | `"0123456789abcdef0123456789abcdef"` | The unique identifier of this particular PMS | -| `IP-description` | `WithIPDescription(ipDescription string)` | `"1-2-3-4"` | A `-` separated string of the IPv4 or IPv6 address components | -| `port` | `WithPort(port string)` | `"32400"` | The Port number configured on the PMS. Typically (`32400`).
If using a reverse proxy, this would be the port number configured on the proxy.
| -| `protocol` | `WithProtocol(protocol string)` | `"http"` | The network protocol to use. Typically (`http` or `https`) | -| `host` | `WithHost(host string)` | `"localhost"` | The Host of the PMS.
If using on a local network, this is the internal IP address of the server hosting the PMS.
If using on an external network, this is the external IP address for your network, and requires port forwarding.
If using a reverse proxy, this would be the external DNS domain for your network, and requires the proxy handle port forwarding.
| -| `server_url` | `WithGlobalServerURL(serverURL string)` | `"http://localhost:32400"` | The full manual URL to access the PMS | +| Variable | Option | Default | Description | +| ----------------- | ----------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `identifier` | `WithIdentifier(identifier string)` | `"0123456789abcdef0123456789abcdef"` | The unique identifier of this particular PMS | +| `IP-description` | `WithIPDescription(ipDescription string)` | `"1-2-3-4"` | A `-` separated string of the IPv4 or IPv6 address components | +| `port` | `WithPort(port string)` | `"32400"` | The Port number configured on the PMS. Typically (`32400`).
If using a reverse proxy, this would be the port number configured on the proxy.
| +| `protocol` | `WithProtocol(protocol string)` | `"http"` | The network protocol to use. Typically (`http` or `https`) | +| `host` | `WithHost(host string)` | `"localhost"` | The Host of the PMS.
If using on a local network, this is the internal IP address of the server hosting the PMS.
If using on an external network, this is the external IP address for your network, and requires port forwarding.
If using a reverse proxy, this would be the external DNS domain for your network, and requires the proxy handle port forwarding.
| +| `full_server_url` | `WithFullServerURL(fullServerURL string)` | `"http://localhost:32400"` | The full manual URL to access the PMS | #### Example @@ -659,10 +659,10 @@ func main() { ctx := context.Background() s := plexgo.New( - plexgo.WithServerIndex(1), - plexgo.WithProtocol(""), - plexgo.WithHost("electric-excess.name"), - plexgo.WithPort("36393"), + plexgo.WithServerIndex(0), + plexgo.WithIdentifier("0123456789abcdef0123456789abcdef"), + plexgo.WithIPDescription("1-2-3-4"), + plexgo.WithPort("32400"), plexgo.WithAccepts(components.AcceptsApplicationXML), plexgo.WithClientIdentifier("abc123"), plexgo.WithProduct("Plex for Roku"), @@ -706,7 +706,7 @@ func main() { ctx := context.Background() s := plexgo.New( - plexgo.WithServerURL("https://{full_server_url}"), + plexgo.WithServerURL("https://http://localhost:32400"), plexgo.WithAccepts(components.AcceptsApplicationXML), plexgo.WithClientIdentifier("abc123"), plexgo.WithProduct("Plex for Roku"), diff --git a/RELEASES.md b/RELEASES.md index 1edd017..8ab5ad4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1232,4 +1232,14 @@ Based on: ### Generated - [go v0.26.1] . ### Releases -- [Go v0.26.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.26.1 - . \ No newline at end of file +- [Go v0.26.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.26.1 - . + +## 2025-11-13 00:10:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.656.1 (2.753.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.27.0] . +### Releases +- [Go v0.27.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.27.0 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 954cb23..d055f6b 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -4411,7 +4411,7 @@ actions: if err != nil { log.Fatal(err) } - if res.RequestHandlerSlashGetResponses200 != nil { + if res.LibrarySections != nil { // handle response } } @@ -4455,7 +4455,7 @@ actions: if err != nil { log.Fatal(err) } - if res.RequestHandlerSlashGetResponses200 != nil { + if res.LibrarySections != nil { // handle response } } diff --git a/docs/models/components/librarysections.md b/docs/models/components/librarysections.md new file mode 100644 index 0000000..bc67dd9 --- /dev/null +++ b/docs/models/components/librarysections.md @@ -0,0 +1,10 @@ +# LibrarySections + +OK + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*components.LibrarySectionsMediaContainer](../../models/components/librarysectionsmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/requesthandlerslashgetresponses200directory.md b/docs/models/components/librarysectionsdirectory.md similarity index 94% rename from docs/models/components/requesthandlerslashgetresponses200directory.md rename to docs/models/components/librarysectionsdirectory.md index 3e95484..d880d5b 100644 --- a/docs/models/components/requesthandlerslashgetresponses200directory.md +++ b/docs/models/components/librarysectionsdirectory.md @@ -1,4 +1,4 @@ -# RequestHandlerSlashGetResponses200Directory +# LibrarySectionsDirectory ## Fields diff --git a/docs/models/components/requesthandlerslashgetresponses200mediacontainer.md b/docs/models/components/librarysectionsmediacontainer.md similarity index 99% rename from docs/models/components/requesthandlerslashgetresponses200mediacontainer.md rename to docs/models/components/librarysectionsmediacontainer.md index be01f22..b85b765 100644 --- a/docs/models/components/requesthandlerslashgetresponses200mediacontainer.md +++ b/docs/models/components/librarysectionsmediacontainer.md @@ -1,4 +1,4 @@ -# RequestHandlerSlashGetResponses200MediaContainer +# LibrarySectionsMediaContainer `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) @@ -62,4 +62,4 @@ The container often "hoists" common attributes from its children. For example, i | `Updater` | **bool* | :heavy_minus_sign: | N/A | | | `Version` | **string* | :heavy_minus_sign: | N/A | | | `VoiceSearch` | **bool* | :heavy_minus_sign: | N/A | | -| `Directory` | [][components.RequestHandlerSlashGetResponses200Directory](../../models/components/requesthandlerslashgetresponses200directory.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `Directory` | [][components.LibrarySectionsDirectory](../../models/components/librarysectionsdirectory.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/requesthandlerslashgetresponses200.md b/docs/models/components/requesthandlerslashgetresponses200.md deleted file mode 100644 index c79379b..0000000 --- a/docs/models/components/requesthandlerslashgetresponses200.md +++ /dev/null @@ -1,10 +0,0 @@ -# RequestHandlerSlashGetResponses200 - -OK - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| `MediaContainer` | [*components.RequestHandlerSlashGetResponses200MediaContainer](../../models/components/requesthandlerslashgetresponses200mediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getsectionsprefsresponse.md b/docs/models/operations/getsectionsprefsresponse.md index 3b84b85..28f6180 100644 --- a/docs/models/operations/getsectionsprefsresponse.md +++ b/docs/models/operations/getsectionsprefsresponse.md @@ -3,9 +3,9 @@ ## 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 | -| `RequestHandlerSlashGetResponses200` | [*components.RequestHandlerSlashGetResponses200](../../models/components/requesthandlerslashgetresponses200.md) | :heavy_minus_sign: | OK | \ No newline at end of file +| 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 | +| `LibrarySections` | [*components.LibrarySections](../../models/components/librarysections.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/models/operations/stopallrefreshesresponse.md b/docs/models/operations/stopallrefreshesresponse.md index 517bd5d..b96a850 100644 --- a/docs/models/operations/stopallrefreshesresponse.md +++ b/docs/models/operations/stopallrefreshesresponse.md @@ -3,9 +3,9 @@ ## 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 | -| `RequestHandlerSlashGetResponses200` | [*components.RequestHandlerSlashGetResponses200](../../models/components/requesthandlerslashgetresponses200.md) | :heavy_minus_sign: | OK | \ No newline at end of file +| 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 | +| `LibrarySections` | [*components.LibrarySections](../../models/components/librarysections.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 3d62d74..52f61e3 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -685,7 +685,7 @@ func main() { if err != nil { log.Fatal(err) } - if res.RequestHandlerSlashGetResponses200 != nil { + if res.LibrarySections != nil { // handle response } } @@ -750,7 +750,7 @@ func main() { if err != nil { log.Fatal(err) } - if res.RequestHandlerSlashGetResponses200 != nil { + if res.LibrarySections != nil { // handle response } } @@ -3354,8 +3354,8 @@ func main() { ## Autocomplete -The field to autocomplete on is specified by the {field}.query parameter. For example `genre.query` or `title.query`. -Returns a set of items from the filtered items whose {field} starts with {field}.query. In the results, a {field}.queryRange will be present to express the range of the match +The field to autocomplete on is specified by the `{field}.query` parameter. For example `genre.query` or `title.query`. +Returns a set of items from the filtered items whose `{field}` starts with `{field}.query`. In the results, a `{field}.queryRange` will be present to express the range of the match ### Example Usage diff --git a/internal/utils/json.go b/internal/utils/json.go index bd2ece0..07cbdc6 100644 --- a/internal/utils/json.go +++ b/internal/utils/json.go @@ -39,21 +39,30 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e fieldName := field.Name omitEmpty := false + omitZero := false jsonTag := field.Tag.Get("json") if jsonTag != "" { for _, tag := range strings.Split(jsonTag, ",") { if tag == "omitempty" { omitEmpty = true + } else if tag == "omitzero" { + omitZero = true } else { fieldName = tag } } } - if isNil(field.Type, fieldVal) && field.Tag.Get("const") == "" { - if omitEmpty { + if (omitEmpty || omitZero) && field.Tag.Get("const") == "" { + // Both omitempty and omitzero skip zero values (including nil) + if isNil(field.Type, fieldVal) { continue } + + if omitZero && fieldVal.IsZero() { + continue + } + } if !field.IsExported() && field.Tag.Get("const") == "" { @@ -154,7 +163,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool jsonTag := field.Tag.Get("json") if jsonTag != "" { for _, tag := range strings.Split(jsonTag, ",") { - if tag != "omitempty" { + if tag != "omitempty" && tag != "omitzero" { fieldName = tag } } @@ -636,3 +645,215 @@ func isModelType(typ reflect.Type) bool { return false } + +// CalculateJSONSize returns the byte size of the JSON representation of a value. +// This is used to determine which union type variant has the most data. +func CalculateJSONSize(v interface{}) int { + data, err := json.Marshal(v) + if err != nil { + return 0 + } + return len(data) +} + +// UnionCandidate represents a candidate type during union deserialization +type UnionCandidate struct { + FieldCount int + Size int + Type any // The union type enum value + Value any // The unmarshaled value +} + +// CountFields recursively counts the number of valid (non-nil, non-zero) fields set in a value. +// This is used as the primary discriminator for union types, with JSON size as a tiebreaker. +func CountFields(v interface{}) int { + if v == nil { + return 0 + } + + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + + // Dereference pointers + for typ.Kind() == reflect.Ptr { + if val.IsNil() { + return 0 + } + typ = typ.Elem() + val = val.Elem() + } + + return countFieldsRecursive(typ, val) +} + +// PickBestCandidate selects the best union type candidate using a multi-stage filtering approach: +// 1. If multiple candidates, filter by field count (keep only those with max field count) +// 2. If still multiple, filter by JSON size (keep only those with max size) +// 3. Return the first remaining candidate +func PickBestCandidate(candidates []UnionCandidate) *UnionCandidate { + if len(candidates) == 0 { + return nil + } + + if len(candidates) == 1 { + return &candidates[0] + } + + // Filter by field count if we have multiple candidates + if len(candidates) > 1 { + maxFieldCount := -1 + for i := range candidates { + candidates[i].FieldCount = CountFields(candidates[i].Value) + if candidates[i].FieldCount > maxFieldCount { + maxFieldCount = candidates[i].FieldCount + } + } + + // Keep only candidates with maximum field count + filtered := make([]UnionCandidate, 0, len(candidates)) + for _, c := range candidates { + if c.FieldCount == maxFieldCount { + filtered = append(filtered, c) + } + } + candidates = filtered + } + + if len(candidates) == 1 { + return &candidates[0] + } + + // Filter by JSON size if we still have multiple candidates + if len(candidates) > 1 { + maxSize := -1 + for i := range candidates { + candidates[i].Size = CalculateJSONSize(candidates[i].Value) + if candidates[i].Size > maxSize { + maxSize = candidates[i].Size + } + } + + // Keep only candidates with maximum size + filtered := make([]UnionCandidate, 0, len(candidates)) + for _, c := range candidates { + if c.Size == maxSize { + filtered = append(filtered, c) + } + } + candidates = filtered + } + + // Pick the first remaining candidate + return &candidates[0] +} + +func countFieldsRecursive(typ reflect.Type, val reflect.Value) int { + count := 0 + + switch typ.Kind() { + case reflect.Struct: + // Handle special types + switch typ { + case reflect.TypeOf(time.Time{}): + if !val.Interface().(time.Time).IsZero() { + return 1 + } + return 0 + case reflect.TypeOf(big.Int{}): + b := val.Interface().(big.Int) + if b.Sign() != 0 { + return 1 + } + return 0 + case reflect.TypeOf(types.Date{}): + // Date is always counted if it exists + return 1 + } + + // For regular structs, count non-zero fields + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + // Skip unexported fields and const fields + if !field.IsExported() || field.Tag.Get("const") != "" { + continue + } + + // Skip fields tagged with json:"-" + jsonTag := field.Tag.Get("json") + if jsonTag == "-" { + continue + } + + fieldTyp := field.Type + // Dereference pointer types for the field + for fieldTyp.Kind() == reflect.Ptr { + if fieldVal.IsNil() { + break + } + fieldTyp = fieldTyp.Elem() + fieldVal = fieldVal.Elem() + } + + if !isNil(field.Type, val.Field(i)) { + count += countFieldsRecursive(fieldTyp, fieldVal) + } + } + + case reflect.Slice, reflect.Array: + if val.IsNil() || val.Len() == 0 { + return 0 + } + // Count each array/slice element + for i := 0; i < val.Len(); i++ { + itemVal := val.Index(i) + itemTyp := itemVal.Type() + + // Dereference pointer types + for itemTyp.Kind() == reflect.Ptr { + if itemVal.IsNil() { + break + } + itemTyp = itemTyp.Elem() + itemVal = itemVal.Elem() + } + + if !isNil(itemTyp, itemVal) { + count += countFieldsRecursive(itemTyp, itemVal) + } + } + + case reflect.String: + if val.String() != "" { + count = 1 + } + + case reflect.Bool: + // Bools always count as a field (even if false) + count = 1 + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if val.Int() != 0 { + count = 1 + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if val.Uint() != 0 { + count = 1 + } + + case reflect.Float32, reflect.Float64: + if val.Float() != 0 { + count = 1 + } + + default: + // For any other type, if it's not zero, count it as 1 + if !val.IsZero() { + count = 1 + } + } + + return count +} diff --git a/internal/utils/queryparams.go b/internal/utils/queryparams.go index bba048f..aca7b90 100644 --- a/internal/utils/queryparams.go +++ b/internal/utils/queryparams.go @@ -42,10 +42,13 @@ func PopulateQueryParams(_ context.Context, req *http.Request, queryParams inter } func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { - queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) + queryParamsVal := reflect.ValueOf(queryParams) + if queryParamsVal.Kind() == reflect.Pointer && queryParamsVal.IsNil() { + return nil, nil + } + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), queryParamsVal) globalsAlreadyPopulated := []string{} - for i := 0; i < queryParamsStructType.NumField(); i++ { fieldType := queryParamsStructType.Field(i) valType := queryParamsValType.Field(i) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 76cbe94..0415b53 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -241,6 +241,21 @@ func isNil(typ reflect.Type, val reflect.Value) bool { return false } +func isEmptyContainer(typ reflect.Type, val reflect.Value) bool { + if isNil(typ, val) { + return true + } + + switch typ.Kind() { + case reflect.Slice, reflect.Array: + return val.Len() == 0 + case reflect.Map: + return val.Len() == 0 + default: + return false + } +} + func contains(arr []string, str string) bool { for _, a := range arr { if a == str { diff --git a/library.go b/library.go index 741d2de..29f69a0 100644 --- a/library.go +++ b/library.go @@ -2123,12 +2123,12 @@ func (s *Library) StopAllRefreshes(ctx context.Context, opts ...operations.Optio return nil, err } - var out components.RequestHandlerSlashGetResponses200 + var out components.LibrarySections if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RequestHandlerSlashGetResponses200 = &out + res.LibrarySections = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -2348,12 +2348,12 @@ func (s *Library) GetSectionsPrefs(ctx context.Context, request operations.GetSe return nil, err } - var out components.RequestHandlerSlashGetResponses200 + var out components.LibrarySections if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RequestHandlerSlashGetResponses200 = &out + res.LibrarySections = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -10492,8 +10492,8 @@ func (s *Library) StartAnalysis(ctx context.Context, request operations.StartAna } // Autocomplete - Get autocompletions for search -// The field to autocomplete on is specified by the {field}.query parameter. For example `genre.query` or `title.query`. -// Returns a set of items from the filtered items whose {field} starts with {field}.query. In the results, a {field}.queryRange will be present to express the range of the match +// The field to autocomplete on is specified by the `{field}.query` parameter. For example `genre.query` or `title.query`. +// Returns a set of items from the filtered items whose `{field}` starts with `{field}.query`. In the results, a `{field}.queryRange` will be present to express the range of the match func (s *Library) Autocomplete(ctx context.Context, request operations.AutocompleteRequest, opts ...operations.Option) (*operations.AutocompleteResponse, error) { globals := operations.AutocompleteGlobals{ Accepts: s.sdkConfiguration.Globals.Accepts, diff --git a/models/components/librarysections.go b/models/components/librarysections.go new file mode 100644 index 0000000..6c37570 --- /dev/null +++ b/models/components/librarysections.go @@ -0,0 +1,480 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type LibrarySectionsDirectory struct { + Count *int64 `json:"count,omitempty"` + // The key where this directory is found + Key *string `json:"key,omitempty"` + Title *string `json:"title,omitempty"` +} + +func (l *LibrarySectionsDirectory) GetCount() *int64 { + if l == nil { + return nil + } + return l.Count +} + +func (l *LibrarySectionsDirectory) GetKey() *string { + if l == nil { + return nil + } + return l.Key +} + +func (l *LibrarySectionsDirectory) GetTitle() *string { + if l == nil { + return nil + } + return l.Title +} + +// LibrarySectionsMediaContainer - `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. +// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) +// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track. +type LibrarySectionsMediaContainer struct { + Identifier *string `json:"identifier,omitempty"` + // The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header. + // + Offset *int64 `json:"offset,omitempty"` + Size *int64 `json:"size,omitempty"` + // The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header. + // + TotalSize *int64 `json:"totalSize,omitempty"` + AllowCameraUpload *bool `json:"allowCameraUpload,omitempty"` + AllowChannelAccess *bool `json:"allowChannelAccess,omitempty"` + AllowMediaDeletion *bool `json:"allowMediaDeletion,omitempty"` + AllowSharing *bool `json:"allowSharing,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + AllowTuners *bool `json:"allowTuners,omitempty"` + BackgroundProcessing *bool `json:"backgroundProcessing,omitempty"` + Certificate *bool `json:"certificate,omitempty"` + CompanionProxy *bool `json:"companionProxy,omitempty"` + CountryCode *string `json:"countryCode,omitempty"` + Diagnostics *string `json:"diagnostics,omitempty"` + EventStream *bool `json:"eventStream,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HubSearch *bool `json:"hubSearch,omitempty"` + ItemClusters *bool `json:"itemClusters,omitempty"` + Livetv *int64 `json:"livetv,omitempty"` + MachineIdentifier any `json:"machineIdentifier,omitempty"` + MediaProviders *bool `json:"mediaProviders,omitempty"` + Multiuser *bool `json:"multiuser,omitempty"` + MusicAnalysis *int64 `json:"musicAnalysis,omitempty"` + MyPlex *bool `json:"myPlex,omitempty"` + MyPlexMappingState any `json:"myPlexMappingState,omitempty"` + MyPlexSigninState any `json:"myPlexSigninState,omitempty"` + MyPlexSubscription *bool `json:"myPlexSubscription,omitempty"` + MyPlexUsername *string `json:"myPlexUsername,omitempty"` + OfflineTranscode any `json:"offlineTranscode,omitempty"` + // A comma-separated list of features which are enabled for the server owner + OwnerFeatures *string `json:"ownerFeatures,omitempty"` + Platform *string `json:"platform,omitempty"` + PlatformVersion *string `json:"platformVersion,omitempty"` + PluginHost *bool `json:"pluginHost,omitempty"` + PushNotifications *bool `json:"pushNotifications,omitempty"` + ReadOnlyLibraries *bool `json:"readOnlyLibraries,omitempty"` + StreamingBrainABRVersion *int64 `json:"streamingBrainABRVersion,omitempty"` + StreamingBrainVersion *int64 `json:"streamingBrainVersion,omitempty"` + Sync *bool `json:"sync,omitempty"` + TranscoderActiveVideoSessions *int64 `json:"transcoderActiveVideoSessions,omitempty"` + TranscoderAudio *bool `json:"transcoderAudio,omitempty"` + TranscoderLyrics *bool `json:"transcoderLyrics,omitempty"` + TranscoderPhoto *bool `json:"transcoderPhoto,omitempty"` + TranscoderSubtitles *bool `json:"transcoderSubtitles,omitempty"` + TranscoderVideo *bool `json:"transcoderVideo,omitempty"` + // The suggested video quality bitrates to present to the user + TranscoderVideoBitrates any `json:"transcoderVideoBitrates,omitempty"` + TranscoderVideoQualities *string `json:"transcoderVideoQualities,omitempty"` + // The suggested video resolutions to the above quality bitrates + TranscoderVideoResolutions any `json:"transcoderVideoResolutions,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + Updater *bool `json:"updater,omitempty"` + Version *string `json:"version,omitempty"` + VoiceSearch *bool `json:"voiceSearch,omitempty"` + Directory []LibrarySectionsDirectory `json:"Directory,omitempty"` +} + +func (l *LibrarySectionsMediaContainer) GetIdentifier() *string { + if l == nil { + return nil + } + return l.Identifier +} + +func (l *LibrarySectionsMediaContainer) GetOffset() *int64 { + if l == nil { + return nil + } + return l.Offset +} + +func (l *LibrarySectionsMediaContainer) GetSize() *int64 { + if l == nil { + return nil + } + return l.Size +} + +func (l *LibrarySectionsMediaContainer) GetTotalSize() *int64 { + if l == nil { + return nil + } + return l.TotalSize +} + +func (l *LibrarySectionsMediaContainer) GetAllowCameraUpload() *bool { + if l == nil { + return nil + } + return l.AllowCameraUpload +} + +func (l *LibrarySectionsMediaContainer) GetAllowChannelAccess() *bool { + if l == nil { + return nil + } + return l.AllowChannelAccess +} + +func (l *LibrarySectionsMediaContainer) GetAllowMediaDeletion() *bool { + if l == nil { + return nil + } + return l.AllowMediaDeletion +} + +func (l *LibrarySectionsMediaContainer) GetAllowSharing() *bool { + if l == nil { + return nil + } + return l.AllowSharing +} + +func (l *LibrarySectionsMediaContainer) GetAllowSync() *bool { + if l == nil { + return nil + } + return l.AllowSync +} + +func (l *LibrarySectionsMediaContainer) GetAllowTuners() *bool { + if l == nil { + return nil + } + return l.AllowTuners +} + +func (l *LibrarySectionsMediaContainer) GetBackgroundProcessing() *bool { + if l == nil { + return nil + } + return l.BackgroundProcessing +} + +func (l *LibrarySectionsMediaContainer) GetCertificate() *bool { + if l == nil { + return nil + } + return l.Certificate +} + +func (l *LibrarySectionsMediaContainer) GetCompanionProxy() *bool { + if l == nil { + return nil + } + return l.CompanionProxy +} + +func (l *LibrarySectionsMediaContainer) GetCountryCode() *string { + if l == nil { + return nil + } + return l.CountryCode +} + +func (l *LibrarySectionsMediaContainer) GetDiagnostics() *string { + if l == nil { + return nil + } + return l.Diagnostics +} + +func (l *LibrarySectionsMediaContainer) GetEventStream() *bool { + if l == nil { + return nil + } + return l.EventStream +} + +func (l *LibrarySectionsMediaContainer) GetFriendlyName() *string { + if l == nil { + return nil + } + return l.FriendlyName +} + +func (l *LibrarySectionsMediaContainer) GetHubSearch() *bool { + if l == nil { + return nil + } + return l.HubSearch +} + +func (l *LibrarySectionsMediaContainer) GetItemClusters() *bool { + if l == nil { + return nil + } + return l.ItemClusters +} + +func (l *LibrarySectionsMediaContainer) GetLivetv() *int64 { + if l == nil { + return nil + } + return l.Livetv +} + +func (l *LibrarySectionsMediaContainer) GetMachineIdentifier() any { + if l == nil { + return nil + } + return l.MachineIdentifier +} + +func (l *LibrarySectionsMediaContainer) GetMediaProviders() *bool { + if l == nil { + return nil + } + return l.MediaProviders +} + +func (l *LibrarySectionsMediaContainer) GetMultiuser() *bool { + if l == nil { + return nil + } + return l.Multiuser +} + +func (l *LibrarySectionsMediaContainer) GetMusicAnalysis() *int64 { + if l == nil { + return nil + } + return l.MusicAnalysis +} + +func (l *LibrarySectionsMediaContainer) GetMyPlex() *bool { + if l == nil { + return nil + } + return l.MyPlex +} + +func (l *LibrarySectionsMediaContainer) GetMyPlexMappingState() any { + if l == nil { + return nil + } + return l.MyPlexMappingState +} + +func (l *LibrarySectionsMediaContainer) GetMyPlexSigninState() any { + if l == nil { + return nil + } + return l.MyPlexSigninState +} + +func (l *LibrarySectionsMediaContainer) GetMyPlexSubscription() *bool { + if l == nil { + return nil + } + return l.MyPlexSubscription +} + +func (l *LibrarySectionsMediaContainer) GetMyPlexUsername() *string { + if l == nil { + return nil + } + return l.MyPlexUsername +} + +func (l *LibrarySectionsMediaContainer) GetOfflineTranscode() any { + if l == nil { + return nil + } + return l.OfflineTranscode +} + +func (l *LibrarySectionsMediaContainer) GetOwnerFeatures() *string { + if l == nil { + return nil + } + return l.OwnerFeatures +} + +func (l *LibrarySectionsMediaContainer) GetPlatform() *string { + if l == nil { + return nil + } + return l.Platform +} + +func (l *LibrarySectionsMediaContainer) GetPlatformVersion() *string { + if l == nil { + return nil + } + return l.PlatformVersion +} + +func (l *LibrarySectionsMediaContainer) GetPluginHost() *bool { + if l == nil { + return nil + } + return l.PluginHost +} + +func (l *LibrarySectionsMediaContainer) GetPushNotifications() *bool { + if l == nil { + return nil + } + return l.PushNotifications +} + +func (l *LibrarySectionsMediaContainer) GetReadOnlyLibraries() *bool { + if l == nil { + return nil + } + return l.ReadOnlyLibraries +} + +func (l *LibrarySectionsMediaContainer) GetStreamingBrainABRVersion() *int64 { + if l == nil { + return nil + } + return l.StreamingBrainABRVersion +} + +func (l *LibrarySectionsMediaContainer) GetStreamingBrainVersion() *int64 { + if l == nil { + return nil + } + return l.StreamingBrainVersion +} + +func (l *LibrarySectionsMediaContainer) GetSync() *bool { + if l == nil { + return nil + } + return l.Sync +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderActiveVideoSessions() *int64 { + if l == nil { + return nil + } + return l.TranscoderActiveVideoSessions +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderAudio() *bool { + if l == nil { + return nil + } + return l.TranscoderAudio +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderLyrics() *bool { + if l == nil { + return nil + } + return l.TranscoderLyrics +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderPhoto() *bool { + if l == nil { + return nil + } + return l.TranscoderPhoto +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderSubtitles() *bool { + if l == nil { + return nil + } + return l.TranscoderSubtitles +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderVideo() *bool { + if l == nil { + return nil + } + return l.TranscoderVideo +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderVideoBitrates() any { + if l == nil { + return nil + } + return l.TranscoderVideoBitrates +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderVideoQualities() *string { + if l == nil { + return nil + } + return l.TranscoderVideoQualities +} + +func (l *LibrarySectionsMediaContainer) GetTranscoderVideoResolutions() any { + if l == nil { + return nil + } + return l.TranscoderVideoResolutions +} + +func (l *LibrarySectionsMediaContainer) GetUpdatedAt() *int64 { + if l == nil { + return nil + } + return l.UpdatedAt +} + +func (l *LibrarySectionsMediaContainer) GetUpdater() *bool { + if l == nil { + return nil + } + return l.Updater +} + +func (l *LibrarySectionsMediaContainer) GetVersion() *string { + if l == nil { + return nil + } + return l.Version +} + +func (l *LibrarySectionsMediaContainer) GetVoiceSearch() *bool { + if l == nil { + return nil + } + return l.VoiceSearch +} + +func (l *LibrarySectionsMediaContainer) GetDirectory() []LibrarySectionsDirectory { + if l == nil { + return nil + } + return l.Directory +} + +// LibrarySections - OK +type LibrarySections struct { + MediaContainer *LibrarySectionsMediaContainer `json:"MediaContainer,omitempty"` +} + +func (l *LibrarySections) GetMediaContainer() *LibrarySectionsMediaContainer { + if l == nil { + return nil + } + return l.MediaContainer +} diff --git a/models/components/requesthandlerslashgetresponses200.go b/models/components/requesthandlerslashgetresponses200.go deleted file mode 100644 index 58ae0b0..0000000 --- a/models/components/requesthandlerslashgetresponses200.go +++ /dev/null @@ -1,480 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -type RequestHandlerSlashGetResponses200Directory struct { - Count *int64 `json:"count,omitempty"` - // The key where this directory is found - Key *string `json:"key,omitempty"` - Title *string `json:"title,omitempty"` -} - -func (r *RequestHandlerSlashGetResponses200Directory) GetCount() *int64 { - if r == nil { - return nil - } - return r.Count -} - -func (r *RequestHandlerSlashGetResponses200Directory) GetKey() *string { - if r == nil { - return nil - } - return r.Key -} - -func (r *RequestHandlerSlashGetResponses200Directory) GetTitle() *string { - if r == nil { - return nil - } - return r.Title -} - -// RequestHandlerSlashGetResponses200MediaContainer - `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. -// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) -// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track. -type RequestHandlerSlashGetResponses200MediaContainer struct { - Identifier *string `json:"identifier,omitempty"` - // The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header. - // - Offset *int64 `json:"offset,omitempty"` - Size *int64 `json:"size,omitempty"` - // The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header. - // - TotalSize *int64 `json:"totalSize,omitempty"` - AllowCameraUpload *bool `json:"allowCameraUpload,omitempty"` - AllowChannelAccess *bool `json:"allowChannelAccess,omitempty"` - AllowMediaDeletion *bool `json:"allowMediaDeletion,omitempty"` - AllowSharing *bool `json:"allowSharing,omitempty"` - AllowSync *bool `json:"allowSync,omitempty"` - AllowTuners *bool `json:"allowTuners,omitempty"` - BackgroundProcessing *bool `json:"backgroundProcessing,omitempty"` - Certificate *bool `json:"certificate,omitempty"` - CompanionProxy *bool `json:"companionProxy,omitempty"` - CountryCode *string `json:"countryCode,omitempty"` - Diagnostics *string `json:"diagnostics,omitempty"` - EventStream *bool `json:"eventStream,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - HubSearch *bool `json:"hubSearch,omitempty"` - ItemClusters *bool `json:"itemClusters,omitempty"` - Livetv *int64 `json:"livetv,omitempty"` - MachineIdentifier any `json:"machineIdentifier,omitempty"` - MediaProviders *bool `json:"mediaProviders,omitempty"` - Multiuser *bool `json:"multiuser,omitempty"` - MusicAnalysis *int64 `json:"musicAnalysis,omitempty"` - MyPlex *bool `json:"myPlex,omitempty"` - MyPlexMappingState any `json:"myPlexMappingState,omitempty"` - MyPlexSigninState any `json:"myPlexSigninState,omitempty"` - MyPlexSubscription *bool `json:"myPlexSubscription,omitempty"` - MyPlexUsername *string `json:"myPlexUsername,omitempty"` - OfflineTranscode any `json:"offlineTranscode,omitempty"` - // A comma-separated list of features which are enabled for the server owner - OwnerFeatures *string `json:"ownerFeatures,omitempty"` - Platform *string `json:"platform,omitempty"` - PlatformVersion *string `json:"platformVersion,omitempty"` - PluginHost *bool `json:"pluginHost,omitempty"` - PushNotifications *bool `json:"pushNotifications,omitempty"` - ReadOnlyLibraries *bool `json:"readOnlyLibraries,omitempty"` - StreamingBrainABRVersion *int64 `json:"streamingBrainABRVersion,omitempty"` - StreamingBrainVersion *int64 `json:"streamingBrainVersion,omitempty"` - Sync *bool `json:"sync,omitempty"` - TranscoderActiveVideoSessions *int64 `json:"transcoderActiveVideoSessions,omitempty"` - TranscoderAudio *bool `json:"transcoderAudio,omitempty"` - TranscoderLyrics *bool `json:"transcoderLyrics,omitempty"` - TranscoderPhoto *bool `json:"transcoderPhoto,omitempty"` - TranscoderSubtitles *bool `json:"transcoderSubtitles,omitempty"` - TranscoderVideo *bool `json:"transcoderVideo,omitempty"` - // The suggested video quality bitrates to present to the user - TranscoderVideoBitrates any `json:"transcoderVideoBitrates,omitempty"` - TranscoderVideoQualities *string `json:"transcoderVideoQualities,omitempty"` - // The suggested video resolutions to the above quality bitrates - TranscoderVideoResolutions any `json:"transcoderVideoResolutions,omitempty"` - UpdatedAt *int64 `json:"updatedAt,omitempty"` - Updater *bool `json:"updater,omitempty"` - Version *string `json:"version,omitempty"` - VoiceSearch *bool `json:"voiceSearch,omitempty"` - Directory []RequestHandlerSlashGetResponses200Directory `json:"Directory,omitempty"` -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetIdentifier() *string { - if r == nil { - return nil - } - return r.Identifier -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetOffset() *int64 { - if r == nil { - return nil - } - return r.Offset -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetSize() *int64 { - if r == nil { - return nil - } - return r.Size -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTotalSize() *int64 { - if r == nil { - return nil - } - return r.TotalSize -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowCameraUpload() *bool { - if r == nil { - return nil - } - return r.AllowCameraUpload -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowChannelAccess() *bool { - if r == nil { - return nil - } - return r.AllowChannelAccess -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowMediaDeletion() *bool { - if r == nil { - return nil - } - return r.AllowMediaDeletion -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowSharing() *bool { - if r == nil { - return nil - } - return r.AllowSharing -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowSync() *bool { - if r == nil { - return nil - } - return r.AllowSync -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetAllowTuners() *bool { - if r == nil { - return nil - } - return r.AllowTuners -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetBackgroundProcessing() *bool { - if r == nil { - return nil - } - return r.BackgroundProcessing -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetCertificate() *bool { - if r == nil { - return nil - } - return r.Certificate -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetCompanionProxy() *bool { - if r == nil { - return nil - } - return r.CompanionProxy -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetCountryCode() *string { - if r == nil { - return nil - } - return r.CountryCode -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetDiagnostics() *string { - if r == nil { - return nil - } - return r.Diagnostics -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetEventStream() *bool { - if r == nil { - return nil - } - return r.EventStream -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetFriendlyName() *string { - if r == nil { - return nil - } - return r.FriendlyName -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetHubSearch() *bool { - if r == nil { - return nil - } - return r.HubSearch -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetItemClusters() *bool { - if r == nil { - return nil - } - return r.ItemClusters -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetLivetv() *int64 { - if r == nil { - return nil - } - return r.Livetv -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMachineIdentifier() any { - if r == nil { - return nil - } - return r.MachineIdentifier -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMediaProviders() *bool { - if r == nil { - return nil - } - return r.MediaProviders -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMultiuser() *bool { - if r == nil { - return nil - } - return r.Multiuser -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMusicAnalysis() *int64 { - if r == nil { - return nil - } - return r.MusicAnalysis -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMyPlex() *bool { - if r == nil { - return nil - } - return r.MyPlex -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMyPlexMappingState() any { - if r == nil { - return nil - } - return r.MyPlexMappingState -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMyPlexSigninState() any { - if r == nil { - return nil - } - return r.MyPlexSigninState -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMyPlexSubscription() *bool { - if r == nil { - return nil - } - return r.MyPlexSubscription -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetMyPlexUsername() *string { - if r == nil { - return nil - } - return r.MyPlexUsername -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetOfflineTranscode() any { - if r == nil { - return nil - } - return r.OfflineTranscode -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetOwnerFeatures() *string { - if r == nil { - return nil - } - return r.OwnerFeatures -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetPlatform() *string { - if r == nil { - return nil - } - return r.Platform -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetPlatformVersion() *string { - if r == nil { - return nil - } - return r.PlatformVersion -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetPluginHost() *bool { - if r == nil { - return nil - } - return r.PluginHost -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetPushNotifications() *bool { - if r == nil { - return nil - } - return r.PushNotifications -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetReadOnlyLibraries() *bool { - if r == nil { - return nil - } - return r.ReadOnlyLibraries -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetStreamingBrainABRVersion() *int64 { - if r == nil { - return nil - } - return r.StreamingBrainABRVersion -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetStreamingBrainVersion() *int64 { - if r == nil { - return nil - } - return r.StreamingBrainVersion -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetSync() *bool { - if r == nil { - return nil - } - return r.Sync -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderActiveVideoSessions() *int64 { - if r == nil { - return nil - } - return r.TranscoderActiveVideoSessions -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderAudio() *bool { - if r == nil { - return nil - } - return r.TranscoderAudio -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderLyrics() *bool { - if r == nil { - return nil - } - return r.TranscoderLyrics -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderPhoto() *bool { - if r == nil { - return nil - } - return r.TranscoderPhoto -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderSubtitles() *bool { - if r == nil { - return nil - } - return r.TranscoderSubtitles -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderVideo() *bool { - if r == nil { - return nil - } - return r.TranscoderVideo -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderVideoBitrates() any { - if r == nil { - return nil - } - return r.TranscoderVideoBitrates -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderVideoQualities() *string { - if r == nil { - return nil - } - return r.TranscoderVideoQualities -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetTranscoderVideoResolutions() any { - if r == nil { - return nil - } - return r.TranscoderVideoResolutions -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetUpdatedAt() *int64 { - if r == nil { - return nil - } - return r.UpdatedAt -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetUpdater() *bool { - if r == nil { - return nil - } - return r.Updater -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetVersion() *string { - if r == nil { - return nil - } - return r.Version -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetVoiceSearch() *bool { - if r == nil { - return nil - } - return r.VoiceSearch -} - -func (r *RequestHandlerSlashGetResponses200MediaContainer) GetDirectory() []RequestHandlerSlashGetResponses200Directory { - if r == nil { - return nil - } - return r.Directory -} - -// RequestHandlerSlashGetResponses200 - OK -type RequestHandlerSlashGetResponses200 struct { - MediaContainer *RequestHandlerSlashGetResponses200MediaContainer `json:"MediaContainer,omitempty"` -} - -func (r *RequestHandlerSlashGetResponses200) GetMediaContainer() *RequestHandlerSlashGetResponses200MediaContainer { - if r == nil { - return nil - } - return r.MediaContainer -} diff --git a/models/operations/getsectionsprefs.go b/models/operations/getsectionsprefs.go index c18b730..09e661a 100644 --- a/models/operations/getsectionsprefs.go +++ b/models/operations/getsectionsprefs.go @@ -260,7 +260,7 @@ type GetSectionsPrefsResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // OK - RequestHandlerSlashGetResponses200 *components.RequestHandlerSlashGetResponses200 + LibrarySections *components.LibrarySections } func (g *GetSectionsPrefsResponse) GetContentType() string { @@ -284,9 +284,9 @@ func (g *GetSectionsPrefsResponse) GetRawResponse() *http.Response { return g.RawResponse } -func (g *GetSectionsPrefsResponse) GetRequestHandlerSlashGetResponses200() *components.RequestHandlerSlashGetResponses200 { +func (g *GetSectionsPrefsResponse) GetLibrarySections() *components.LibrarySections { if g == nil { return nil } - return g.RequestHandlerSlashGetResponses200 + return g.LibrarySections } diff --git a/models/operations/stopallrefreshes.go b/models/operations/stopallrefreshes.go index bd30f68..0522886 100644 --- a/models/operations/stopallrefreshes.go +++ b/models/operations/stopallrefreshes.go @@ -15,7 +15,7 @@ type StopAllRefreshesResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // OK - RequestHandlerSlashGetResponses200 *components.RequestHandlerSlashGetResponses200 + LibrarySections *components.LibrarySections } func (s *StopAllRefreshesResponse) GetContentType() string { @@ -39,9 +39,9 @@ func (s *StopAllRefreshesResponse) GetRawResponse() *http.Response { return s.RawResponse } -func (s *StopAllRefreshesResponse) GetRequestHandlerSlashGetResponses200() *components.RequestHandlerSlashGetResponses200 { +func (s *StopAllRefreshesResponse) GetLibrarySections() *components.LibrarySections { if s == nil { return nil } - return s.RequestHandlerSlashGetResponses200 + return s.LibrarySections } diff --git a/plexapi.go b/plexapi.go index d0e1394..1c3595e 100644 --- a/plexapi.go +++ b/plexapi.go @@ -2,7 +2,7 @@ package plexgo -// Generated from OpenAPI doc version 1.1.1 and generator version 2.723.11 +// Generated from OpenAPI doc version 1.1.1 and generator version 2.753.1 import ( "context" @@ -262,15 +262,15 @@ func WithHost(host string) SDKOption { } } -// WithGlobalServerURL allows setting the server_url variable for url substitution -func WithGlobalServerURL(serverURL string) SDKOption { +// WithFullServerURL allows setting the full_server_url variable for url substitution +func WithFullServerURL(fullServerURL string) SDKOption { return func(sdk *PlexAPI) { for idx := range sdk.sdkConfiguration.ServerVariables { - if _, ok := sdk.sdkConfiguration.ServerVariables[idx]["server_url"]; !ok { + if _, ok := sdk.sdkConfiguration.ServerVariables[idx]["full_server_url"]; !ok { continue } - sdk.sdkConfiguration.ServerVariables[idx]["server_url"] = fmt.Sprintf("%v", serverURL) + sdk.sdkConfiguration.ServerVariables[idx]["full_server_url"] = fmt.Sprintf("%v", fullServerURL) } } } @@ -392,9 +392,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *PlexAPI { sdk := &PlexAPI{ - SDKVersion: "0.26.1", + SDKVersion: "0.27.0", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.26.1 2.723.11 1.1.1 github.com/LukeHagar/plexgo", + UserAgent: "speakeasy-sdk/go 0.27.0 2.753.1 1.1.1 github.com/LukeHagar/plexgo", Globals: globals.Globals{}, ServerList: ServerList, ServerVariables: []map[string]string{ @@ -409,7 +409,7 @@ func New(opts ...SDKOption) *PlexAPI { "port": "32400", }, { - "server_url": "http://localhost:32400", + "full_server_url": "http://localhost:32400", }, }, },