diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 578b56e0..a72de61d 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -4,16 +4,17 @@ management: docChecksum: 34d22936f2456c2c461abdfc773e3fc4 docVersion: 0.0.3 speakeasyVersion: internal - generationVersion: 2.230.3 - releaseVersion: 0.3.3 - configChecksum: 0746fdeae11f375609eda58acff68018 + generationVersion: 2.233.2 + releaseVersion: 0.4.0 + configChecksum: 857d3a3d03c912d0f09faf0342203722 repoURL: https://github.com/LukeHagar/plexjs.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexjs published: true features: typescript: - core: 3.4.5 + constsAndDefaults: 0.1.1 + core: 3.4.6 flattening: 2.81.1 globalSecurity: 2.82.2 globalServerURLs: 2.82.1 @@ -35,6 +36,7 @@ generatedFiles: - src/sdk/sdk.ts - .eslintrc.js - .npmignore + - RUNTIMES.md - package-lock.json - package.json - src/index.ts diff --git a/README.md b/README.md index 6545d5c4..2c8bbe52 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerCapabilities(); + const result = await sdk.server.getServerCapabilities(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result); } run(); @@ -172,20 +169,23 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerCapabilities().catch((err) => { - if (err instanceof errors.GetServerCapabilitiesResponseBody) { - console.error(err); // handle exception - return null; - } else { - throw err; + let result; + try { + result = await sdk.server.getServerCapabilities(); + } catch (err) { + switch (true) { + case err instanceof errors.GetServerCapabilitiesResponseBody: { + console.error(err); // handle exception + return; + } + default: { + throw err; + } } - }); - - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); } - // handle response + // Handle the result + console.log(result); } run(); @@ -198,13 +198,30 @@ run(); ### Select Server by Index -You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: +You can override the default server globally by passing a server index to the `serverIdx` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: | # | Server | Variables | | - | ------ | --------- | | 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `http`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) | +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; +async function run() { + const sdk = new PlexAPI({ + serverIdx: 0, + accessToken: "", + }); + + const result = await sdk.server.getServerCapabilities(); + + // Handle the result + console.log(result); +} + +run(); + +``` #### Variables @@ -215,7 +232,26 @@ Some of the server options above contain variables. If you want to set the value ### Override Server URL Per-Client -The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example: +The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example: + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +async function run() { + const sdk = new PlexAPI({ + serverURL: "{protocol}://{ip}:{port}", + accessToken: "", + }); + + const result = await sdk.server.getServerCapabilities(); + + // Handle the result + console.log(result); +} + +run(); + +``` @@ -287,13 +323,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerCapabilities(); + const result = await sdk.server.getServerCapabilities(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result); } run(); @@ -301,6 +334,12 @@ run(); ``` + +## Requirements + +For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md). + + # Development diff --git a/RELEASES.md b/RELEASES.md index 21068d32..d7c0e9ff 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -68,4 +68,14 @@ Based on: ### Generated - [typescript v0.3.3] . ### Releases -- [NPM v0.3.3] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.3 - . \ No newline at end of file +- [NPM v0.3.3] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.3 - . + +## 2024-01-16 00:27:43 +### Changes +Based on: +- OpenAPI Doc 0.0.3 +- Speakeasy CLI 1.141.1 (2.233.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.4.0] . +### Releases +- [NPM v0.4.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.0 - . \ No newline at end of file diff --git a/RUNTIMES.md b/RUNTIMES.md new file mode 100644 index 00000000..71fa3dae --- /dev/null +++ b/RUNTIMES.md @@ -0,0 +1,22 @@ +# Supported JavaScript runtimes + +This SDK is intended to be used in JavaScript runtimes that support the following features: + +* [Web Fetch API][web-fetch] +* [Web Streams API](web-streams) and in particular `ReadableStream` +* [Async iterables][async-iter] using `Symbol.asyncIterator` + +[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API +[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API +[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols + +Runtime environments that are explicitly supported are: + +- Evergreen browsers which include: Chrome, Safari, Edge, Firefox +- Node.js active and maintenance LTS releases + - Currently, this is v18 and v20 +- Bun v1 and above +- Deno v1.39 + - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming]) + +[deno-file-streaming]: https://github.com/denoland/deno/issues/11018 diff --git a/USAGE.md b/USAGE.md index 202474af..0f07724d 100644 --- a/USAGE.md +++ b/USAGE.md @@ -7,13 +7,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerCapabilities(); + const result = await sdk.server.getServerCapabilities(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result); } run(); diff --git a/docs/sdks/activities/README.md b/docs/sdks/activities/README.md index d0383ebb..7e4d9dc6 100644 --- a/docs/sdks/activities/README.md +++ b/docs/sdks/activities/README.md @@ -31,13 +31,10 @@ async function run() { accessToken: "", }); - const res = await sdk.activities.getServerActivities(); + const result = await sdk.activities.getServerActivities(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -77,13 +74,10 @@ async function run() { const activityUUID = "string"; - const res = await sdk.activities.cancelServerActivities(activityUUID); + const result = await sdk.activities.cancelServerActivities(activityUUID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/butler/README.md b/docs/sdks/butler/README.md index 9b2de772..6ea31129 100644 --- a/docs/sdks/butler/README.md +++ b/docs/sdks/butler/README.md @@ -28,13 +28,10 @@ async function run() { accessToken: "", }); - const res = await sdk.butler.getButlerTasks(); + const result = await sdk.butler.getButlerTasks(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -77,13 +74,10 @@ async function run() { accessToken: "", }); - const res = await sdk.butler.startAllTasks(); + const result = await sdk.butler.startAllTasks(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -122,13 +116,10 @@ async function run() { accessToken: "", }); - const res = await sdk.butler.stopAllTasks(); + const result = await sdk.butler.stopAllTasks(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -174,13 +165,10 @@ async function run() { const taskName = TaskName.CleanOldBundles; - const res = await sdk.butler.startTask(taskName); + const result = await sdk.butler.startTask(taskName); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -223,13 +211,10 @@ async function run() { const taskName = PathParamTaskName.BackupDatabase; - const res = await sdk.butler.stopTask(taskName); + const result = await sdk.butler.stopTask(taskName); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index 4dcd69ce..f1cd2067 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -29,13 +29,10 @@ async function run() { const count = 1262.49; const onlyTransient = OnlyTransient.One; - const res = await sdk.hubs.getGlobalHubs(count, onlyTransient); + const result = await sdk.hubs.getGlobalHubs(count, onlyTransient); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -81,13 +78,10 @@ async function run() { const count = 9010.22; const onlyTransient = QueryParamOnlyTransient.Zero; - const res = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient); + const result = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 4e450466..1efc89b2 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -38,13 +38,10 @@ async function run() { const url = "file://C:\Image.png&type=13"; const type = 4462.17; - const res = await sdk.library.getFileHash(url, type); + const result = await sdk.library.getFileHash(url, type); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -85,13 +82,10 @@ async function run() { accessToken: "", }); - const res = await sdk.library.getRecentlyAdded(); + const result = await sdk.library.getRecentlyAdded(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -135,13 +129,10 @@ async function run() { accessToken: "", }); - const res = await sdk.library.getLibraries(); + const result = await sdk.library.getLibraries(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -202,13 +193,10 @@ async function run() { const sectionId = 1000; const includeDetails = IncludeDetails.Zero; - const res = await sdk.library.getLibrary(sectionId, includeDetails); + const result = await sdk.library.getLibrary(sectionId, includeDetails); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -250,13 +238,10 @@ async function run() { const sectionId = 1000; - const res = await sdk.library.deleteLibrary(sectionId); + const result = await sdk.library.deleteLibrary(sectionId); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -300,13 +285,10 @@ async function run() { const type = 760.66; const filter = "string"; - const res = await sdk.library.getLibraryItems(sectionId, type, filter); + const result = await sdk.library.getLibraryItems(sectionId, type, filter); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -350,13 +332,10 @@ async function run() { const sectionId = 934.16; - const res = await sdk.library.refreshLibrary(sectionId); + const result = await sdk.library.refreshLibrary(sectionId); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -400,13 +379,10 @@ async function run() { const type = 8015.12; const filter = "string"; - const res = await sdk.library.getLatestLibraryItems(sectionId, type, filter); + const result = await sdk.library.getLatestLibraryItems(sectionId, type, filter); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -452,13 +428,10 @@ async function run() { const type = 2760.31; const filter = "string"; - const res = await sdk.library.getCommonLibraryItems(sectionId, type, filter); + const result = await sdk.library.getCommonLibraryItems(sectionId, type, filter); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -502,13 +475,10 @@ async function run() { const ratingKey = 8382.31; - const res = await sdk.library.getMetadata(ratingKey); + const result = await sdk.library.getMetadata(ratingKey); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -550,13 +520,10 @@ async function run() { const ratingKey = 1539.14; - const res = await sdk.library.getMetadataChildren(ratingKey); + const result = await sdk.library.getMetadataChildren(ratingKey); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -596,13 +563,10 @@ async function run() { accessToken: "", }); - const res = await sdk.library.getOnDeck(); + const result = await sdk.library.getOnDeck(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md index 11699025..d79b1570 100644 --- a/docs/sdks/log/README.md +++ b/docs/sdks/log/README.md @@ -32,13 +32,10 @@ async function run() { const message = "string"; const source = "string"; - const res = await sdk.log.logLine(level, message, source); + const result = await sdk.log.logLine(level, message, source); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -80,13 +77,10 @@ async function run() { accessToken: "", }); - const res = await sdk.log.logMultiLine(); + const result = await sdk.log.logMultiLine(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -125,13 +119,10 @@ async function run() { accessToken: "", }); - const res = await sdk.log.enablePaperTrail(); + const result = await sdk.log.enablePaperTrail(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/media/README.md b/docs/sdks/media/README.md index 00df62a9..719722a9 100644 --- a/docs/sdks/media/README.md +++ b/docs/sdks/media/README.md @@ -28,13 +28,10 @@ async function run() { const key = 59398; - const res = await sdk.media.markPlayed(key); + const result = await sdk.media.markPlayed(key); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -75,13 +72,10 @@ async function run() { const key = 59398; - const res = await sdk.media.markUnplayed(key); + const result = await sdk.media.markUnplayed(key); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -125,13 +119,10 @@ async function run() { const time = 6900.91; const state = "string"; - const res = await sdk.media.updatePlayProgress(key, time, state); + const result = await sdk.media.updatePlayProgress(key, time, state); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index 66139ee8..8902f19b 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -39,17 +39,14 @@ async function run() { accessToken: "", }); - const res = await sdk.playlists.createPlaylist({ + const result = await sdk.playlists.createPlaylist({ title: "string", type: TypeT.Photo, smart: Smart.One, }); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -92,13 +89,10 @@ async function run() { const playlistType = PlaylistType.Audio; const smart = QueryParamSmart.Zero; - const res = await sdk.playlists.getPlaylists(playlistType, smart); + const result = await sdk.playlists.getPlaylists(playlistType, smart); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -142,13 +136,10 @@ async function run() { const playlistID = 4109.48; - const res = await sdk.playlists.getPlaylist(playlistID); + const result = await sdk.playlists.getPlaylist(playlistID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -190,13 +181,10 @@ async function run() { const playlistID = 216.22; - const res = await sdk.playlists.deletePlaylist(playlistID); + const result = await sdk.playlists.deletePlaylist(playlistID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -238,13 +226,10 @@ async function run() { const playlistID = 3915; - const res = await sdk.playlists.updatePlaylist(playlistID); + const result = await sdk.playlists.updatePlaylist(playlistID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -290,13 +275,10 @@ async function run() { const playlistID = 5004.46; const type = 9403.59; - const res = await sdk.playlists.getPlaylistContents(playlistID, type); + const result = await sdk.playlists.getPlaylistContents(playlistID, type); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -339,13 +321,10 @@ async function run() { const playlistID = 1893.18; - const res = await sdk.playlists.clearPlaylistContents(playlistID); + const result = await sdk.playlists.clearPlaylistContents(playlistID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -390,13 +369,10 @@ async function run() { const uri = "library://.."; const playQueueID = 123; - const res = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID); + const result = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -442,13 +418,10 @@ async function run() { const path = "/home/barkley/playlist.m3u"; const force = Force.Zero; - const res = await sdk.playlists.uploadPlaylist(path, force); + const result = await sdk.playlists.uploadPlaylist(path, force); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 086f1d1c..50ee9a28 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -42,13 +42,10 @@ async function run() { const sectionId = 1516.53; const limit = 5; - const res = await sdk.search.performSearch(query, sectionId, limit); + const result = await sdk.search.performSearch(query, sectionId, limit); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -97,13 +94,10 @@ async function run() { const sectionId = 4094.8; const limit = 5; - const res = await sdk.search.performVoiceSearch(query, sectionId, limit); + const result = await sdk.search.performVoiceSearch(query, sectionId, limit); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -146,13 +140,10 @@ async function run() { const query = "110"; - const res = await sdk.search.getSearchResults(query); + const result = await sdk.search.getSearchResults(query); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/security/README.md b/docs/sdks/security/README.md index 98c1dfe9..3f8aaf75 100644 --- a/docs/sdks/security/README.md +++ b/docs/sdks/security/README.md @@ -30,13 +30,10 @@ async function run() { const type = QueryParamType.Delegation; const scope = Scope.All; - const res = await sdk.security.getTransientToken(type, scope); + const result = await sdk.security.getTransientToken(type, scope); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -80,13 +77,10 @@ async function run() { const source = "server://client-identifier"; - const res = await sdk.security.getSourceConnectionInformation(source); + const result = await sdk.security.getSourceConnectionInformation(source); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index 496f01bb..2064c074 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -31,13 +31,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerCapabilities(); + const result = await sdk.server.getServerCapabilities(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -75,13 +72,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerPreferences(); + const result = await sdk.server.getServerPreferences(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -119,13 +113,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getAvailableClients(); + const result = await sdk.server.getAvailableClients(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -163,13 +154,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getDevices(); + const result = await sdk.server.getDevices(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -207,13 +195,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerIdentity(); + const result = await sdk.server.getServerIdentity(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -251,13 +236,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getMyPlexAccount(); + const result = await sdk.server.getMyPlexAccount(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -297,7 +279,7 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getResizedPhoto({ + const result = await sdk.server.getResizedPhoto({ width: 110, height: 165, opacity: 643869, @@ -307,11 +289,8 @@ async function run() { url: "/library/metadata/49564/thumb/1654258204", }); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -350,13 +329,10 @@ async function run() { accessToken: "", }); - const res = await sdk.server.getServerList(); + const result = await sdk.server.getServerList(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index 51341681..aebc1ab4 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -27,13 +27,10 @@ async function run() { accessToken: "", }); - const res = await sdk.sessions.getSessions(); + const result = await sdk.sessions.getSessions(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -71,13 +68,10 @@ async function run() { accessToken: "", }); - const res = await sdk.sessions.getSessionHistory(); + const result = await sdk.sessions.getSessionHistory(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -115,13 +109,10 @@ async function run() { accessToken: "", }); - const res = await sdk.sessions.getTranscodeSessions(); + const result = await sdk.sessions.getTranscodeSessions(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -161,13 +152,10 @@ async function run() { const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep"; - const res = await sdk.sessions.stopTranscodeSession(sessionKey); + const result = await sdk.sessions.stopTranscodeSession(sessionKey); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/updater/README.md b/docs/sdks/updater/README.md index e89751e1..15d758ad 100644 --- a/docs/sdks/updater/README.md +++ b/docs/sdks/updater/README.md @@ -27,13 +27,10 @@ async function run() { accessToken: "", }); - const res = await sdk.updater.getUpdateStatus(); + const result = await sdk.updater.getUpdateStatus(); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -74,13 +71,10 @@ async function run() { const download = Download.One; - const res = await sdk.updater.checkForUpdates(download); + const result = await sdk.updater.checkForUpdates(download); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -124,13 +118,10 @@ async function run() { const tonight = Tonight.One; const skip = Skip.Zero; - const res = await sdk.updater.applyUpdates(tonight, skip); + const result = await sdk.updater.applyUpdates(tonight, skip); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/docs/sdks/video/README.md b/docs/sdks/video/README.md index 4f396467..8d21b616 100644 --- a/docs/sdks/video/README.md +++ b/docs/sdks/video/README.md @@ -25,7 +25,7 @@ async function run() { accessToken: "", }); - const res = await sdk.video.startUniversalTranscode({ + const result = await sdk.video.startUniversalTranscode({ hasMDE: 8924.99, path: "/etc/mail", mediaIndex: 9962.95, @@ -33,11 +33,8 @@ async function run() { protocol: "string", }); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); @@ -77,7 +74,7 @@ async function run() { accessToken: "", }); - const res = await sdk.video.getTimeline({ + const result = await sdk.video.getTimeline({ ratingKey: 716.56, key: "", state: State.Paused, @@ -90,11 +87,8 @@ async function run() { row: 3536.42, }); - if (res?.statusCode !== 200) { - throw new Error("Unexpected status code: " + res?.statusCode || "-"); - } - - // handle response + // Handle the result + console.log(result) } run(); diff --git a/gen.yaml b/gen.yaml index 03b3ab9c..4bf0131b 100755 --- a/gen.yaml +++ b/gen.yaml @@ -8,7 +8,7 @@ generation: fixes: nameResolutionDec2023: false typescript: - version: 0.3.3 + version: 0.4.0 author: LukeHagar clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true diff --git a/package-lock.json b/package-lock.json index ef2a8890..0aca0fc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lukehagar/plexjs", - "version": "0.3.3", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lukehagar/plexjs", - "version": "0.3.3", + "version": "0.4.0", "dependencies": { "decimal.js": "^10.4.3", "jsonpath": "^1.1.1" diff --git a/package.json b/package.json index dbe488bf..8879b5fd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "commonjs", "name": "@lukehagar/plexjs", - "version": "0.3.3", + "version": "0.4.0", "author": "LukeHagar", "main": "./index.js", "sideEffects": false, diff --git a/src/lib/config.ts b/src/lib/config.ts index d5f77921..791f8d57 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL { export const SDK_METADATA = Object.freeze({ language: "typescript", openapiDocVersion: "0.0.3", - sdkVersion: "0.3.3", - genVersion: "2.230.3", - userAgent: "speakeasy-sdk/typescript 0.3.3 2.230.3 0.0.3 @lukehagar/plexjs", + sdkVersion: "0.4.0", + genVersion: "2.233.2", + userAgent: "speakeasy-sdk/typescript 0.4.0 2.233.2 0.0.3 @lukehagar/plexjs", }); diff --git a/src/lib/encodings.ts b/src/lib/encodings.ts index 4ee538b9..71ce003f 100644 --- a/src/lib/encodings.ts +++ b/src/lib/encodings.ts @@ -5,8 +5,8 @@ import { bytesToBase64 } from "./base64"; export class EncodingError extends Error { - constructor(message: string, options?: ErrorOptions) { - super(message, options); + constructor(message: string) { + super(message); this.name = "EncodingError"; } } diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts index be69e114..68fd5770 100644 --- a/src/lib/sdks.ts +++ b/src/lib/sdks.ts @@ -23,14 +23,14 @@ type RequestConfig = { }; export class ClientSDK { - readonly #client: HTTPClient; + private readonly client: HTTPClient; protected readonly baseURL: URL; constructor(init: { client: HTTPClient; baseURL: URL }) { const url = init.baseURL; url.pathname = url.pathname.replace(/\/+$/, "") + "/"; - this.#client = init.client; + this.client = init.client; this.baseURL = url; } @@ -92,7 +92,7 @@ export class ClientSDK { method, }); - return this.#client.request(req); + return this.client.request(req); } protected unpackHeaders = unpackHeaders; diff --git a/src/lib/security.ts b/src/lib/security.ts index 0c7236bf..220dff6c 100644 --- a/src/lib/security.ts +++ b/src/lib/security.ts @@ -10,8 +10,8 @@ export enum SecurityErrorCode { } export class SecurityError extends Error { - constructor(public code: SecurityErrorCode, message: string, options?: ErrorOptions) { - super(message, options); + constructor(public code: SecurityErrorCode, message: string) { + super(message); this.name = "SecurityError"; } diff --git a/src/models/errors/addplaylistcontents.ts b/src/models/errors/addplaylistcontents.ts index a04e71c2..bd2e606b 100644 --- a/src/models/errors/addplaylistcontents.ts +++ b/src/models/errors/addplaylistcontents.ts @@ -34,8 +34,8 @@ export class AddPlaylistContentsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: AddPlaylistContentsResponseBodyData; - constructor(err: AddPlaylistContentsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: AddPlaylistContentsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/applyupdates.ts b/src/models/errors/applyupdates.ts index 619e5da9..9b2f37a2 100644 --- a/src/models/errors/applyupdates.ts +++ b/src/models/errors/applyupdates.ts @@ -34,8 +34,8 @@ export class ApplyUpdatesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: ApplyUpdatesResponseBodyData; - constructor(err: ApplyUpdatesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: ApplyUpdatesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/cancelserveractivities.ts b/src/models/errors/cancelserveractivities.ts index 1dfd6af5..b99939dc 100644 --- a/src/models/errors/cancelserveractivities.ts +++ b/src/models/errors/cancelserveractivities.ts @@ -34,8 +34,8 @@ export class CancelServerActivitiesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: CancelServerActivitiesResponseBodyData; - constructor(err: CancelServerActivitiesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: CancelServerActivitiesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/checkforupdates.ts b/src/models/errors/checkforupdates.ts index 240b7617..46ae79d5 100644 --- a/src/models/errors/checkforupdates.ts +++ b/src/models/errors/checkforupdates.ts @@ -34,8 +34,8 @@ export class CheckForUpdatesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: CheckForUpdatesResponseBodyData; - constructor(err: CheckForUpdatesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: CheckForUpdatesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/clearplaylistcontents.ts b/src/models/errors/clearplaylistcontents.ts index da09e1e7..9a02f497 100644 --- a/src/models/errors/clearplaylistcontents.ts +++ b/src/models/errors/clearplaylistcontents.ts @@ -34,8 +34,8 @@ export class ClearPlaylistContentsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: ClearPlaylistContentsResponseBodyData; - constructor(err: ClearPlaylistContentsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: ClearPlaylistContentsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/createplaylist.ts b/src/models/errors/createplaylist.ts index 1492e516..612c6311 100644 --- a/src/models/errors/createplaylist.ts +++ b/src/models/errors/createplaylist.ts @@ -34,8 +34,8 @@ export class CreatePlaylistResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: CreatePlaylistResponseBodyData; - constructor(err: CreatePlaylistResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: CreatePlaylistResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/deletelibrary.ts b/src/models/errors/deletelibrary.ts index 6958298a..07ccb639 100644 --- a/src/models/errors/deletelibrary.ts +++ b/src/models/errors/deletelibrary.ts @@ -34,8 +34,8 @@ export class DeleteLibraryResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: DeleteLibraryResponseBodyData; - constructor(err: DeleteLibraryResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: DeleteLibraryResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/deleteplaylist.ts b/src/models/errors/deleteplaylist.ts index cdfe224c..6f18f36a 100644 --- a/src/models/errors/deleteplaylist.ts +++ b/src/models/errors/deleteplaylist.ts @@ -34,8 +34,8 @@ export class DeletePlaylistResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: DeletePlaylistResponseBodyData; - constructor(err: DeletePlaylistResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: DeletePlaylistResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/enablepapertrail.ts b/src/models/errors/enablepapertrail.ts index 2639241e..3471e924 100644 --- a/src/models/errors/enablepapertrail.ts +++ b/src/models/errors/enablepapertrail.ts @@ -34,8 +34,8 @@ export class EnablePaperTrailResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: EnablePaperTrailResponseBodyData; - constructor(err: EnablePaperTrailResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: EnablePaperTrailResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getavailableclients.ts b/src/models/errors/getavailableclients.ts index 0c311dbd..bc164acf 100644 --- a/src/models/errors/getavailableclients.ts +++ b/src/models/errors/getavailableclients.ts @@ -34,8 +34,8 @@ export class GetAvailableClientsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetAvailableClientsResponseBodyData; - constructor(err: GetAvailableClientsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetAvailableClientsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getbutlertasks.ts b/src/models/errors/getbutlertasks.ts index 93cee404..cbee8d90 100644 --- a/src/models/errors/getbutlertasks.ts +++ b/src/models/errors/getbutlertasks.ts @@ -34,8 +34,8 @@ export class GetButlerTasksResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetButlerTasksResponseBodyData; - constructor(err: GetButlerTasksResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetButlerTasksResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getcommonlibraryitems.ts b/src/models/errors/getcommonlibraryitems.ts index 2876d299..98c6dc6f 100644 --- a/src/models/errors/getcommonlibraryitems.ts +++ b/src/models/errors/getcommonlibraryitems.ts @@ -34,8 +34,8 @@ export class GetCommonLibraryItemsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetCommonLibraryItemsResponseBodyData; - constructor(err: GetCommonLibraryItemsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetCommonLibraryItemsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getdevices.ts b/src/models/errors/getdevices.ts index 594b73eb..7d5c2ecb 100644 --- a/src/models/errors/getdevices.ts +++ b/src/models/errors/getdevices.ts @@ -34,8 +34,8 @@ export class GetDevicesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetDevicesResponseBodyData; - constructor(err: GetDevicesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetDevicesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getfilehash.ts b/src/models/errors/getfilehash.ts index 7728b02c..5c6939c4 100644 --- a/src/models/errors/getfilehash.ts +++ b/src/models/errors/getfilehash.ts @@ -34,8 +34,8 @@ export class GetFileHashResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetFileHashResponseBodyData; - constructor(err: GetFileHashResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetFileHashResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getglobalhubs.ts b/src/models/errors/getglobalhubs.ts index 40e72ffa..696c2ab4 100644 --- a/src/models/errors/getglobalhubs.ts +++ b/src/models/errors/getglobalhubs.ts @@ -34,8 +34,8 @@ export class GetGlobalHubsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetGlobalHubsResponseBodyData; - constructor(err: GetGlobalHubsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetGlobalHubsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getlatestlibraryitems.ts b/src/models/errors/getlatestlibraryitems.ts index 5c87b776..c682c051 100644 --- a/src/models/errors/getlatestlibraryitems.ts +++ b/src/models/errors/getlatestlibraryitems.ts @@ -34,8 +34,8 @@ export class GetLatestLibraryItemsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetLatestLibraryItemsResponseBodyData; - constructor(err: GetLatestLibraryItemsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetLatestLibraryItemsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getlibraries.ts b/src/models/errors/getlibraries.ts index 233e68f9..019aaa36 100644 --- a/src/models/errors/getlibraries.ts +++ b/src/models/errors/getlibraries.ts @@ -34,8 +34,8 @@ export class GetLibrariesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetLibrariesResponseBodyData; - constructor(err: GetLibrariesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetLibrariesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getlibrary.ts b/src/models/errors/getlibrary.ts index ea76cca3..92a44885 100644 --- a/src/models/errors/getlibrary.ts +++ b/src/models/errors/getlibrary.ts @@ -34,8 +34,8 @@ export class GetLibraryResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetLibraryResponseBodyData; - constructor(err: GetLibraryResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetLibraryResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getlibraryhubs.ts b/src/models/errors/getlibraryhubs.ts index 884bc815..ca55d37c 100644 --- a/src/models/errors/getlibraryhubs.ts +++ b/src/models/errors/getlibraryhubs.ts @@ -34,8 +34,8 @@ export class GetLibraryHubsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetLibraryHubsResponseBodyData; - constructor(err: GetLibraryHubsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetLibraryHubsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getlibraryitems.ts b/src/models/errors/getlibraryitems.ts index 6479f0fe..4a65d7f2 100644 --- a/src/models/errors/getlibraryitems.ts +++ b/src/models/errors/getlibraryitems.ts @@ -34,8 +34,8 @@ export class GetLibraryItemsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetLibraryItemsResponseBodyData; - constructor(err: GetLibraryItemsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetLibraryItemsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getmetadata.ts b/src/models/errors/getmetadata.ts index e53b6b13..10f83bb3 100644 --- a/src/models/errors/getmetadata.ts +++ b/src/models/errors/getmetadata.ts @@ -34,8 +34,8 @@ export class GetMetadataResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetMetadataResponseBodyData; - constructor(err: GetMetadataResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetMetadataResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getmetadatachildren.ts b/src/models/errors/getmetadatachildren.ts index fdd0c033..8c03ce79 100644 --- a/src/models/errors/getmetadatachildren.ts +++ b/src/models/errors/getmetadatachildren.ts @@ -34,8 +34,8 @@ export class GetMetadataChildrenResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetMetadataChildrenResponseBodyData; - constructor(err: GetMetadataChildrenResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetMetadataChildrenResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getmyplexaccount.ts b/src/models/errors/getmyplexaccount.ts index 14a74ead..8bc663a2 100644 --- a/src/models/errors/getmyplexaccount.ts +++ b/src/models/errors/getmyplexaccount.ts @@ -34,8 +34,8 @@ export class GetMyPlexAccountResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetMyPlexAccountResponseBodyData; - constructor(err: GetMyPlexAccountResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetMyPlexAccountResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getondeck.ts b/src/models/errors/getondeck.ts index 96c07ba7..e7a9eabc 100644 --- a/src/models/errors/getondeck.ts +++ b/src/models/errors/getondeck.ts @@ -34,8 +34,8 @@ export class GetOnDeckResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetOnDeckResponseBodyData; - constructor(err: GetOnDeckResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetOnDeckResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getplaylist.ts b/src/models/errors/getplaylist.ts index 8b076011..9c0cfe88 100644 --- a/src/models/errors/getplaylist.ts +++ b/src/models/errors/getplaylist.ts @@ -34,8 +34,8 @@ export class GetPlaylistResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetPlaylistResponseBodyData; - constructor(err: GetPlaylistResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetPlaylistResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getplaylistcontents.ts b/src/models/errors/getplaylistcontents.ts index 3bd97ffd..c2c2da2b 100644 --- a/src/models/errors/getplaylistcontents.ts +++ b/src/models/errors/getplaylistcontents.ts @@ -34,8 +34,8 @@ export class GetPlaylistContentsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetPlaylistContentsResponseBodyData; - constructor(err: GetPlaylistContentsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetPlaylistContentsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getplaylists.ts b/src/models/errors/getplaylists.ts index 67859efc..4a07351c 100644 --- a/src/models/errors/getplaylists.ts +++ b/src/models/errors/getplaylists.ts @@ -34,8 +34,8 @@ export class GetPlaylistsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetPlaylistsResponseBodyData; - constructor(err: GetPlaylistsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetPlaylistsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getrecentlyadded.ts b/src/models/errors/getrecentlyadded.ts index 7c326be0..31dc99fd 100644 --- a/src/models/errors/getrecentlyadded.ts +++ b/src/models/errors/getrecentlyadded.ts @@ -34,8 +34,8 @@ export class GetRecentlyAddedResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetRecentlyAddedResponseBodyData; - constructor(err: GetRecentlyAddedResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetRecentlyAddedResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getresizedphoto.ts b/src/models/errors/getresizedphoto.ts index 2adbc70f..b002a9ea 100644 --- a/src/models/errors/getresizedphoto.ts +++ b/src/models/errors/getresizedphoto.ts @@ -34,8 +34,8 @@ export class GetResizedPhotoResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetResizedPhotoResponseBodyData; - constructor(err: GetResizedPhotoResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetResizedPhotoResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getsearchresults.ts b/src/models/errors/getsearchresults.ts index 2c5378bb..0f4d8dc9 100644 --- a/src/models/errors/getsearchresults.ts +++ b/src/models/errors/getsearchresults.ts @@ -34,8 +34,8 @@ export class GetSearchResultsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetSearchResultsResponseBodyData; - constructor(err: GetSearchResultsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetSearchResultsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getserveractivities.ts b/src/models/errors/getserveractivities.ts index 5b54e564..603fece7 100644 --- a/src/models/errors/getserveractivities.ts +++ b/src/models/errors/getserveractivities.ts @@ -34,8 +34,8 @@ export class GetServerActivitiesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetServerActivitiesResponseBodyData; - constructor(err: GetServerActivitiesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetServerActivitiesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getservercapabilities.ts b/src/models/errors/getservercapabilities.ts index 522bde26..a56d22d5 100644 --- a/src/models/errors/getservercapabilities.ts +++ b/src/models/errors/getservercapabilities.ts @@ -34,8 +34,8 @@ export class GetServerCapabilitiesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetServerCapabilitiesResponseBodyData; - constructor(err: GetServerCapabilitiesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetServerCapabilitiesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getserveridentity.ts b/src/models/errors/getserveridentity.ts index 6f4bf8b8..0de45293 100644 --- a/src/models/errors/getserveridentity.ts +++ b/src/models/errors/getserveridentity.ts @@ -34,8 +34,8 @@ export class GetServerIdentityResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetServerIdentityResponseBodyData; - constructor(err: GetServerIdentityResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetServerIdentityResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getserverlist.ts b/src/models/errors/getserverlist.ts index c1b17871..405b70c9 100644 --- a/src/models/errors/getserverlist.ts +++ b/src/models/errors/getserverlist.ts @@ -34,8 +34,8 @@ export class GetServerListResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetServerListResponseBodyData; - constructor(err: GetServerListResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetServerListResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getserverpreferences.ts b/src/models/errors/getserverpreferences.ts index 6c352cf8..7769e705 100644 --- a/src/models/errors/getserverpreferences.ts +++ b/src/models/errors/getserverpreferences.ts @@ -34,8 +34,8 @@ export class GetServerPreferencesResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetServerPreferencesResponseBodyData; - constructor(err: GetServerPreferencesResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetServerPreferencesResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getsessionhistory.ts b/src/models/errors/getsessionhistory.ts index b496ab64..913a5c70 100644 --- a/src/models/errors/getsessionhistory.ts +++ b/src/models/errors/getsessionhistory.ts @@ -34,8 +34,8 @@ export class GetSessionHistoryResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetSessionHistoryResponseBodyData; - constructor(err: GetSessionHistoryResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetSessionHistoryResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getsessions.ts b/src/models/errors/getsessions.ts index 811f44b0..ba921e8a 100644 --- a/src/models/errors/getsessions.ts +++ b/src/models/errors/getsessions.ts @@ -34,8 +34,8 @@ export class GetSessionsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetSessionsResponseBodyData; - constructor(err: GetSessionsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetSessionsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getsourceconnectioninformation.ts b/src/models/errors/getsourceconnectioninformation.ts index ab4f669a..82ddf05e 100644 --- a/src/models/errors/getsourceconnectioninformation.ts +++ b/src/models/errors/getsourceconnectioninformation.ts @@ -34,8 +34,8 @@ export class GetSourceConnectionInformationResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetSourceConnectionInformationResponseBodyData; - constructor(err: GetSourceConnectionInformationResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetSourceConnectionInformationResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/gettimeline.ts b/src/models/errors/gettimeline.ts index 4b0a07f8..8aaf30d3 100644 --- a/src/models/errors/gettimeline.ts +++ b/src/models/errors/gettimeline.ts @@ -34,8 +34,8 @@ export class GetTimelineResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetTimelineResponseBodyData; - constructor(err: GetTimelineResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetTimelineResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/gettranscodesessions.ts b/src/models/errors/gettranscodesessions.ts index c7b3a0e3..26b1ac4a 100644 --- a/src/models/errors/gettranscodesessions.ts +++ b/src/models/errors/gettranscodesessions.ts @@ -34,8 +34,8 @@ export class GetTranscodeSessionsResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetTranscodeSessionsResponseBodyData; - constructor(err: GetTranscodeSessionsResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetTranscodeSessionsResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/gettransienttoken.ts b/src/models/errors/gettransienttoken.ts index aad549ea..11470d2b 100644 --- a/src/models/errors/gettransienttoken.ts +++ b/src/models/errors/gettransienttoken.ts @@ -34,8 +34,8 @@ export class GetTransientTokenResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetTransientTokenResponseBodyData; - constructor(err: GetTransientTokenResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetTransientTokenResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/getupdatestatus.ts b/src/models/errors/getupdatestatus.ts index 2dc9efa9..b4eb7f41 100644 --- a/src/models/errors/getupdatestatus.ts +++ b/src/models/errors/getupdatestatus.ts @@ -34,8 +34,8 @@ export class GetUpdateStatusResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: GetUpdateStatusResponseBodyData; - constructor(err: GetUpdateStatusResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: GetUpdateStatusResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/logline.ts b/src/models/errors/logline.ts index 67dda36f..3a9b5fb4 100644 --- a/src/models/errors/logline.ts +++ b/src/models/errors/logline.ts @@ -34,8 +34,8 @@ export class LogLineResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: LogLineResponseBodyData; - constructor(err: LogLineResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: LogLineResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/logmultiline.ts b/src/models/errors/logmultiline.ts index cc6bdfad..a6a03ae8 100644 --- a/src/models/errors/logmultiline.ts +++ b/src/models/errors/logmultiline.ts @@ -34,8 +34,8 @@ export class LogMultiLineResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: LogMultiLineResponseBodyData; - constructor(err: LogMultiLineResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: LogMultiLineResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/markplayed.ts b/src/models/errors/markplayed.ts index 9803f30e..3dee96cf 100644 --- a/src/models/errors/markplayed.ts +++ b/src/models/errors/markplayed.ts @@ -34,8 +34,8 @@ export class MarkPlayedResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: MarkPlayedResponseBodyData; - constructor(err: MarkPlayedResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: MarkPlayedResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/markunplayed.ts b/src/models/errors/markunplayed.ts index 0ba5cd20..8d499897 100644 --- a/src/models/errors/markunplayed.ts +++ b/src/models/errors/markunplayed.ts @@ -34,8 +34,8 @@ export class MarkUnplayedResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: MarkUnplayedResponseBodyData; - constructor(err: MarkUnplayedResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: MarkUnplayedResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/performsearch.ts b/src/models/errors/performsearch.ts index 0958c919..f551a0a1 100644 --- a/src/models/errors/performsearch.ts +++ b/src/models/errors/performsearch.ts @@ -34,8 +34,8 @@ export class PerformSearchResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: PerformSearchResponseBodyData; - constructor(err: PerformSearchResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: PerformSearchResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/performvoicesearch.ts b/src/models/errors/performvoicesearch.ts index 9957bd74..bfe39751 100644 --- a/src/models/errors/performvoicesearch.ts +++ b/src/models/errors/performvoicesearch.ts @@ -34,8 +34,8 @@ export class PerformVoiceSearchResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: PerformVoiceSearchResponseBodyData; - constructor(err: PerformVoiceSearchResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: PerformVoiceSearchResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/refreshlibrary.ts b/src/models/errors/refreshlibrary.ts index 02e2ad19..825c4628 100644 --- a/src/models/errors/refreshlibrary.ts +++ b/src/models/errors/refreshlibrary.ts @@ -34,8 +34,8 @@ export class RefreshLibraryResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: RefreshLibraryResponseBodyData; - constructor(err: RefreshLibraryResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: RefreshLibraryResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/startalltasks.ts b/src/models/errors/startalltasks.ts index e4db32d4..dc5ce377 100644 --- a/src/models/errors/startalltasks.ts +++ b/src/models/errors/startalltasks.ts @@ -34,8 +34,8 @@ export class StartAllTasksResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StartAllTasksResponseBodyData; - constructor(err: StartAllTasksResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StartAllTasksResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/starttask.ts b/src/models/errors/starttask.ts index f2973d1b..405aa7dc 100644 --- a/src/models/errors/starttask.ts +++ b/src/models/errors/starttask.ts @@ -34,8 +34,8 @@ export class StartTaskResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StartTaskResponseBodyData; - constructor(err: StartTaskResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StartTaskResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/startuniversaltranscode.ts b/src/models/errors/startuniversaltranscode.ts index 6c8dc01a..6eaf5033 100644 --- a/src/models/errors/startuniversaltranscode.ts +++ b/src/models/errors/startuniversaltranscode.ts @@ -34,8 +34,8 @@ export class StartUniversalTranscodeResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StartUniversalTranscodeResponseBodyData; - constructor(err: StartUniversalTranscodeResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StartUniversalTranscodeResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/stopalltasks.ts b/src/models/errors/stopalltasks.ts index 41f2f318..6d2756ac 100644 --- a/src/models/errors/stopalltasks.ts +++ b/src/models/errors/stopalltasks.ts @@ -34,8 +34,8 @@ export class StopAllTasksResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StopAllTasksResponseBodyData; - constructor(err: StopAllTasksResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StopAllTasksResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/stoptask.ts b/src/models/errors/stoptask.ts index 31c914e5..f7a97544 100644 --- a/src/models/errors/stoptask.ts +++ b/src/models/errors/stoptask.ts @@ -34,8 +34,8 @@ export class StopTaskResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StopTaskResponseBodyData; - constructor(err: StopTaskResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StopTaskResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/stoptranscodesession.ts b/src/models/errors/stoptranscodesession.ts index 05f938c5..2f0c17b5 100644 --- a/src/models/errors/stoptranscodesession.ts +++ b/src/models/errors/stoptranscodesession.ts @@ -34,8 +34,8 @@ export class StopTranscodeSessionResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: StopTranscodeSessionResponseBodyData; - constructor(err: StopTranscodeSessionResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: StopTranscodeSessionResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/updateplaylist.ts b/src/models/errors/updateplaylist.ts index c888a4f9..013464f7 100644 --- a/src/models/errors/updateplaylist.ts +++ b/src/models/errors/updateplaylist.ts @@ -34,8 +34,8 @@ export class UpdatePlaylistResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: UpdatePlaylistResponseBodyData; - constructor(err: UpdatePlaylistResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: UpdatePlaylistResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/updateplayprogress.ts b/src/models/errors/updateplayprogress.ts index 386e0b1e..d7c19a48 100644 --- a/src/models/errors/updateplayprogress.ts +++ b/src/models/errors/updateplayprogress.ts @@ -34,8 +34,8 @@ export class UpdatePlayProgressResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: UpdatePlayProgressResponseBodyData; - constructor(err: UpdatePlayProgressResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: UpdatePlayProgressResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/errors/uploadplaylist.ts b/src/models/errors/uploadplaylist.ts index 042607b8..ffb31398 100644 --- a/src/models/errors/uploadplaylist.ts +++ b/src/models/errors/uploadplaylist.ts @@ -34,8 +34,8 @@ export class UploadPlaylistResponseBody extends Error { /** The original data that was passed to this error instance. */ data$: UploadPlaylistResponseBodyData; - constructor(err: UploadPlaylistResponseBodyData, options?: ErrorOptions) { - super("", options); + constructor(err: UploadPlaylistResponseBodyData) { + super(""); this.data$ = err; if (err.errors != null) { diff --git a/src/models/operations/getlibrary.ts b/src/models/operations/getlibrary.ts index 0bba315c..9233b1da 100644 --- a/src/models/operations/getlibrary.ts +++ b/src/models/operations/getlibrary.ts @@ -59,7 +59,7 @@ export namespace GetLibraryRequest$ { export const inboundSchema: z.ZodType = z .object({ sectionId: z.number(), - includeDetails: IncludeDetails$.optional(), + includeDetails: IncludeDetails$.default(IncludeDetails.Zero), }) .transform((v) => { return { @@ -70,18 +70,18 @@ export namespace GetLibraryRequest$ { export type Outbound = { sectionId: number; - includeDetails?: IncludeDetails | undefined; + includeDetails: IncludeDetails; }; export const outboundSchema: z.ZodType = z .object({ sectionId: z.number(), - includeDetails: IncludeDetails$.optional(), + includeDetails: IncludeDetails$.default(IncludeDetails.Zero), }) .transform((v) => { return { sectionId: v.sectionId, - ...(v.includeDetails === undefined ? null : { includeDetails: v.includeDetails }), + includeDetails: v.includeDetails, }; }); } diff --git a/src/models/operations/getresizedphoto.ts b/src/models/operations/getresizedphoto.ts index 31e3f285..efb9060b 100644 --- a/src/models/operations/getresizedphoto.ts +++ b/src/models/operations/getresizedphoto.ts @@ -32,7 +32,7 @@ export type GetResizedPhotoRequest = { /** * The opacity for the resized photo */ - opacity: number; + opacity?: number | undefined; /** * The width for the resized photo */ @@ -77,7 +77,7 @@ export namespace GetResizedPhotoRequest$ { export type Inbound = { width: number; height: number; - opacity: number; + opacity?: number | undefined; blur: number; minSize: MinSize; upscale: Upscale; @@ -88,7 +88,7 @@ export namespace GetResizedPhotoRequest$ { .object({ width: z.number(), height: z.number(), - opacity: z.number().int(), + opacity: z.number().int().default(100), blur: z.number(), minSize: MinSize$, upscale: Upscale$, @@ -98,7 +98,7 @@ export namespace GetResizedPhotoRequest$ { return { width: v.width, height: v.height, - opacity: v.opacity, + ...(v.opacity === undefined ? null : { opacity: v.opacity }), blur: v.blur, minSize: v.minSize, upscale: v.upscale, @@ -120,7 +120,7 @@ export namespace GetResizedPhotoRequest$ { .object({ width: z.number(), height: z.number(), - opacity: z.number().int(), + opacity: z.number().int().default(100), blur: z.number(), minSize: MinSize$, upscale: Upscale$, diff --git a/src/models/operations/performsearch.ts b/src/models/operations/performsearch.ts index d2a23b11..ca1ad4aa 100644 --- a/src/models/operations/performsearch.ts +++ b/src/models/operations/performsearch.ts @@ -46,7 +46,7 @@ export namespace PerformSearchRequest$ { .object({ query: z.string(), sectionId: z.number().optional(), - limit: z.number().optional(), + limit: z.number().default(3), }) .transform((v) => { return { @@ -59,20 +59,20 @@ export namespace PerformSearchRequest$ { export type Outbound = { query: string; sectionId?: number | undefined; - limit?: number | undefined; + limit: number; }; export const outboundSchema: z.ZodType = z .object({ query: z.string(), sectionId: z.number().optional(), - limit: z.number().optional(), + limit: z.number().default(3), }) .transform((v) => { return { query: v.query, ...(v.sectionId === undefined ? null : { sectionId: v.sectionId }), - ...(v.limit === undefined ? null : { limit: v.limit }), + limit: v.limit, }; }); } diff --git a/src/models/operations/performvoicesearch.ts b/src/models/operations/performvoicesearch.ts index a0e91bcc..63e7f01a 100644 --- a/src/models/operations/performvoicesearch.ts +++ b/src/models/operations/performvoicesearch.ts @@ -46,7 +46,7 @@ export namespace PerformVoiceSearchRequest$ { .object({ query: z.string(), sectionId: z.number().optional(), - limit: z.number().optional(), + limit: z.number().default(3), }) .transform((v) => { return { @@ -59,20 +59,20 @@ export namespace PerformVoiceSearchRequest$ { export type Outbound = { query: string; sectionId?: number | undefined; - limit?: number | undefined; + limit: number; }; export const outboundSchema: z.ZodType = z .object({ query: z.string(), sectionId: z.number().optional(), - limit: z.number().optional(), + limit: z.number().default(3), }) .transform((v) => { return { query: v.query, ...(v.sectionId === undefined ? null : { sectionId: v.sectionId }), - ...(v.limit === undefined ? null : { limit: v.limit }), + limit: v.limit, }; }); }